ComicsViewer/authfunctions.php

25 lines
753 B
PHP

<?php
//
// This function is called at the beginning of any pages where
// user login is required. Feel free to change the logic between
// the lines indicated below.
//
define("NOREDIRECT", false);
function require_login ($redirect = true) {
if ( !is_bool($redirect) ) exit();
if ( !$_SESSION['validated'] && $redirect ) {
// ******** START OF AUTH LOGIC ********
$_SESSION['appurl'] = $_SERVER['REQUEST_URI'];
header('Location: /jajauth/login.php');
exit();
// ********* END OF AUTH LOGIC *********
} elseif ( !$_SESSION['validated'] && !$redirect ) {
return false;
} elseif ( $_SESSION['validated'] ) {
return true;
}
}
// vim: set ts=3 sw=3: