Guest User

login page using php

a guest
Oct 10th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="ISO-8859-1">
  5. <title>insert title here</title>
  6. </head>
  7. <body>
  8. <h1>login page</h1>
  9. <form action ="LOGO.php" method="post">
  10. user name:<input type="text" name="uname">
  11. password:<input type=text" name="pass">
  12. <input type="submit" value="login">
  13. </form>
  14. </body>
  15. </html>
  16.  
  17. php file
  18.  
  19. <?php
  20. $username="root";
  21. $password="";
  22. $database="login";
  23.  
  24. $first=$_POST["uname"];
  25. $pa=$_POST["pass"];
  26. $con=mysql_connect("localhost",$username,$password);
  27. mysql_select_db("login",$con);
  28.  
  29. $query="select * from log";
  30. $result=mysql_query($query);
  31.  
  32. $f=1;
  33. while($row=mysql_fetch_array($result))
  34. {
  35. if($row['uname']==$first && $row['pass']==$pa)
  36. {
  37. $f=2;
  38. }
  39. }
  40. if($f==1)
  41. {
  42. echo "login not correct";
  43. }
  44. else
  45. {
  46. echo "correct";
  47. header("location:success.html");
  48. }
  49. mysql_close();
  50. ?>
  51.  
  52. success page
  53.  
  54. <!DOCTYPE html>
  55. <html>
  56. <head>
  57. <meta charset="ISO-8859-1">
  58. </html>
  59. <body>
  60. <h1>success
  61. <br>
  62. login correct</h1>
  63. </body>
  64. </html>
Add Comment
Please, Sign In to add comment