Advertisement
Guest User

Untitled

a guest
May 1st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. <?php session_start(); ?>
  2. <html>
  3. <head>
  4.  
  5. <title>Administrator Panel</title>
  6.  
  7. <link rel = "stylesheet" href= "restaurant/main.css" type= "text/css" media="all"></link>
  8.  
  9. </head>
  10.  
  11. <body>
  12.  
  13. <div id="login">
  14.  
  15. <title>Administrator Panel</title>
  16. <head><b>Welcome to the administrator panel for the Shahnaz Restaurant Order System.</b></head>
  17.  
  18. <form method="post" action="admin.php">
  19. <p><b>Please log in as an administrator by filling in the form below.</b></p>
  20. <p>Username:</p>
  21. <p><input type="text" name="username"/></</p>
  22. <p>Password:</p>
  23. <p><input type="password" name="password"/></p>
  24. <p><input type="Submit" value="Log in"/></p>
  25.  
  26. </form>
  27.  
  28. <form method="post" action="home.php">
  29. <p><input type="Submit" value="Return to home page"/></p>
  30.  
  31. </div>
  32. <?php
  33.  
  34.  
  35. mysql_connect("localhost","username","password");
  36.  
  37. include("dbconnection.php");
  38.  
  39.  
  40. if (isset($_GET["logoutprofile"])) {
  41. $_SESSION["login"] = false;
  42. header("location: logout.php");
  43. }
  44.  
  45. if (isset($_SESSION['login']) == true){
  46. header("location: admin.php");
  47. }
  48. if(count($_POST) > 0){
  49.  
  50. include("dbconnection.php");
  51. $username =($_POST['username']);
  52. $password =($_POST['password']);
  53. $qry = mysql_query("SELECT username, password FROM adminlogin WHERE (username = '$username')") or die
  54.  
  55. (mysql_error());
  56.  
  57.  
  58. if (mysql_num_rows($qry) > 0){
  59.  
  60. $row = mysql_fetch_array($qry, MYSQL_ASSOC) or die(mysql_error());
  61.  
  62. if ($adminlogin['password'] == ($_POST['password']) &&
  63. $row['username'] == ($_POST['username'])){
  64. $_SESSION['login'] = $row['id'];
  65. } else {
  66. echo "Wrong Username or Password";
  67. }
  68. }
  69. }
  70.  
  71. ?>
  72. </body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement