文件操作 - eventi.php
返回文件管理
返回主菜单
删除本文件
文件: /root/.local/share/Trash/files/gpshowroommilano--com-SUSPENDED/--old_old/admin/eventi.php
编辑文件内容
<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>GP Admin</title> <style> body{ padding:0; margin:0; background-image:url(../img/sfondo_uniforme.png); margin:0; font-family:Tahoma, Geneva, sans-serif; font-size:11px; line-height:16px;} a{ text-decoration:none; color:#fff;} .pulsante{ float:left; padding:5px 10px; font-size:12px; color:#000; background-color:#eee; border:0;} </style> </head> <body> <a href="../admin/"><img style="margin:20px;" src="../img/logo.png" width="152" height="103" /></a> <?php $id=$_POST["id"]; $foto=$_POST["foto"]; $testo=$_POST["testo"]; include('config.php'); $DB = new DB(); $DB->connect(); $tabella="eventi"; /////////////////////////////////////////////////////////////////////////////////////////// if(isset($_POST['aggiungi'])) { $query = "INSERT INTO $tabella (id, testo) VALUES(NULL,'$testo') "; mysql_query($query) or die('Error, query failed. ' . mysql_error()); //PRELEVO ID APPENA CREATO $query = "SELECT id FROM $tabella ORDER BY id DESC LIMIT 1"; $result = mysql_query($query) or die('Error, query failed. ' . mysql_error()); $variabili_db = mysql_fetch_array($result); $id=$variabili_db["id"]; //aggiorna foto1 if($_FILES['foto']['name']) { $rand=rand(1000,9999); $uploaddir = '../eventi/'; $uploadfile = $uploaddir . $rand."_".$_FILES['foto']['name']; $nomefile = "eventi/".$rand."_".$_FILES['foto']['name']; move_uploaded_file($_FILES['foto']['tmp_name'], $uploadfile); $query = "UPDATE $tabella SET foto='$nomefile' WHERE id='$id' "; mysql_query($query) or die('Error, query failed. ' . mysql_error()); } } /////////////////////////////////////////////////////////////////////////////////////////// if(isset($_POST['modifica'])) { $query = "UPDATE $tabella SET testo='$testo' WHERE id='$id' "; //aggiorna foto1 if($_FILES['foto']['name']) { $rand=rand(1000,9999); $uploaddir = '../eventi/'; $uploadfile = $uploaddir . $rand."_".$_FILES['foto']['name']; $nomefile = "eventi/".$rand."_".$_FILES['foto']['name']; move_uploaded_file($_FILES['foto']['tmp_name'], $uploadfile); $query = "UPDATE $tabella SET foto='$nomefile' WHERE id='$id' "; mysql_query($query) or die('Error, query failed. ' . mysql_error()); } mysql_query($query) or die('Error, query failed. ' . mysql_error()); } /////////////////////////////////////////////////////////////////////////////////////////// if(isset($_GET['elimina'])) { $id_del=$_GET['id_del']; $query = "DELETE FROM $tabella WHERE id='$id_del'"; mysql_query($query) or die('Error, query failed. ' . mysql_error()); } /////////////////////////////////////////////////////////////////////////////////////////// ?> <div style="float:left; width:100%; margin-top:20px;"> <?php if(!$_POST['action']=="modifica"){ ?> <form style="float:left; margin-left:20px; margin-top:20px;" id="form1" name="form1" method="post" action="" enctype="multipart/form-data"> <input type="hidden" value="<?=$id?>" name="id" /> <table width="500" border="0" align="left" cellpadding="5" cellspacing="2"> <tr> <td width="122" valign="top">foto</td> <td width="438"><input type="file" name="foto" id="foto" /> <br /> <?php if($foto) { ?> <img src="../<?=$foto?>" alt="" style="max-width:150px; max-height:150px;" /> <?php } ?></td> </tr> <tr> <td valign="top">testo</td> <td><textarea name="testo" id="testo" cols="45" rows="5"></textarea></td> </tr> <tr style="background-image:url(../img/sfondo_sfumato.jpg)"> <td valign="top"> </td> <td><input class="pulsante" type="submit" name="aggiungi" id="aggiungi" value="INSERISCI NEWS" /></td> </tr> </table> </form> <?php } //fine if else { $query = "SELECT id, foto, testo FROM $tabella WHERE id='$id' "; $result = mysql_query($query) or die('Error, query failed. ' . mysql_error()); while($row = mysql_fetch_array($result)){ list($id, $foto, $testo) = $row;} ?> <div style="float:left; margin-left:20px; "><?php if($foto) { ?><img src="../<?=$foto?>" alt="" style="max-height:250px;" /><?php } ?></div> <form style="float:left; margin-left:20px; margin-top:20px;" id="form1" name="form1" method="post" action="" enctype="multipart/form-data"> <input type="hidden" value="<?=$id?>" name="id" /> <table width="500" border="0" align="left" cellpadding="5" cellspacing="2"> <tr> <td width="148" valign="top">cambia foto</td> <td width="438"> <input type="file" name="foto" id="foto" /><br /> </td> </tr> <tr style="background-image:url(../img/sfondo_sfumato.jpg)"> <td>testo</td> <td><textarea name="testo" id="testo" cols="45" rows="5"><?=$testo?></textarea></td> </tr> <tr> <td><br /></td> <td><input class="pulsante" type="submit" name="modifica" id="modifica" value="CONFERMA MODIFICA" /> <a style=" float:right;padding:1px 5px; background-color:#FFF; color:#999; border:#999 solid 1px;" href="?p=eventi.php&id_del=<?=$id?>&elimina=1">ELIMINA NEWS</a></td> </tr> </table> </form> <?php }//fine else ?> </div> <div id="lista_prodotti" style="float:left; width:100%; margin-top:20px; border-top:#eee solid 2px;"> <?php $query = "SELECT id, foto, testo FROM $tabella ORDER BY id DESC "; $result = mysql_query($query) or die('Error, query failed. ' . mysql_error()); while($row = mysql_fetch_array($result)) { list($id, $foto, $testo) = $row; ?> <div id="prodotto" style="float:left; border-bottom:#eee solid 2px; border-right:#eee solid 2px; background-color:#fff; padding:10px; margin:20px 0px 0px 20px; width:150px; height:150px;"> <a href="#" onclick="document.getElementById('form_<?=$id?>').submit();"><img src="../<?=$foto?>" style="max-width:150px; max-height:100px;" /></a> <form style="float:right; width:100%; text-align:right;" action="" method="post" name="form_<?=$id?>" id="form_<?=$id?>"> <input type="hidden" name="action" value="modifica" /> <input type="hidden" name="id" value="<?=$id?>" /> <input type="hidden" name="foto" value="<?=$foto?>" /> <input type="hidden" name="testo" value="<?=$testo?>" /> </form> </div> <?php } //fine while ?> </div> <?php $DB->disconnect(); ?> </body> </html>
修改文件时间
将文件时间修改为当前时间的前一年
删除文件