Advertisement
Guest User

Untitled

a guest
May 14th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $user = $_POST['txtuser'];
  4. $PWD = $_POST ['txtpassword'];
  5. $con = mysqli_connect("localhost","root","");
  6. if (!$con)
  7. {
  8. die('Could not connect: ' . mysql_error());
  9. }
  10. mysqli_select_db($con,"account");
  11. $result = mysqli_query($con,"SELECT * from access WHERE username='$user' and password='$PWD'");
  12. $found = mysqli_num_rows($result);
  13. if ($found) {
  14.  
  15. $_SESSION["accessed"] = 1;
  16. echo "<center><h1>access granted.</h1></center>";
  17. echo "<script> location.href='home.php';</script>";
  18. } else {
  19. $_SESSION["accessed"] = 0;
  20. echo "<center><h1>Unknown User.<a href='login.html'>Try Again?</a></h1></center>";
  21. die ("<center><h2>access denied</h2></center> ");
  22. }
  23.  
  24. mysqli_close($con);
  25.  
  26.  
  27. ?>
  28.  
  29.  
  30.  
  31.  
  32. <br />
  33. <a href="SECUREAREA.php">
  34. <center>
  35. <h1>Proceed To secure area</h1>
  36. </center>
  37. </a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement