SimpleTasks/authfunctions.php
2023-08-15 11:09:53 -04:00

22 lines
661 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.
//
function require_login () {
if ( (substr($_SERVER["REMOTE_ADDR"], 0, 10) == "192.168.2.")
|| (substr($_SERVER["REMOTE_ADDR"], 0, 8) == "127.0.0.") ) return true;
if ( !$_SESSION['validated'] ) {
// ******** START OF AUTH LOGIC ********
$_SESSION['appurl'] = $_SERVER['REQUEST_URI'];
header('Location: /jajauth/login.php');
exit();
// ********* END OF AUTH LOGIC *********
}
}
?>