Advertisement
Guest User

Untitled

a guest
May 22nd, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. <!DOCTYPE>
  2. <html>
  3. <head>
  4. <link href="CSS/web.css" type="text/css" rel="stylesheet" >
  5. </head>
  6. <body>
  7. <div id="content">
  8. <div id="header">
  9. <img src="Pictures/senseiPizza.jpg" alt="Logo" width="100" height="90">
  10. <h1>Sensei Pizza</h1>
  11. <div class="address">
  12. <h2>Restaurant Location:</h2>
  13. <span>28 Sewer Street, (Shredder Town) New York</span>
  14. </div>
  15. </div>
  16. <div class="motto">
  17. <h3>Sensei Pizza will fufill its mission ... to feed you.</h3>
  18. </div>
  19. <div class="subContent">
  20. <nav>
  21. <ul>
  22. <li><a href="home.php">Home</a></li>
  23. <li><a href="register.php">Register</a></li>
  24. </ul>
  25. </nav>
  26. <div id="main">
  27. <form method="post" action="<?php $_PHP_SELF ?>">
  28. Username:<input type="text" name="user"><br>
  29. Password:<input type="password" name="pass"><br>
  30. <input type="submit" name="login" id="login" value="Login">
  31. </form>
  32. <?php
  33. if(isset($_POST['login']))
  34. {
  35. $servername = "localhost";
  36. $username = "root";
  37. $password = "";
  38. $dbname = "senseipizza";
  39.  
  40. // Create connection
  41. $conn = mysqli_connect($servername, $username, $password, $dbname);
  42. // Check connection
  43. if (!$conn) {
  44. die("Connection failed: " . $conn->connect_error);
  45. }
  46. $user = $_POST['user'];
  47. $pass = $_POST['pass'];
  48.  
  49. $sql1 = "SELECT customerUsername, customerPassword FROM customer
  50. WHERE customerUsername = '$user' AND customerPassword = '$pass' ";
  51. $sql2 = "SELECT staffUsername, staffPassword FROM staff
  52. WHERE staffUsername = '$user' AND staffPassword = '$pass' ";
  53. if ($conn->query($sql1) === TRUE) {
  54. header("Location: custHome.php");
  55. } else if ($conn->query($sql2) === TRUE) {
  56. header("Location: staffHome.php");
  57. }
  58. else {
  59. echo "<p>Error: " . $sql1 . "<br>" . $conn->error . "</p>";
  60. echo "<br/><p>Error: " . $sql2 . "<br>" . $conn->error . "</p>";
  61. }
  62.  
  63. mysqli_close($conn);
  64. }
  65. ?>
  66. </div>
  67. </div>
  68. <footer>
  69. <p> Sensei Pizza is a pizza registered restaurant and copywrited by the unifications act of the United States &#169; 2016 </p>
  70. </footer>
  71. </div>
  72. </body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement