14 lines
905 B
PHP
Executable File
14 lines
905 B
PHP
Executable File
<?php
|
|
include_once ("config.php");
|
|
$query = "SELECT * FROM allegati WHERE scadenza < now() AND vecchio=0 AND permanente=0 UNION SELECT allegati.* FROM allegati JOIN accesso_allegati ON allegati.id = accesso_allegati.idallegato WHERE allegati.vecchio=0 AND allegati.autocancella=1 AND accesso_allegati.quando < subtime(now(),'12:0:0.0')";
|
|
$res = mysql_query( $query, $DB_ID );
|
|
|
|
while ($dato = @mysql_fetch_array ( $res )) {
|
|
print "Rimosso file ".$dato['nomefile']." di proprieta' dell'utente ".$dato['utente']."\n";
|
|
unlink ($dato['storage']);
|
|
$query = "UPDATE allegati SET vecchio=1, scadenza=now() WHERE id=".$dato['id'];
|
|
$res = mysql_query( $query, $DB_ID );
|
|
invia_mail ("Eliminazione allegato ".$dato['nomefile'], "In data ".date("Y-m-d H:i:s")." e' stato eliminato il file ".$dato['nomefile'], $dato['utente']);
|
|
logga ("Eliminato allegato ".$dato['codice']." per scadenza", $dato['utente']);
|
|
}
|
|
?>
|