You are here

function user_login_submit in Drupal 5

Same name and namespace in other branches
  1. 4 modules/user.module \user_login_submit()
  2. 6 modules/user/user.module \user_login_submit()
  3. 7 modules/user/user.module \user_login_submit()

File

modules/user/user.module, line 951
Enables the user registration and login system.

Code

function user_login_submit($form_id, $form_values) {
  global $user;
  if ($user->uid) {

    // To handle the edge case where this function is called during a
    // bootstrap, check for the existence of t().
    if (function_exists('t')) {
      $message = t('Session opened for %name.', array(
        '%name' => $user->name,
      ));
    }
    else {
      $message = "Session opened for " . check_plain($user->name);
    }
    watchdog('user', $message);

    // Update the user table timestamp noting user has logged in.
    db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $user->uid);

    // Regenerate the session ID to prevent against session fixation attacks.
    sess_regenerate();
    user_module_invoke('login', $form_values, $user);
    return 'user/' . $user->uid;
  }
}