Guest User

Untitled

a guest
Nov 24th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. $con = mysqli_connect("localhost","root","(my database password)","Test");
  4. if(isset($_POST['login'])){
  5.  
  6. $username=mysqli_real_escape_string($con,$_POST['username']);
  7.  
  8. $password=mysqli_real_escape_string($con,$_POST['password']);
  9.  
  10. $select_user="SELECT * FROM Test WHERE 'Username' = '$username' AND 'Password' = '$password'";
  11.  
  12. $run_user=mysqli_query($con,$select_user);
  13.  
  14. $check_user=mysqli_num_rows($run_user);
  15.  
  16. if($check_user>0){
  17. header('location:Home.php');
  18. }
  19. else{
  20. echo "Please enter your login information.";
  21. }
  22. }
  23.  
  24. ?>
  25.  
  26. <html>
  27. <head>
  28. </head>
  29. <body>
  30. <form action="" method="POST">
  31. <input type="text" name = "username" placeholder="Username"/>
  32. <input type="text" name = "password" placeholder="Password"/>
  33. <input type = "submit" value = "Login" name="login"/>
  34. </form>
  35.  
  36. </body>
  37. </html>
Add Comment
Please, Sign In to add comment