includes/sessions.php
changeset 480 d5376271f96b
parent 472 bc4b58034f4d
child 484 340c81fdd350
equal deleted inserted replaced
479:192db6ac195b 480:d5376271f96b
  3566   setConfig('login_key_cache', '');
  3566   setConfig('login_key_cache', '');
  3567 }
  3567 }
  3568 
  3568 
  3569 register_cron_task('cron_clean_login_cache', 72);
  3569 register_cron_task('cron_clean_login_cache', 72);
  3570 
  3570 
       
  3571 /**
       
  3572  * Cron task - clears out outdated high-auth session keys
       
  3573  */
       
  3574 
       
  3575 function cron_clean_old_admin_keys()
       
  3576 {
       
  3577   global $db, $session, $paths, $template, $plugins; // Common objects
       
  3578   
       
  3579   $threshold = time() - ( 15 * 60 );
       
  3580   $ul_member = USER_LEVEL_MEMBER;
       
  3581   if ( !$db->sql_query('DELETE FROM ' . table_prefix . "session_keys WHERE time < $threshold AND auth_level > $ul_member;") )
       
  3582     $db->_die();
       
  3583 }
       
  3584 
       
  3585 // Once a week
       
  3586 register_cron_task('cron_clean_old_admin_keys', 168);
       
  3587 
  3571 ?>
  3588 ?>