Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- session_start();
- $usr = new Users;
- $usr->storeFormValues( $_POST );
- if( $usr->userLogin() ) {
- header( 'Location: /user/' ) ;
- $_SESSION["loggedIn"] = true;
- $_SESSION['username'] = $_POST['username'];
- $_SESSION['password'] = $_POST['password'];
- } else {
- echo '<center>'."<font color='red'>Sorry, Incorrect Username or Password <br> Please Try Again </br> </font>".'</center>';
- }
- }
- <?php
- //set off all error for security purposes
- error_reporting(E_ALL);
- //define some contstant
- define( "DB_DSN", "mysql:host=localhost;dbname=dbname1" );
- define( "DB_USERNAME", "" );
- define( "DB_PASSWORD", "" );
- define( "CLS_PATH", "class" );
- //include the classes
- include_once( CLS_PATH . "/user.php" );
- ?>
- <?php
- session_start();
- // redirects to user to the login.php page if user is not logged in
- if (!isset($_SESSION['loggedIn'])){
- header("location: /login.php");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement