Файловый менеджер - Редактировать - C:/xampp/htdocs/documents/modificar_documents.php.tar
Назад
C:/xampp/htdocs/backoffice/modificar_documents.php 0000666 00000022631 15155067216 0016254 0 ustar 00 <?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_documents"; // Taula a insertar o modificar de la BBDD $sufix = "documents"; // Per directoris i fitxers $element = "el document"; // Per treure missatges a pantalla $elementtxt = "document"; // Singular sense article $elementBBDD ="nom"; // Per treure missatges a pantalla $calperBBDD = "un nom"; // Text per indicar que cal per actualitzar BBDD $titolseccio = "Modificar document"; // Titol de la pgina ?> <!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 $id = $_GET["id"]; if (isset($_POST["DELFITXER"])) { $sql = "UPDATE ".$tabla." SET fitxer='' WHERE id=".$_POST["id"]." LIMIT 1"; $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 modificar.</p>"); unlink ("../arxiu/".$_POST["fitxervell"]); ?> <p class="text_alertaok"><img src="img/s_ok.gif" width="22" height="20" /> El Fitxer de <?php echo $element;?> <? echo $_POST[$elementBBDD]; ?> ha sigut eliminat amb èxit.</p> <?php } if (isset($_POST["MODIFICAR"])) { if ($_POST[$elementBBDD]!="") { $sql = "UPDATE ".$tabla." SET nom='".$_POST["nom"]."', tipus='".$_POST["tipus"]."', categoria=".$_POST["categoria"].", pujat_per='".$_POST["pujat_per"]."' WHERE id=".$_POST["id"]." LIMIT 1"; $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 modificar.</p>"); $last_id = mysql_insert_id($link); 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('',"",$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 = elimina_acentos($fitxer); //echo $_FILES [ 'fitxer' ]['tmp_name']; die(); copy($_FILES [ 'fitxer' ][ 'tmp_name' ],'../documents/'.$fitxer); $sql = "UPDATE ".$tabla." SET document='".$fitxer."' WHERE id=".$_POST["id"]." LIMIT 1"; $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]; ?> s'ha modificat 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["MODIFICAR"]); } ?> <?php $sql = "SELECT * FROM ".$tabla." WHERE id=".$id." LIMIT 1"; //echo $sql."<br />"; $result = mysql_query($sql) or die("No ha sido posible realizar la consulta"); $line = mysql_fetch_array($result, MYSQL_ASSOC); ?> <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 width="12" valign="top"> </td> <td colspan="2" valign="top"> </td> <td width="12" valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold">Tipus</td> <td width="12" valign="top"> </td> <td valign="top"> <select name="tipus" class="form_input" id="tipus"> <option value="" <?php if($line["tipus"] == ""){ echo " selected='selected' ";}?> >Privat (noms rea interna)</option> <option value="Publics" <?php if($line["tipus"] == "Publics"){ echo " selected='selected' ";}?> >Publics</option> </select> </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">Categoria</td> <td width="12" valign="top"> </td> <td valign="top"> <select name="categoria" class="form_input" id="categoria"> <?php $c = mysql_query("SELECT * FROM web_categoriesd ORDER BY ordre ASC"); while($a = mysql_fetch_array($c)){ echo "<option value='".$a['id']."'"; if($line["categoria"] == $a['id']){ echo " selected='selected' "; } echo ">".$a['nom']."</option>"; } ?> </select> </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 width="12" valign="top"> </td> <td valign="top"><input name="nom" type="text" class="form_input" id="nom" value="<?php echo htmlspecialchars($line["nom"]); ?>" size="32" maxlength="100" /></td> <td align="center" valign="top"> </td> <td width="12" valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold"> </td> <td width="12" valign="top"> </td> <td valign="top"> </td> <td align="center" valign="top"> </td> <td width="12" valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold">Fitxer Adjunt</td> <td valign="top"> </td> <td valign="top"><input name="fitxer" type="file" class="form_fichero" id="fitxer" size="50" /> <?php if ($line["document"]!="") { ?> <p> Fitxer Actual: <?php echo $line["document"]; ?></p> <p> <input name="DELFITXER" type="submit" class="form_submit" id="DELFITXER" value="Eliminar Fitxer de <?php echo $element; ?>" /> <input name="fitxervell" type="hidden" id="fitxervell" value="<?php echo $line["document"]; ?>" /> </p> <?php } else { ?> <p> Actualment no hi ha Fitxer asociat.</p> <?php } ?> </td> <td align="center" valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold"> </td> <td width="12" valign="top"> </td> <td valign="top"> </td> <td align="center" 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"><input name="MODIFICAR" type="submit" class="form_submit" id="MODIFICAR" value="Modificar" /> <input name="id" type="hidden" value="<?php echo $id; ?>" /> <input type="hidden" name="pujat_per" id="pujat_per" value="<?php echo $line['pujat_per'];?>" /></td> <td align="center" valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_blue_bold"> </td> <td width="12" valign="top"> </td> <td colspan="2" 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> C:/xampp/htdocs/cat/backoffice/modificar_documents.php 0000666 00000022631 15155100041 0017003 0 ustar 00 <?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_documents"; // Taula a insertar o modificar de la BBDD $sufix = "documents"; // Per directoris i fitxers $element = "el document"; // Per treure missatges a pantalla $elementtxt = "document"; // Singular sense article $elementBBDD ="nom"; // Per treure missatges a pantalla $calperBBDD = "un nom"; // Text per indicar que cal per actualitzar BBDD $titolseccio = "Modificar document"; // Titol de la pgina ?> <!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 $id = $_GET["id"]; if (isset($_POST["DELFITXER"])) { $sql = "UPDATE ".$tabla." SET fitxer='' WHERE id=".$_POST["id"]." LIMIT 1"; $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 modificar.</p>"); unlink ("../arxiu/".$_POST["fitxervell"]); ?> <p class="text_alertaok"><img src="img/s_ok.gif" width="22" height="20" /> El Fitxer de <?php echo $element;?> <? echo $_POST[$elementBBDD]; ?> ha sigut eliminat amb èxit.</p> <?php } if (isset($_POST["MODIFICAR"])) { if ($_POST[$elementBBDD]!="") { $sql = "UPDATE ".$tabla." SET nom='".$_POST["nom"]."', tipus='".$_POST["tipus"]."', categoria=".$_POST["categoria"].", pujat_per='".$_POST["pujat_per"]."' WHERE id=".$_POST["id"]." LIMIT 1"; $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 modificar.</p>"); $last_id = mysql_insert_id($link); 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('',"",$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 = elimina_acentos($fitxer); //echo $_FILES [ 'fitxer' ]['tmp_name']; die(); copy($_FILES [ 'fitxer' ][ 'tmp_name' ],'../documents/'.$fitxer); $sql = "UPDATE ".$tabla." SET document='".$fitxer."' WHERE id=".$_POST["id"]." LIMIT 1"; $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]; ?> s'ha modificat 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["MODIFICAR"]); } ?> <?php $sql = "SELECT * FROM ".$tabla." WHERE id=".$id." LIMIT 1"; //echo $sql."<br />"; $result = mysql_query($sql) or die("No ha sido posible realizar la consulta"); $line = mysql_fetch_array($result, MYSQL_ASSOC); ?> <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 width="12" valign="top"> </td> <td colspan="2" valign="top"> </td> <td width="12" valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold">Tipus</td> <td width="12" valign="top"> </td> <td valign="top"> <select name="tipus" class="form_input" id="tipus"> <option value="" <?php if($line["tipus"] == ""){ echo " selected='selected' ";}?> >Privat (noms rea interna)</option> <option value="Publics" <?php if($line["tipus"] == "Publics"){ echo " selected='selected' ";}?> >Publics</option> </select> </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">Categoria</td> <td width="12" valign="top"> </td> <td valign="top"> <select name="categoria" class="form_input" id="categoria"> <?php $c = mysql_query("SELECT * FROM web_categoriesd ORDER BY ordre ASC"); while($a = mysql_fetch_array($c)){ echo "<option value='".$a['id']."'"; if($line["categoria"] == $a['id']){ echo " selected='selected' "; } echo ">".$a['nom']."</option>"; } ?> </select> </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 width="12" valign="top"> </td> <td valign="top"><input name="nom" type="text" class="form_input" id="nom" value="<?php echo htmlspecialchars($line["nom"]); ?>" size="32" maxlength="100" /></td> <td align="center" valign="top"> </td> <td width="12" valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold"> </td> <td width="12" valign="top"> </td> <td valign="top"> </td> <td align="center" valign="top"> </td> <td width="12" valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold">Fitxer Adjunt</td> <td valign="top"> </td> <td valign="top"><input name="fitxer" type="file" class="form_fichero" id="fitxer" size="50" /> <?php if ($line["document"]!="") { ?> <p> Fitxer Actual: <?php echo $line["document"]; ?></p> <p> <input name="DELFITXER" type="submit" class="form_submit" id="DELFITXER" value="Eliminar Fitxer de <?php echo $element; ?>" /> <input name="fitxervell" type="hidden" id="fitxervell" value="<?php echo $line["document"]; ?>" /> </p> <?php } else { ?> <p> Actualment no hi ha Fitxer asociat.</p> <?php } ?> </td> <td align="center" valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_black_bold"> </td> <td width="12" valign="top"> </td> <td valign="top"> </td> <td align="center" 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"><input name="MODIFICAR" type="submit" class="form_submit" id="MODIFICAR" value="Modificar" /> <input name="id" type="hidden" value="<?php echo $id; ?>" /> <input type="hidden" name="pujat_per" id="pujat_per" value="<?php echo $line['pujat_per'];?>" /></td> <td align="center" valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top" class="text_blue_bold"> </td> <td width="12" valign="top"> </td> <td colspan="2" 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
|
Настройка