Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($_GET['mode'] == "login") {
- if (isset($_POST['submitted'])) {
- $username = clean($_POST['username']);
- $password = clean($_POST['password']);
- $user = new user();
- $user->set('username_clean', strtolower($username));
- $user->set('user_password',$password);
- if ($user->login()) {
- $logger = new admin_logger();
- $logger->info("User $user->username logged in with an IP $user->user_ip");
- //If un pw where correct, load the rest of the user object from db
- //Set the session object, and unset the temp $user object
- $_SESSION['user'] = $user;
- unset($user);
- //Display the success page
- $smarty->assign('message', 'Logged in successfully. <a href="index.php">Home</a>');
- $smarty->display('short_message.tpl');
- } else {
- //If login failed, redisplay form with error.
- die('Username or password was wrong!');
- }
- } else {
- $smarty->assign('title', 'MBAdmin - Login');
- $smarty->display('account_login_form.tpl');
- }
- }
Add Comment
Please, Sign In to add comment