$bAllowPlainText = true; if(!$bAllowPlainText){ if(php_sapi_name()!='cli' and !$_SERVER[HTTPS]){ header("Location: https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); exit; } } if(!$_SERVER[DOCUMENT_ROOT]){ //this makes it easy to run CLI stuff - just include /common/inc_first.php and you should be good to go $_SERVER[DOCUMENT_ROOT] = str_replace("/common/inc_first.php", "", __FILE__); } include_once($_SERVER['DOCUMENT_ROOT']."/common/inc_config.php"); if(php_sapi_name()!='cli') include_once($_SERVER['DOCUMENT_ROOT']."/common/inc_session.php"); include_once($_SERVER['DOCUMENT_ROOT']."/common/ruErrorLog.php"); include_once($_SERVER['DOCUMENT_ROOT']."/common/inc_functions.php"); include_once($_SERVER['DOCUMENT_ROOT']."/common/ruSQL.php"); //include_once($_SERVER['DOCUMENT_ROOT']."/common/ruFormBuilder.php"); include_once($_SERVER['DOCUMENT_ROOT']."/common/inc_auth.php"); include_once($_SERVER['DOCUMENT_ROOT']."/common/inc_db.php"); //if the user is logged in, or logging in, make sure they are using HTTPS //ENABLE THIS IF WE GET AN SSL CERTIFICATE /* if($_SESSION[userID]){ if(!$_SERVER[HTTPS]){ header("Location: https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); exit; } }else{ if($_SERVER[HTTPS] and !$bUserIsLoggingIn and !$bUserIsLoginAs){ //force them to use HTTP //header("Location: http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); //exit; } } */ global $bThisIsPublicPage; if($bThisIsPublicPage) return; //if he's logged in to this domain then we are good if($_SESSION['HTTP_HOST']==$_SERVER['HTTP_HOST'] and $_SESSION['userID']){ $_SESSION['lastRequestDatetime'] = time(); //this just forces an update on the session return; } //if is'a CLI request then we are good if(php_sapi_name()=='cli') return; //get to here, he needs to login header("Location: " . LOGIN_PAGE_URL . "?err=You+must+be+signed+in+to+use+this+page.&afterLogin=" . urlencode($_SERVER['REQUEST_URI'])); exit; ?>