SHARE
TWEET

Untitled

a guest Jan 20th, 2017 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. include 'core/init.php';
  3. logged_in_redirect();
  4.  
  5. if (empty($_POST) === false) {
  6.     $username = $_POST['username'];
  7.     $password = $_POST['password'];
  8.    
  9.    
  10.     if (empty($username) === true || empty($password) === true) {
  11.         $errors[] = 'You need to enter a username and password!';
  12.     } else if (user_exists($username) === false) {
  13.         $errors[] = 'We can\'t find that username. Have you registered?';
  14.     } else if (user_active($username) === false) {
  15.         $errors[] = 'You haven\'t activated your account!';
  16.     } else {
  17.        
  18.         if (strlen($password) > 32) {
  19.             $errors[] = 'password too long';
  20.        
  21.         }
  22.        
  23.         $login = login($username, $password);
  24.         if ($login === false) {
  25.             $errors[] = 'That username/password combination is incorrect';
  26.         } else {
  27.             $_SESSION['user_id'] = $login;
  28.             header('Location: index.php');
  29.             exit();
  30.         }
  31.     }  
  32. } else {
  33.     $errors[] = 'No data received';
  34. }
  35. include 'includes/overall/overheader.php';
  36. if (empty($errors) === false) {
  37. ?>
  38.         <h2>We tried to log you in, but...</h2>
  39. <?php
  40. echo output_errors($errors);
  41. }
  42. include 'includes/overall/overfooter.php';
  43. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top