<?php
session_name('portal_absa');
session_start();
if(!isset($_SESSION['usuario_p_prov_absa']) || trim($_SESSION['usuario_p_prov_absa']) == "" || trim(strtoupper($_SESSION["URL_PORTAL"]."admin.php")) != trim(strtoupper($_SERVER['HTTP_REFERER']))){
	?><script>window.location.href="<?=$_SESSION["URL_PORTAL"]."index.php"?>"</script><?
	exit;
}
try{
	$fechaHoy = date("Ymd");

	if ($handle = opendir('zip/')) {
		while (false !== ($file = readdir($handle)))
		{
			if ($file != "." && $file != ".." && strtolower(substr($file, strrpos($file, '.') + 1)) == 'zip')
			{
				//echo $thelist .= '<li><a href="'.$file.'">'.$file.'</a></li>';
				if(substr($file,0,8) < $fechaHoy){
					if(is_file('zip/'.$file)){
						unlink('zip/'.$file);
					}
				}
			}
		}
		closedir($handle);
		echo "TRUE";
	}
}catch(Exception $e){
	echo "FALSE";
}
?>