Example #1
0
function clientCronRun($db)
{
    //heres the psuedo cronjobs
    if (Run1MinCronjob($db) == true) {
        if (RunHourlyCronJob($db) == true) {
            RunDailyCronjob($db);
        }
    }
}
Example #2
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/202-config/connect.php';
//heres the psuedo cronjobs
if (Run1MinCronjob() == true) {
    if (RunHourlyCronJob() == true) {
        RunDailyCronjob();
    }
}
function RunDailyCronjob()
{
    //check to run the daily cronjob
    $now = time();
    $today_day = date('j', time());
    $today_month = date('n', time());
    $today_year = date('Y', time());
    //the click_time is recorded in the middle of the day
    $cronjob_time = mktime(12, 0, 0, $today_month, $today_day, $today_year);
    $mysql['cronjob_time'] = mysql_real_escape_string($cronjob_time);
    $mysql['cronjob_type'] = mysql_real_escape_string('daily');
    //check to make sure this click_summary doesn't already exist
    $check_sql = "SELECT  COUNT(*)  FROM 202_cronjobs WHERE cronjob_type='" . $mysql['cronjob_type'] . "' AND cronjob_time='" . $mysql['cronjob_time'] . "'";
    $check_result = _mysql_query($check_sql);
    $check_count = mysql_result($check_result, 0, 0);
    if ($check_count == 0) {
        //if a cronjob hasn't run today, record it now.
        $insert_sql = "INSERT INTO 202_cronjobs SET cronjob_type='" . $mysql['cronjob_type'] . "', cronjob_time='" . $mysql['cronjob_time'] . "'";
        $insert_result = _mysql_query($insert_sql);
        /* -------- THIS CLEARS OUT THE CLICK SPY MEMORY TABLE --------- */
        //this function runs everyday at midnight to clear out the temp clicks_memory table
        $from = time() - 86400;