Advertisement
Guest User

Untitled

a guest
Nov 26th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <html>
  2. <body><center>
  3.  
  4. <form action="" method="POST">
  5.  
  6. Username:-<input type="text" name="uname" required=""><br><br>
  7.  
  8. Password:-<input type="text" name="upassword" required=""><br><br>
  9.  
  10. <input type="submit" name="sub" value="Login">
  11.  
  12. <form>
  13. </body></center>
  14. </html>
  15. <?php
  16. $cser=mysqli_connect("localhost","root","","tutorials"); //database connectivity
  17.  
  18. if(isset($_POST['sub']))
  19. {
  20. $uname = $_POST['uname'];
  21. $upassword = $_POST['upassword'];
  22.  
  23. $res = mysqli_query($cser,"select* from user where uname='$uname'and upassword='$upassword'");
  24. $result=mysqli_fetch_array($res);
  25. if($result)
  26. {
  27.     echo "You have logged in successfully ";
  28.    
  29. }
  30. else
  31. {
  32.     echo "failed ";
  33. }
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement