//connessione al database require ("dbconn.inc"); //sessione require ("sessione.inc"); ######## CANCELLAZIONE PER IL WEBMASTER //prendo l'eventuale operazione if (isset($_GET["OP"])) $OP=$_GET["OP"]; else if (isset($_POST["OP"])) $OP=$_POST["OP"]; else $OP=""; //titolo $TITOLO="TeLoRegalo.it, Procedura di cancellazione per il webmaster"; echo "
";
//messaggio sotto il titolo
echo "
Strumento per il webmaster per la cancellazione degli annunci dal sito
"; //formatto contenuti echo " ";
if ($OP=="CANC")
{
if (isset($_GET["VAL"])) $VAL=$_GET["VAL"];
else if (isset($_POST["VAL"])) $VAL=$_POST["VAL"];
else $VAL="";
if (isset($_GET["PASS"])) $PASS=$_GET["PASS"];
else if (isset($_POST["PASS"])) $PASS=$_POST["PASS"];
else $PASS="";
//inizializzo i flag
$flagiderrato=0;
$flagchiaveerrata=0;
//prende i dati per l'attivazione
$IDANNUNCIO=$VAL;
if ($PASS<>"zurigo")
{
echo
" CANCELLAZIONE NON ESEGUITAATTENZIONE! L'annuncio non è stato cancellato per il seguente motivo: "; echo "- Chiedere al webmaster"; echo " Riprova - Home Page"; } else { //prende data, ora e IP remoto $timestamp=date("Y-m-d")." ".date("H:i:s"); $REMOTE_ADDR=$_SERVER["REMOTE_ADDR"]; //estraggo il record $q="select * from annunci where idannuncio='$IDANNUNCIO'"; $ri=mysql_db_query($database,$q,$id) or die(mysql_error()); if (mysql_num_rows($ri)==1) { //prendo il record annuncio $RECORD=mysql_fetch_array($ri); if ($RECORD["stato"]<>'CA') { //cancella logicamente il record solo se nn è stato già cancellato $q="update annunci set stato='CA', chicanc='W', datacanc='$timestamp', ipcanc='$REMOTE_ADDR' where idannuncio='$IDANNUNCIO'"; mysql_db_query($database,$q,$id) or die(mysql_error()); //copio il record nella tabella dei cancellati $q="INSERT INTO annunci_cancellati SELECT * FROM annunci WHERE idannuncio='$IDANNUNCIO'"; $ri=mysql_db_query($database,$q,$id) or die(mysql_error()); //cancello il record dalla tabella originale $q="DELETE FROM annunci WHERE idannuncio='$IDANNUNCIO'"; $ri=mysql_db_query($database,$q,$id) or die(mysql_error()); } //eventuale immagine /* if ($RECORD["imagename"]<>"") { $imgsource="/home/w9/gen.officine.it/www/infoannunci.com/imagesusr/".$RECORD["imagename"]; if (file_exists($imgsource)) { //esiste immagine //nuovo nome immagine $imgdest ="/home/w9/gen.officine.it/www/infoannunciimagedel/".$RECORD["imagename"]; //rename (vecchionome, nuovonome) if (rename($imgsource, $imgdest)) echo " Immagine presente e cancellata "; else echo "Immagine presente ma NON cancellata "; } } else echo "Immagine NON presente "; */ echo "
L'annuncio è stato cancellato correttamente.
ATTENZIONE: L'annuncio NON è stato cancellato correttamente.
PROCEDURA PER IL WEBMASTER PER LA CANCELLAZIONE DEGLI ANNUNCI |
TeLoRegalo.it è un servizio di Officine Informatiche Srl P.IVA 01928990603 - Note legali
"; //chiudo il center echo "