Admin
user: admin
pass: admin
Look:
Warning: Invalid argument supplied for foreach() in /mnt/data/accounts/k/kuba1999/data/www/upload/library/cache/cache.php on line 26
Warning: Invalid argument supplied for foreach() in /mnt/data/accounts/k/kuba1999/data/www/upload/library/cache/cache.php on line 37
Where is problem? (in cache.php)
My code cache.php
Code: Select all
<?php
class Cache {
var $expire = 3600;
function __construct() {
foreach (glob(DIR_CACHE . 'cache.*') as $file) {
$array = explode('.', end(explode('/', $file)));
if ($array[2] < time()) {
unlink($file);
}
}
}
function set($key, $value) {
$this->delete($key);
$file = fopen(DIR_CACHE . 'cache.' . $key . '.' . (time() + $this->expire), 'a');
fwrite($file, serialize($value));
fclose($file);
}
function get($key) {
foreach (glob(DIR_CACHE . 'cache.' . $key . '.*') as $file) {
$handle = fopen($file, 'r');
$cache = fread($handle, filesize($file));
fclose($handle);
return unserialize($cache);
}
}
function delete($key) {
foreach (glob(DIR_CACHE . 'cache.' . $key . '.*') as $file) {
unlink($file);
}
}
}
?>