From ae9920bec0188d958229e7db495c035eda00efc1 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 3 Nov 2003 14:32:27 +0000 Subject: [PATCH] delete PDF files which are older than 10 min --- lam/lib/ldap.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lam/lib/ldap.inc b/lam/lib/ldap.inc index fdfa5abe..b8ce0115 100644 --- a/lam/lib/ldap.inc +++ b/lam/lib/ldap.inc @@ -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