Advertisement
Guest User

login.php

a guest
May 26th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. if ($_POST["username"] == "admin" && $_POST["password"] == sha1("password")) {
  6. $_SESSION["authorized"] = true;
  7. session_regenrate_id();
  8.  
  9. }
  10.  
  11. include_once('inc/connection.inc.php');
  12.  
  13.  
  14.  
  15. if (isset($_POST['submit']))
  16.  
  17. {
  18. $username = $_POST['username'];
  19. $password = $_POST['password'];
  20.  
  21. $query = "select userName, password from tbl_customers where userName = '$username' ";
  22. $result =$db -> query ($query);
  23. $row = $result->fetch_array(MYSQLI_ASSOC);
  24.  
  25. if (password_verify($password,$row['password']))
  26. {
  27. $_SESSION['logged']= 1;
  28. $_SESSION['username'] = $row['username'];
  29. header('location:index.php');
  30.  
  31. }
  32. else
  33. {
  34. echo "The username or password entered is incorrect. Please try again.";
  35.  
  36. }
  37. }
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement