Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. session_start();
  4. include("database.php");
  5. include("head.php");
  6.  
  7.  
  8. if(isset($_POST['login'])) {
  9. $username = trim($_POST['username']);
  10. $password = trim($_POST['password']);
  11. $qry = mysql_query("SELECT * FROM user WHERE username = '$username' AND password = '$password'") or die (mysql_error());
  12. $numrow = mysql_num_rows($qry);
  13. echo $numrow;
  14. if($numrow > 0) {
  15. $_SESSION['username'] = $username;
  16. $_SESSION['password'] = $password;
  17. header('location:admin.php');
  18. } else {
  19. echo "can not loggedin to admin-panel";
  20. header('location:login.php');
  21. }
  22. }
  23. ?>
  24. <html>
  25. <head>
  26. <title>Login Form</title>
  27. </head>
  28. <body>
  29. <form method = "POST" action = "<?php echo $_SERVER['PHP_SELF']; ?>">
  30. Username:<br />
  31. <input type = "text" name = "username" value = ""><br />
  32. Password:<br />
  33. <input type = "password" name = "password" value = ""><br />
  34. <input type = "submit" name = "login" value = "Login">
  35. </form>
  36.  
  37. </body>
  38. </html>
  39. <?php
  40. include("foot.php");
  41.  
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement