Файловый менеджер - Редактировать - C:/xampp/htdocs/cat/backoffice/_nuevo_usuaris.php
Назад
<?php session_start(); // Incluyo las funciones basicas include "../files/config.php"; include "../files/funciones.php"; // Incluyo funciones espcifica de esta web // Arranque BBDD $link = conectar(); $tabla = "web_usuaris"; // Taula a insertar o modificar de la BBDD $sufix = "usuaris"; // Per directoris i fitxers $sufixDEL = "Usuaris Esborrats"; // Frase de borrar $element = "l'usuari"; // Per treure missatges a pantalla $elementtxt = "usuari"; // Singular sense article $elementBBDD ="nom"; // Per treure missatges a pantalla $calperBBDD = "un NOM"; // Text per indicar que cal per actualitzar BBDD $titolseccio = "Afegir usuari"; // Titol de la prgina ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <?php // HEAD + javascripts ?> <?php include "head.php"; ?> <body> <?php // Cabecera de la web ?> <table align="center" cellpadding="0" cellspacing="1" border="0" bgcolor="#D1D1D1"> <tr> <td> <?php include "cabecera.php"; ?> <table width="950" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF"> <tr class="data"> <td height="15" class="bg_colorback"></td> <td height="15" class="bg_colorback"><p class="textblancBold"><?php echo $titolseccio; ?></p></td> <td height="15" class="bg_colorback"></td> </tr> <tr> <td width="15"></td> <td height="300" valign="top" class="text"> <!-- --> <?php // Acciones de Formulario if (isset($_POST["INSERT"])) { if ($_POST[$elementBBDD]!="") { //$Data = explode("-",$_POST["dataalta"]); //$CadData = sprintf ("%04d-%02d-%02d",$Data[2],$Data[1],$Data[0]) ; //if (!isset($_POST["_destacat"])) $_POST["_destacat"]=0; $sql = "INSERT INTO ".$tabla." (nom,nif,codiuser,password,password_nocode, comissio, comissio_coor, nivell,loginon,timelogin,timelastclick) VALUES ('".$_POST["nom"]."','".$_POST["nif"]."','".$_POST["codiuser"]."','".md5($_POST["password"])."','".$_POST["password"]."','".$_POST["comissio"]."','".$_POST["comissio_coor"]."',0,0,0,0)"; //echo $sql; $result = mysql_query ($sql) or die("<p class=\"text_alerta\"><img src=\"img/s_error.gif\" width=\"22\" height=\"20\" /> ".ucfirst($element)." ".$_POST[$elementBBDD]." no s'ha pogut afegir.</p>"); $last_id = mysql_insert_id($link); //compruebo si las caractersticas del archivo son las que deseo //print_r($_FILES); // FOTO if ($_FILES [ 'foto' ][ 'name' ]!= "") // Si hay fichero preparo la cadena con el fichero nuevo { if (!(strpos($_FILES [ 'foto' ][ 'type' ], "jpeg"))) { ?> <p class="text_alerta">La fotografia ha de ser un fitxer .JPG. No s'ha pogut guardar l'imatge 1, però si <?php echo $element; ?>.</p> <?php } else // Hay fichero y es valido. Es un JPG. { $fichero_foto = sprintf("../images/".$sufix."/%05d_foto_".$sufix.".jpg",$last_id); $ficherosolo_foto = sprintf("%05d_foto_".$sufix.".jpg",$last_id); if (copy($_FILES [ 'foto' ][ 'tmp_name' ], $fichero_foto)) // Fichero copiado ready { //echo "<p class=\"data\">La fotografia ha sido guardada correctamente.</p>\n"; // $filename_corto,$Sdirectory,$Ddirectory,$Swidth $sql = "UPDATE ".$tabla." SET foto ='".$ficherosolo_foto."' WHERE id = '".$last_id."' LIMIT 1"; $result = mysql_query ($sql) or die("<p class=\"text_alerta\">No s'ha pogut modificar ".$element." correctament amb el nom del fitxer de la imatge.</p>"); //echo "<p class=\"data\">".ucfirst($element)." ha sido actualizada con la fotografia correctamente.</p>\n"; } else { ?> <p class="text_alerta">No s'ha pogut guardar la fotografia. Problema al servidor.</p> <?php } } } if ($_FILES [ 'fitxer' ][ 'name' ]) { $fitxer = $_FILES [ 'fitxer' ][ 'name' ]; $fitxer = str_replace("'","",$fitxer); $fitxer = str_replace('"',"",$fitxer); $fitxer = str_replace("\'","",$fitxer); $fitxer = str_replace('\"',"",$fitxer); $fitxer = str_replace('\\',"",$fitxer); $fitxer = str_replace('/',"",$fitxer); $fitxer = str_replace(' ',"_",$fitxer); $fitxer = str_replace('*',"",$fitxer); $fitxer = str_replace('$',"",$fitxer); $fitxer = str_replace('&',"",$fitxer); $fitxer = str_replace('%',"",$fitxer); $fitxer = str_replace('?',"",$fitxer); $fitxer = str_replace('z',"",$fitxer); $fitxer = str_replace('A',"",$fitxer); $fitxer = str_replace('!',"",$fitxer); $fitxer = str_replace('#',"",$fitxer); $fitxer = str_replace('|',"",$fitxer); $fitxer = str_replace('<',"",$fitxer); $fitxer = str_replace('>',"",$fitxer); $fitxer = elimina_acentos($fitxer); copy($_FILES [ 'fitxer' ][ 'tmp_name' ],'../arxiu/'.$fitxer); $sql = "UPDATE ".$tabla." SET fitxer='".$fitxer."' WHERE id=".$last_id." LIMIT 1"; //echo $sql; $result = mysql_query ($sql) or die("<p class=\"text_alerta\"><img src=\"img/s_error.gif\" width=\"22\" height=\"20\" /> El Fitxer de ".$element." ".$_POST[$elementBBDD]." no s'ha pogut adjuntar.</p>"); } ?> <p class="text_alertaok"><img src="img/s_ok.gif" width="22" height="20" /> <? echo ucfirst($element)." ".$_POST[$elementBBDD]; ?> ha sigut afegida amb èxit.</p> <?php } else { ?> <p class="text_alerta">CAL al menys <?php echo $calperBBDD; ?> per poder donar d'alta <?php echo $element; ?>.</p> <?php } ?> <?php unset ($_POST["INSERT"]); } ?> <form method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="data"> <tr> <td valign="top" class="text_black_bold"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold">Codi Usuari</td> <td width="12" valign="top"> </td> <td valign="top"><input name="codiuser" type="text" class="form_input" id="codiuser" size="20" maxlength="20" /> <br /> *Màxim de 20 caracters [A-Z,a-z,0-9, -, _]</td> <td valign="top"> </td> <td width="12" valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold">Nom</td> <td valign="top"> </td> <td valign="top"><input name="nom" type="text" class="form_input" id="nom" size="94" maxlength="250" /></td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold">NIF</td> <td valign="top"> </td> <td valign="top"><input name="nif" type="text" class="form_input" id="nif" size="20" maxlength="20" /></td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold">Contrasenya</td> <td valign="top"> </td> <td valign="top"><input name="password" type="text" class="form_input" id="password" size="94" maxlength="250" /> <br /> Sempre es podrà donar una nova modificant el perfil del usuari.</td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold">Coordinador de la Comissió</td> <td valign="top"> </td> <td valign="top"><select name="comissio_coor" class="form_input" id="comissio_coor"> <option value="0" selected="selected">-Sense asignació-</option>'; <?php $sqltipus = "SELECT * FROM web_comissions"; //echo $sql."<br />"; $resulttipus = mysql_query($sqltipus) or die("No ha sido posible realizar la consulta tipus"); while ($linetipus = mysql_fetch_array($resulttipus, MYSQL_ASSOC)) { echo '<option value="'.$linetipus["id"].'">'.$linetipus["nomCA"].'</option>'; } ?> </select></td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold">Pertany a la comissió</td> <td valign="top"> </td> <td valign="top"><select name="comissio" class="form_input" id="comissio"> <option value="0" selected="selected">-Sense asignació-</option>'; <?php $sqltipus = "SELECT * FROM web_comissions"; //echo $sql."<br />"; $resulttipus = mysql_query($sqltipus) or die("No ha sido posible realizar la consulta tipus"); while ($linetipus = mysql_fetch_array($resulttipus, MYSQL_ASSOC)) { echo '<option value="'.$linetipus["id"].'">'.$linetipus["nomCA"].'</option>'; } ?> </select></td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_blue_bold"> </td> <td valign="top"> </td> <td valign="top"><input name="INSERT" type="submit" class="form_submit" id="INSERT" value="Afegir" /></td> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_blue_bold"> </td> <td width="12" valign="top"> </td> <td valign="top"> </td> <td valign="top"> </td> <td width="12" valign="top"> </td> </tr> </table> </form> </td> <td width="15"></td> </tr> <tr> <td height="15" colspan="3"></td> </tr> </table> </td> </tr> </table> <?php // Texto final y cierres de BBDD ?> <?php include "pie.php"; ?> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 5.3.8 | Генерация страницы: 0.12 |
proxy
|
phpinfo
|
Настройка