Advertisement
Guest User

Untitled

a guest
Dec 25th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. <?php
  2. SESSION_start();
  3. if (isset($_POST['login'])) {
  4. include_once 'dbh.inc.php';
  5. $username = mysqli_real_escape_string($conn, $_POST['username']);
  6. $password = mysqli_real_escape_string($conn, $_POST['password']);
  7.  
  8. //error handler
  9. if (empty($username) || empty($password)) {
  10.   header("location: ../index.php?Login=empty");
  11.   exit();
  12. }
  13.  else {
  14.  
  15.  
  16.    $sql = "SELECT * FROM users WHERE user_uid='$username'";
  17.    $result = mysqli_query($conn, $sql);
  18.    $resultCheck = mysqli_num_rows($result);
  19.   if ($resultCheck < 1) {
  20.   header("location: ../index.php?Login=Fallss");
  21.  exit();
  22.   }
  23.  
  24.    else {
  25.   if ($row = mysqli_fetch_assoc($result)) {
  26.     $dehashpwdcheck = password_verify($password, $row['user_pwd']);}
  27.     if ($dehashpwdcheck == false) {
  28.       header("Location: ../index.php?signup=Falls");
  29.       exit();}
  30.       elseif ($dehashpwdcheck == true) {
  31.         $_SESSION['u_id'] = $row['user_id'];
  32.         $_SESSION['u_first'] = $row['user_first'];
  33.         $_SESSION['u_last'] = $row['user_last'];
  34.         $_SESSION['u_email'] = $row['user_email'];
  35.         $_SESSION['u_uid'] = $row['user_uid'];
  36.         header("Location: ../AdminLTE-2.4.2/index.php?signup=yo");
  37.         exit();
  38.       }
  39.  
  40.  
  41.      }
  42.    }
  43.    }
  44.  
  45.  
  46. else {
  47.  header("Location: ../index.php");
  48.  exit();
  49. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement