Guest User

Untitled

a guest
Apr 12th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.22 KB | None | 0 0
  1.     if ($_GET['mode'] == "login") {
  2.         if (isset($_POST['submitted'])) {
  3.             $username = clean($_POST['username']);
  4.             $password = clean($_POST['password']);
  5.             $user = new user();
  6.             $user->set('username_clean',  strtolower($username));
  7.             $user->set('user_password',$password);
  8.             if ($user->login()) {
  9.                 $logger = new admin_logger();
  10.                 $logger->info("User $user->username logged in with an IP $user->user_ip");
  11.                 //If un pw where correct, load the rest of the user object from db
  12.                 //Set the session object, and unset the temp $user object
  13.                 $_SESSION['user'] = $user;
  14.                 unset($user);
  15.                 //Display the success page
  16.                 $smarty->assign('message', 'Logged in successfully. <a href="index.php">Home</a>');
  17.                 $smarty->display('short_message.tpl');
  18.             } else {
  19.                 //If login failed, redisplay form with error.
  20.                 die('Username or password was wrong!');
  21.             }
  22.         } else {
  23.             $smarty->assign('title', 'MBAdmin - Login');
  24.             $smarty->display('account_login_form.tpl');
  25.         }
  26.     }
Add Comment
Please, Sign In to add comment