Advertisement
Guest User

GNS.DAIKI

a guest
Sep 27th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['Submit'])){
  3.  
  4. $db=mysqli_connect('localhost','root','','quiz_marcon');
  5. $username=$_POST['username'];
  6. $password=$_POST['password'];
  7. $sql= "SELECT * from users where username='$username' and password='$password'";
  8.  
  9. $result=mysqli_query($db, $sql);
  10. if (mysqli_num_rows($result)== 0){
  11. echo '<script language="javascript">';
  12. echo 'alert("Incorrect Username or Password")';
  13. echo '</script>';
  14.  
  15. }
  16. else{
  17. header("Location: display.php");
  18.  
  19. }
  20. }
  21.  
  22. ?>
  23.  
  24.  
  25. <html>
  26. <title>Login Page</title>
  27. <body>
  28. <form method = "post">
  29. <pre>
  30.  
  31. Input Username: <input type ="text" name = "username"><br>
  32. Input Password: <input type ="password" name = "password"><br><input type="Submit" name="Submit" value="Submit">
  33.  
  34. </pre>
  35. </form>
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement