daily pastebin goal
65%
SHARE
TWEET

hai

a guest May 31st, 2017 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. require_once("../../includes/functions.php");
  3. require_once("../../includes/database.php");
  4. require_once("../../includes/user.php");
  5. require_once("../../includes/session.php");
  6.  
  7. if($session->is_logged_in())
  8. {
  9.     redirect_to("index.php");
  10. }
  11. if(isset($_POST['submit']))
  12. {
  13.     $username = trim($_POST['username']);
  14.     $password = trim($_POST['password']);
  15.    
  16.     $found_user = User::authenticate($username, $password);
  17.     if($found_user)
  18.     {
  19.         $session->login($found_user);
  20.         redirect_to("index.php");
  21.     }
  22.     else
  23.     {
  24.     $message = "Username/password combination incorrect.";
  25.     }
  26. }
  27. else
  28. {
  29.     $username = "";
  30.     $password = "";
  31. }
  32. ?>
  33. <html>
  34. <head>
  35.     <title>Photo Gallery</title>
  36.     <link href="../stylesheets/main.css" media="all"
  37.     rel="stylesheet" type="text/css"/>
  38. </head>
  39. <body>
  40. <div id="header">
  41.     <h1>Photo Gallery</h1>
  42. </div>
  43. <div id="main">
  44.     <h2>Staff Login</h2>
  45.     <?php echo output_message($message);?>
  46.    
  47.     <form action="login.php" method="post">
  48.     <table>
  49.         <tr>
  50.             <td>Username:</td>
  51.             <td>
  52.                 <input type="text" name="username" maxlength="30"
  53.                 value="<?php echo htmlentities($username);?>"/>
  54.             </td>
  55.         </tr>
  56.         <tr>
  57.             <td>Password:</td>
  58.             <td>
  59.                 <input type="password" name="password" maxlength="30"
  60.                 value="<?php echo htmlentities($password);?>"/>
  61.             </td>
  62.         </tr>
  63.         <tr>
  64.             <td colspan="2">
  65.                 <input type="submit" name="submit" value="Login"/>
  66.             </td>
  67.         </tr>
  68.     </table>
  69.     </form>
  70. </div>
  71. <div id="footer">Copyright <?php echo date("Y", time()); ?>,
  72. Bart de Kinkelaar</div>
  73. </body>
  74. </html>
  75. <?php
  76. if(isset($database))
  77. {
  78.     $database->close_connection();
  79. }
  80. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top