Advertisement
Guest User

Untitled

a guest
Jan 19th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. <?php
  2. error_reporting(-1);
  3. session_start();
  4. require("includes/connection.php");
  5.  
  6. if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['username']))
  7.  
  8. $username = $_POST['username'];
  9. $password = $_POST['password'];
  10.  
  11.  
  12. $query = "SELECT * FROM customer WHERE username='$username' and password='$password'";
  13.  
  14. $result = mysqli_query($con,$query) or die(mysqli_error() );
  15. $count = mysqli_num_rows($result);
  16.  
  17. if($count == 1){
  18.  
  19. $_SESSION['login_session'] = "OK";
  20. $_SESSION['username'] = $username;
  21. $_SESSION['password'] = $password;
  22.  
  23. header('Location: MainPage007.php');
  24. }
  25. else {
  26. echo "Invalid Username or Password. Please try again.";
  27. }
  28.  
  29.  
  30.  
  31.  
  32. ?>
  33. <!DOCTYPE html>
  34. <html lang="en">
  35. <head>
  36. <!-- Defining the character set standard 'UTF-8' -->
  37. <meta charset="utf-8" />
  38. <!-- Defining a title for our web-application -->
  39. <title>007 Memorabilia - Login</title>
  40. <link rel="stylesheet" type="text/css" href="styleLogin.css" />
  41.  
  42. </head>
  43. <body>
  44.  
  45. <div id="wrapper">
  46. <header>
  47. <!-- Replace image with a 007 Memorabilia Logo -->
  48. <img src="007logo.png" alt="007Logo" style=" width:150px;height:auto; ">
  49. </header>
  50.  
  51. <div id="loginform">
  52. <div id="content">
  53. <p>Please enter your username and password:</p>
  54. <form action="Login.php" method="post" name="loginform">
  55. <table>
  56. <tr>
  57. <td align="right">Username: </td>
  58. <td><input type="text" size="20" maxlength="15" name="username"></td>
  59. </tr>
  60. <tr>
  61. <td align="right">Password: </td>
  62. <td><input type="Password" size="20" maxlength="15" name="password"></td>
  63. </tr>
  64. <tr>
  65. <td></td>
  66. <td colspan="2" align="left"><input type="submit" value="Login"></td>
  67. </tr>
  68. </table>
  69. </form>
  70. </div>
  71. </div>
  72.  
  73. </div>
  74.  
  75. <footer>
  76. <p>By Ashley Coupland</p>
  77. </footer>
  78.  
  79.  
  80. </body>
  81. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement