Example #1
0
function do_lapsed()
{
    global $globals;
    $max_last_rpc_time = time() - $globals->lapsed_interval;
    // the following is an efficient way of getting the list of
    // users for which no host has done an RPC recently
    //
    $result = mysql_query("select userid from host group by userid having max(rpc_time)<{$max_last_rpc_time};");
    while ($host = mysql_fetch_object($result)) {
        $uresult = mysql_query("select * from user where id = {$host->userid};");
        $user = mysql_fetch_object($uresult);
        mysql_free_result($uresult);
        if (!$user) {
            echo "Can't find user {$host->userid}\n";
            continue;
        }
        handle_user($user, 'lapsed');
    }
    mysql_free_result($result);
}
Example #2
0
function do_one($thisid, $log)
{
    $result = mysql_query("select * from user where id={$thisid}");
    $user = mysql_fetch_object($result);
    if ($user) {
        handle_user($user);
        fputs($log, $user->id . "\n");
        fflush($log);
    }
    mysql_free_result($result);
    return $startid;
}