Location: PHPKode > projects > Stuffed Tracker - Web Traffic Monitoring & Analysis > stuffed-tracker-web-traffic-monitoring-analysis/actions/admin.cron_monitor.php
<?
if (!defined("NS_TRACKER_INDEX")) exit;
if (!$nsUser->Logged()) $nsProduct->Redir("login", "", "admin");
if ($nsProduct->LICENSE==3&&!$nsUser->ADMIN) $nsProduct->Redir("default", "", "admin");
if ($nsProduct->LICENSE!=3&&!$nsUser->SUPER_USER) $nsProduct->Redir("default", "", "admin");

$nsLang->TplInc("admin.admin");
$nsLang->TplInc("inc/top_panel.inc");
$PageTitle = $Lang['CronProcesses'];

$List = V($_REQUEST['List']);
$StopId = V($_REQUEST['StopId']);
$CancelId = V($_REQUEST['CancelId']);

if ($StopId) {
    $Query = "UPDATE ?_cron_log SET TO_STOP = ? WHERE ID = ?";
    $Db->Query($Query, gmdate("Y-m-d H:i:s", time()), $StopId);
    exit;
}

if ($CancelId) {
    $Query = "DELETE FROM ?_cron_task WHERE ID=? AND IN_PROGRESS != '1' ";
    $Db->Query($Query, $CancelId);
    exit;
}

if ($List) {
    $Proc = array();
    $Query = "SELECT *, UNIX_TIMESTAMP(DATE_ADD(STAMP, INTERVAL '{$nsUser->SQL_TZ}' HOUR_MINUTE)) AS STAMP  
                       FROM ?_cron_log ORDER BY FINISHED ASC, STAMP DESC LIMIT 20";
    $Sql = new Query($Query);
    while ($Row=$Sql->Row()) {
        $Row->TimeArr = TimeArr($Row->RUN_TIME);
        $Proc[]=$Row;
    }
    
    $Tasks = array();
    $Query = "SELECT * FROM ?_cron_task";
    $Sql = new Query($Query);
    while ($Row=$Sql->Row()) {
        $tmp = explode('|',$Row->TASK);
        $Row->Parts = array();
        foreach ($tmp as $k) {
            if ($k=='UpdateAgents') $Row->Parts[]=$Lang['UpdateAgents'];
            if ($k=='UpdateSEngines') $Row->Parts[]=$Lang['UpdateSearch'];
            if ($k=='UpdateLocations') $Row->Parts[]=$Lang['UpdateGeo'];
        }
        $Row->DESCRIPTION = implode(', ', $Row->Parts);
        $Tasks[]=$Row;
    }
    
    include $nsTemplate->Inc();
}
else {
    
    $ProgPath[0]['Name']=$Lang['Administr'];
    $ProgPath[0]['Url']=getURL("admin", "", "admin");
    $ProgPath[1]['Name']=$Lang['CronProcesses'];
    $ProgPath[1]['Url']=getURL("cron_monitor", "", "admin");
    $MenuSection="admin";
    
    include $nsTemplate->Inc('inc/header');
    include $nsTemplate->Inc();
    include $nsTemplate->Inc('inc/footer');
}
?>
Return current item: Stuffed Tracker - Web Traffic Monitoring & Analysis