Advertisement
nadiraf

loginkamal

Dec 6th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.70 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7. <body>
  8.  
  9. <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  10. <tr>
  11. <form name="" method="post">
  12. <td>
  13. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
  14. <tr>
  15. <td colspan="3" align="center"><strong>User Login </strong></td>
  16. </tr>
  17. <tr>
  18. <td width="78">Username</td>
  19. <td width="6">:</td>
  20. <td width="294"><input name="username" type="text" id="username"></td>
  21. </tr>
  22. <tr>
  23. <td>Password</td>
  24. <td>:</td>
  25. <td><input name="password" type="password" id="password"></td>
  26. </tr>
  27. <tr>
  28. <td>&nbsp;</td>
  29. <td>&nbsp;</td>
  30. <td><input type="submit" name="submit" value="Login">
  31. <input type="reset" name="reset" value="reset"></td>
  32. </form>
  33. </tr>
  34. </table>
  35. </td>
  36.  
  37. </tr>
  38. </table>
  39. <?php
  40. if (isset($_POST['submit']))
  41.     {    
  42. include("config.php");
  43.  
  44. session_start();
  45.  
  46. $username=$_POST['username'];
  47. $password=$_POST['password'];
  48.  
  49. $_SESSION['login_user']=$username;
  50.  
  51. $query = mysqli_query($db,$SELECT username FROM login WHERE username='$username' and password='$password'") or die(mysqli_error($db));
  52.  
  53. if (mysqli_num_rows($query) != 1)
  54. {
  55.  
  56.  echo "<script language='javascript' type='text/javascript'> location.href='home.php' </script>";  
  57.  }
  58.  else
  59.  {
  60. echo "<script type='text/javascript'>alert('User Name Or Password Invalid!')</script>";
  61. }
  62.    
  63. ?>
  64.                        
  65.             </article>                             
  66.     </main>
  67.       </div>
  68.     </div>
  69.    
  70.   </div>
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement