delete PDF files which are older than 10 min

This commit is contained in:
Roland Gruber 2003-11-03 14:32:27 +00:00
parent cad6c58fa7
commit ae9920bec0
1 changed files with 15 additions and 0 deletions

View File

@ -346,6 +346,21 @@ class Ldap{
// change random number
mt_srand($this->rand + (microtime() * 1000000));
$this->rand = mt_rand();
// delete PDF files which are older than 10 min
if (isset($_SESSION['lampath'])) {
$relpath = $_SESSION['lampath'] . 'tmp/';
$time = time();
$dir = @opendir($relpath);
while ($file = @readdir($dir)) {
if (substr($file, -4) == '.pdf') {
$path = $relpath . $file;
if ($time - filemtime($path) > 600) {
@unlink($path);
}
}
}
@closedir($h);
}
}
// encrypts username and password