Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'WebsiteUser.php';
- session_start();
- if(isset($_SESSION['websiteUser'])){
- if(!$_SESSION['websiteUser']->isAuthenticated()){
- header('Location:login.php');
- }
- }else{
- header('Location:login.php');
- }
- $missingFields = false;
- if(isset($_POST['submit'])){
- if(isset($_POST['username']) && isset($_POST['password'])){
- if($_POST['username'] == "" || $_POST['password'] == ""){
- $missingFields = true;
- } else {
- //All fields set, fields have a value
- $websiteUser = new WebsiteUser();
- if(!$websiteUser->hasDbError()){
- $username = mysqli_real_escape_string(stripslashes(strip_tags($_POST['username'])));
- $password = mysqli_real_escape_string(stripslashes(strip_tags($_POST['password'])));
- $websiteUser->authenticate($username, $password);
- if($websiteUser->isAuthenticated()){
- echo "this worked";
- $_SESSION['websiteUser'] = $websiteUser;
- header('Location:internal.php');
- }
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement