Guest User

LogIn.php

a guest
Aug 31st, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <?php
  2. include "config.php";
  3.  
  4. $Username = $_POST['username'];
  5. $result1 = mysqli_query($conn, "SELECT * FROM information WHERE username = '".$Username."'");
  6.  
  7. if(mysqli_num_rows($result1) == 0)
  8. {
  9. ?>
  10. <script type="text/javascript">
  11. alert("The Account name doesn't exist!");
  12. </script>
  13. <?php
  14. header("Location: http://localhost:8012/FinalProject/LoginPage.html");
  15. }
  16. else
  17. {
  18. $Password = $_POST['password'];
  19. $result2 = mysqli_query($conn, "SELECT * FROM information WHERE password = '".$Password."'");
  20.  
  21. if(mysqli_num_rows($result2) == 0)
  22. {
  23. ?>
  24. <script type="text/javascript">
  25. alert("The password is not correct!");
  26. </script>
  27. <?php
  28. header("Location: http://localhost:8012/FinalProject/LoginPage.html");
  29. }
  30. else
  31. {
  32. $command = "TRUNCATE TABLE usernameholder";
  33. $result = $conn->query($command);
  34. $sql = "INSERT into usernameholder (username) VALUES ('" . $Username . "')";
  35. $result = $conn->query($sql);
  36. echo "You have successfully logged in!";
  37. header("Location: http://localhost:8012/FinalProject/AlbumPage.php");
  38. }
  39. }
  40.  
  41. $conn->close();
  42. ?>
Add Comment
Please, Sign In to add comment