<?php
//запуск каждые 15 минут
DEFINE("ROOT_DIR", realpath(dirname(__FILE__).'/../') );
require(ROOT_DIR."/config.php");

$sql=mysql_query("SELECT `id` FROM `b_basket` WHERE `time`<='".(time()-86400)."' AND `type`<>'4'");
if(mysql_num_rows($sql) > 0){
while($row=mysql_fetch_assoc($sql)){
mysql_query("DELETE FROM `b_basket` WHERE `id`='".$row["id"]."'");
}
}

$sql=mysql_query("SELECT `id`, `ident` FROM `b_basket` WHERE `time`<='".(time()-3600)."' AND `type`='4'");
if(mysql_num_rows($sql) > 0){
while($row=mysql_fetch_assoc($sql)){
mysql_query("DELETE FROM `b_basket` WHERE `id`='".$row["id"]."'");
mysql_query("UPDATE `b_jarmarka` SET `bron`='0' WHERE `id`='".$row["ident"]."'");
}
}

// очистка кодов верификации 
mysql_query("DELETE FROM `b_ver_code` WHERE `data` <= '".(time()-3600)."'") or die(mysql_error());

// снятие с випа задания
mysql_query("UPDATE `seo_tasks` SET `inblock` = `0` WHERE `inblock` < '".time()."'");

?> 