Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4. <?php require_once("includes/connection.php"); ?>
  5. <?php require_once("includes/functions.php"); ?>
  6.  
  7.  
  8. <?php
  9. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  10. $uname = $_POST['username']; //retrieve input from previous pagelogin.php store in $uname
  11. $pword2 = $_POST['password']; //retrieve input from previous pagelogin.php store in $pword
  12. $pword = hash('ripemd160', $pword2);
  13. }
  14.  
  15. $SQL = "SELECT * FROM login WHERE username='".$uname."'"." AND password='".$pword."'"; //construct sql query see (b)
  16. $result = mysqli_query($connection, $SQL );
  17. $num_rows = mysqli_num_rows($result);
  18.  
  19. if ($num_rows > 0) {
  20. $_SESSION['login'] = $uname;
  21.  
  22. if($uname == "Admin"){
  23. $location = "admin.php";
  24. header("Location: {$location}");
  25. }
  26. else{
  27. $location = "index.php";
  28. header("Location: {$location}");
  29. }
  30.  
  31. }
  32.  
  33. mysqli_close($connection);
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement