Esempio n. 1
0
function bumplog()
{
    global $database;
    $log_entries = $database->database_num_rows($database->database_query("SELECT login_id FROM se_logins"));
    if ($log_entries > 1000) {
        $oldest_log = $database->database_fetch_assoc($database->database_query("SELECT login_id FROM se_logins ORDER BY login_id ASC LIMIT 0,1"));
        $database->database_query("DELETE FROM se_logins WHERE login_id='{$oldest_log['login_id']}'");
        bumplog();
    }
}
Esempio n. 2
0
 function user_login($email, $password, $javascript_disabled = 0, $persistent = 0)
 {
     global $database, $setting;
     $this->SEUser(array(0, "", $email));
     $current_time = time();
     $login_result = 0;
     // SHOW ERROR IF JAVASCRIPT IS DIABLED
     if ($javascript_disabled) {
         $this->is_error = 31;
     } elseif ($this->user_exists == 0) {
         $this->is_error = 676;
     } elseif (!trim($password) || $this->user_password_crypt($password) != $this->user_info['user_password']) {
         $this->is_error = 676;
     } elseif (!$this->user_info['user_enabled']) {
         $this->is_error = 677;
     } elseif (!$this->user_info['user_verified'] && $setting['setting_signup_verify']) {
         $this->is_error = 678;
     } else {
         // SET LOGIN RESULT VAR
         $login_result = TRUE;
         // UPDATE USER LOGIN INFO
         $database->database_query("UPDATE se_users SET user_lastlogindate='{$current_time}', user_logins=user_logins+1, user_lastactive='{$current_time}', user_ip_lastactive='{$_SERVER['REMOTE_ADDR']}' WHERE user_id='{$this->user_info['user_id']}' LIMIT 1");
         // LOG USER IN
         $this->user_setcookies($persistent);
         // FIX VISITOR TABLE
         $visitor_ip = ip2long($_SERVER['REMOTE_ADDR']);
         $visitor_browser = addslashes(trim(substr($_SERVER['HTTP_USER_AGENT'], 0, 255)));
         $database->database_query("DELETE FROM se_visitors WHERE visitor_ip='{$visitor_ip}' && visitor_browser LIKE '{$visitor_browser}' && visitor_user_id='0'");
         // UPDATE LOGIN STATS
         update_stats("logins");
     }
     // BUMP LOG
     $database->database_query("INSERT INTO se_logins (login_email, login_date, login_ip, login_result) VALUES ('{$email}', '{$current_time}', '{$_SERVER['REMOTE_ADDR']}', '{$login_result}')");
     bumplog();
 }