Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. session_start();
  2. $usr = new Users;
  3. $usr->storeFormValues( $_POST );
  4. if( $usr->userLogin() ) {
  5. header( 'Location: /user/' ) ;
  6. $_SESSION["loggedIn"] = true;
  7. $_SESSION['username'] = $_POST['username'];
  8. $_SESSION['password'] = $_POST['password'];
  9.  
  10. } else {
  11. echo '<center>'."<font color='red'>Sorry, Incorrect Username or Password <br> Please Try Again </br> </font>".'</center>';
  12. }
  13. }
  14.  
  15. <?php
  16. //set off all error for security purposes
  17. error_reporting(E_ALL);
  18.  
  19.  
  20. //define some contstant
  21. define( "DB_DSN", "mysql:host=localhost;dbname=dbname1" );
  22. define( "DB_USERNAME", "" );
  23. define( "DB_PASSWORD", "" );
  24. define( "CLS_PATH", "class" );
  25.  
  26. //include the classes
  27. include_once( CLS_PATH . "/user.php" );
  28.  
  29.  
  30. ?>
  31.  
  32. <?php
  33.  
  34. session_start();
  35.  
  36. // redirects to user to the login.php page if user is not logged in
  37.  
  38. if (!isset($_SESSION['loggedIn'])){
  39. header("location: /login.php");
  40. }
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement