Guest User

Untitled

a guest
Oct 27th, 2017
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1.  
  2. <?php
  3. require_once('config.php');
  4. require_once('lib/database.php');
  5. require_once('lib/auth.php');
  6. require_once('lib/user.php');
  7.  
  8. if(isset($_POST['submit'])){
  9.  
  10.     $check_auth = $auth->authenticate_user($_POST['username'] ,$_POST['password']);
  11.    
  12.     if($check_auth){
  13.    
  14.         session_start();
  15.         $_SESSION['is_logged_in'] = TRUE;
  16.         $_SESSION['username'] = $_POST['username'];
  17.        
  18.         header("Location: " . $config['base_url'] . "home.php");
  19.    
  20.     } else {
  21.    
  22.         $_SESSION['is_logged_in'] = FALSE;
  23.    
  24.     }
  25.  
  26. }
  27.  
  28.  
  29. ?>
  30. <form method="post" action="login.php" >
  31. <fieldset>
  32. <legend accesskey="l">Login</legend>
  33.  
  34. <label for="username">Username :</label>
  35. <input type="text" name="username" />
  36. <label for="password">Password :</label>
  37. <input type="password" name="password" />
  38. <input type="submit" value="login" name="submit" />
  39. <a href="signup.php">Sign Up</a>
  40. </fieldset>
  41. </form>
Add Comment
Please, Sign In to add comment