Beispiel #1
0
if ($mysqli->connect_errno) {
    echo "Failed to connect to MySQL: " . $mysqli->connect_error;
} else {
    include_once 'includes/fn_authorise.php';
    // include_once('includes/fn_strings.php'); wip
    // include_once('includes/fn_formatting.php'); wip
    $menuFile = '';
    $contentFile = '';
    $contentMsg = '';
    $loginAuthorised = $_COOKIE["loginAuthorised"] == "loginAuthorised";
}
if (!$loginAuthorised) {
    // if there isn't a stored logged in username/pass, post a user/pass otherwise continue (to 34)
    $username = $_POST['username'];
    $password = $_POST['password'];
    if (userAuthorised($username, $password, $link)) {
        // if user is authorised after posting user/pass, refresh page (back to 1)
        header("Location: index.php");
    } else {
        $contentFile = 'includes/tp_loginform.php';
        //if user is NOT authorised after posting user/pass, direct to login form
        include $contentFile;
        // manipulate later
    }
} else {
    $accType = $_COOKIE["accType"];
    $userID = $_COOKIE["userID"];
    $status = $_GET['status'];
}
if (isset($status) and $status == "logout") {
    //if login status is set, and set to logout, delete auth cookie and refresh otherwise continue (to 44)
}
$contentFile = '';
$contentMsg = '';
// connect to MYSQL /w info in external file
// if mysql has a error, return it else if mysql has connected successfully, designate files as blank
$loginAuthorised = $_COOKIE["loginAuthorised"] == "loginAuthorised";
if ($loginAuthorised) {
    $menuFile = 'includes/tp_crmMenu.php';
    //sub-page that determines what options are shown based on acctype
} else {
    $contentFile = 'includes/tp_loginForm.php';
    //sets variable to redirect to login form
}
$username = $_POST['username'];
$password = $_POST['password'];
if (userAuthorised($username, $password)) {
    header("Location: index.php");
} else {
    $contentFile = 'includes/tp_loginForm.php';
}
include_once 'includes/fn_authorise.php';
$accessLevel = $_COOKIE["accessLevel"];
$userID = $_COOKIE["userID"];
$status = $_GET['status'];
if (isset($status) and $status == "logout") {
    setcookie("loginAuthorised", "", time() - 7200);
    header("Location: index.php");
} else {
    //		This is where we manage CONTENT for LOGGED-IN users
    $menuFile = 'includes/tp_crmMenu.php';
    $contentCode = $_GET['content'];