Guest User

Untitled

a guest
Apr 24th, 2019
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <html>
  2. <body>
  3. <form action="sam.php" method="post">
  4. username:<input type="text" name="username"><br>
  5. password:<input type="password" name="password"><br>
  6. <input type="submit">
  7. </form>
  8. <?php
  9. $host='localhost:3306';
  10. $dbname='sam';
  11. $con=mysql_connect($host,'root','root') or die(mysql_error());
  12. $db=mysql_select_db($dbname,$con) or die(mysql_error());
  13. $id=$_POST['username'];
  14. $pass=$_POST['password'];  
  15. echo $id;
  16. if(!empty($_POST['username']))
  17. {
  18.     $query=mysql_query("select * from loginpage") or die(mysql_error());
  19.     $row=mysql_fetch_array($query) or die(mysql_error());
  20.     if($row['name']==$id and $row['password']==$pass)
  21.     {
  22.         echo " login succesfull";
  23.     }
  24.     else
  25.     {
  26.         echo " failed";
  27.     }
  28. }
  29. ?>
  30. </body>
  31.  
  32.  
  33. </html>
Add Comment
Please, Sign In to add comment