Example #1
0
function activeUser()
{
    if (checkLoggedOn()) {
        return $_SESSION['Username'];
    } else {
        return -1;
    }
}
Example #2
0
function retrieveCurrentUser()
{
    if (checkLoggedOn()) {
        return $_SESSION['Username'];
    } else {
        return '';
    }
}
<!DOCTYPE html>
<?php 
session_start();
include "core/functions/general.php";
if (checkLoggedOn()) {
    header("location: index.php");
    exit;
} else {
    $errors = retrieveErrArray();
}
?>

<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> 

<title>Log In</title>

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- BookHunters -->
<link rel="stylesheet" href="css/bootstrap.css">
<link href='style.css' rel='stylesheet'/>

<?php 
include 'components/header.php';
printNotice();
?>
<?php

//Validation.php
//
//Checks if the users is logged on, if not sends them to the index page.
//Should be used on every page that requires users to be logged on
//before any other php is run
include_once 'functions/general.php';
if (!isset($_SESSION)) {
    session_start();
}
if (!checkLoggedOn()) {
    header('location: ../log_in.php');
}
Example #5
0
 public function validate($currentUser = '')
 {
     include_once '/../functions/users.php';
     $this->valid = true;
     if ($currentUser == $this->user) {
         $this->valid = false;
     }
     if ($this->loggedOn == true && !checkLoggedOn()) {
         $this->valid = false;
     }
     if ($this->loggedOff == true && checkLoggedOn()) {
         $this->valid = false;
     }
     //Placeholder for admin and moderator checks
 }