Guest User

Untitled

a guest
Jun 19th, 2017
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7.     <title>Login page!</title>
  8. </head>
  9. <body>
  10. <center>
  11. <?php
  12. $conn=mysqli_connect("localhost","root","","login");
  13. $user=@$_POST['txtname'];
  14. $pass=@$_POST['txtpass'];
  15. $query=mysqli_query($conn,"SELECT * FROM credentials WHERE username='".$user."'");
  16. $record=mysqli_fetch_array($query);
  17. if($user==$record['username'])
  18. {
  19. if($pass==$record['password'])
  20. {
  21. $_SESSION['txtname']=$_POST['txtname'];
  22. ?>
  23. <?php
  24. header('location:success.php');
  25. }
  26. else
  27. {
  28.  
  29. ?>
  30. <?php
  31. header('location:wrongpassword.php');
  32. }
  33. }
  34. else
  35. {
  36. ?>
  37. <?php
  38. header('signup.php');
  39. }
  40. mysqli_close($conn);
  41. ?>
  42. <table border cellpadding="4" cellpadding="">
  43. <tr><th>
  44. <form method="post">
  45. <input type="text" name="txtname" placeholder="Username" required><br></th></tr>
  46. <tr><th>
  47. <input type="password" name="txtpass" placeholder="Password"><br><br></th></tr>
  48. <tr><th>
  49. <button type="submit" name="submit">Login &raquo;</button>&nbsp;&nbsp;
  50. <button type="reset">Reset</button></th></tr>
  51. </form>
  52. </table>
  53. </center>
  54. </body>
  55. </html>
Add Comment
Please, Sign In to add comment