{ $Hour = time(date('H') + 1, 0, 0, date('m'), date('d'), date('Y')); return date('H', $Hour); } if ((!isset($argv[1]) || $argv[1] != SCHEDULE_KEY) && !check_perms('admin_schedule')) { // authorization, Fix to allow people with perms hit this page. error(403); } if (check_perms('admin_schedule')) { authorize(); View::show_header(); echo '<pre>'; } $DB->query("\n\tSELECT NextHour, NextDay, NextBiWeekly\n\tFROM schedule"); list($Hour, $Day, $BiWeek) = $DB->next_record(); $NextHour = next_hour(); $NextDay = next_day(); $NextBiWeek = next_biweek(); $DB->query("\n\tUPDATE schedule\n\tSET\n\t\tNextHour = {$NextHour},\n\t\tNextDay = {$NextDay},\n\t\tNextBiWeekly = {$NextBiWeek}"); $NoDaily = isset($argv[2]) && $argv[2] == 'nodaily'; $sqltime = sqltime(); echo "{$sqltime}\n"; /*************************************************************************\ //--------------Run every time ------------------------------------------// These functions are run every time the script is executed (every 15 minutes). \*************************************************************************/ echo "Ran every-time functions\n"; //------------- Freeleech -----------------------------------------------//
$AgoMins = time_minus(60*30); $DB->query("SELECT UserID, SessionID FROM users_sessions WHERE LastUpdate<'$AgoMins' AND KeepLogged='0'"); while(list($UserID,$SessionID) = $DB->next_record()) { $Cache->begin_transaction('users_sessions_'.$UserID); $Cache->delete_row($SessionID); $Cache->commit_transaction(0); } $DB->query("DELETE FROM users_sessions WHERE LastUpdate<'$AgoMins' AND KeepLogged='0'"); //------------- Lower Login Attempts ------------------------------------// $DB->query("UPDATE login_attempts SET Attempts=Attempts-1 WHERE Attempts>0"); $DB->query("DELETE FROM login_attempts WHERE LastAttempt<'".time_minus(3600*24*90)."'"); $Hour = next_hour(); } /*************************************************************************\ //--------------Run every day -------------------------------------------// These functions are run in the first 15 minutes of every day. \*************************************************************************/ if($Day != next_day() || $_GET['runday']){ echo "Ran daily functions\n"; if($Day%2 == 0) { // If we should generate the drive database (at the end) $GenerateDriveDB = true; } //------------- Ratio requirements