You are here

function user_login_submit in Drupal 4

Same name and namespace in other branches
  1. 5 modules/user/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.module, line 947
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' => theme('placeholder', $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);
    user_module_invoke('login', $form_values, $user);
    sess_regenerate();
    return 'user/' . $user->uid;
  }
}