Advertisement
brandinarsenault

OUBIS - login.php

Feb 6th, 2013
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.14 KB | None | 0 0
  1. /* COPYRIGHT 2013 WWW.OUB.CA */
  2. <?php
  3. session_start();
  4. require("inc/mysql.php");
  5. require("inc/Membership.class.php");
  6. $Member = new Membership($DBH);
  7. require("inc/membership.php");
  8.  
  9. //test user permissions
  10. if(!$Member->test_perms(0))
  11. {
  12. //No perms, echo error or forward or something
  13. die("You do not have permissions to view this page!");
  14. }
  15. if(isset($_POST['submit'])) {
  16.         //User is loggin in
  17.         $data = array_map( 'trim', $_POST ); // assuming you don't have a multidimensional $_POST array, otherwise need recursive function
  18.         list( $data['username'], $data['password'] ) = explode( '-', $_POST['userpass']);
  19.         if($data['username'] == "" || $data['password'] == "") {
  20.                         header( 'Location: inc/invalidcredentials.php' ) ;
  21.         }
  22.    
  23.     if(!$Member->login($data['username'], ($data['password'])))
  24.     {
  25.         header( 'Location: inc/invalidcredentials.php' ) ;
  26.     }else{
  27.         die("<script type='text/javascript'>window.location='inc/login2.php'; </script>");
  28.     }
  29.  
  30. }
  31. header("./index2.htm");
  32. echo "<br />";
  33. if(!$_SESSION['user']['loggedIn'])
  34. {
  35. }?>
  36.  
  37. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  38. <html xmlns="http://www.w3.org/1999/xhtml">
  39. <head>
  40. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  41. <title>Login | OUBs Integrated Services</title>
  42. <link rel="stylesheet" type="text/css" href="css/default.css" />
  43. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
  44. <script type="text/javascript" src="js/main.js"></script>
  45. </head>
  46.  
  47. <body>
  48. <div id="login">
  49.     <form method="post" action="">
  50.         <h2>Login <small>enter your credentials</small></h2>
  51.        
  52.         <p>
  53.             <label for="pwd">Enter your username and password: <br /><br /></label>
  54.             <input type="password" name="userpass" />
  55.         </p>
  56.        
  57.         <p>
  58.             <input type="submit" id="submit" value="Login" name="submit" />
  59.         </p>
  60.     </form>
  61.     <?php if(isset($response)) echo "<h4 class='alert'>" . $response . "</h4>"; ?>
  62. </div><!--end login-->
  63. </body>
  64. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement