summaryrefslogtreecommitdiffstats
path: root/admin/purgecache.php
blob: a5af5cf62616d9bdc693e95a7842779668187267 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
require_once dirname(__FILE__).'/inc/auth.inc.php';

if (isset($_POST['purge'])){
    $dir = dirname(__FILE__).'/../cache/';
    
    $dh = opendir($dir);
    
    while ($filename = readdir($dh)) {
        if ($filename == '.' OR $filename == '..') {
            continue;
        }
        
        if (filemtime($dir . DIRECTORY_SEPARATOR . $filename) < time()) {
            @unlink($dir . DIRECTORY_SEPARATOR . $filename);
        }
    }
}

header('Location: administration.php');
die();