// Coalescing can be chained: this will return the first defined // value (isset and != null) out of $_GET['user'], $_POST['user'], and 'nobody'. // $username = $_GET['user'] ?? $_POST['user'] ?? 'nobody'; // Elvis Operator // Returns expression if it is truthy, returns second expression if not. // $a = ''; // or 0 or false // $c = $a ?: 'a'; ($c is 'a') //$now = time(); //$timeout = 1; // minutes //ini_set("session.gc_maxlifetime", $timeout); //ini_set("session.cookie_lifetime", $timeout); //ini_set("session.cache_expire", $timeout); //session_name("mysession"); require($_SERVER["DOCUMENT_ROOT"] . "/class/sessionHandler.php"); $session_handler = new ExampleSessionHandler(); session_start(); $url = parse_url($_SERVER['HTTP_HOST']); //echo "
"; //print_r($_SESSION); //echo ""; $deniedUrls = array(); $deniedUrls["rotyre2"] = "rotyre.com"; $deniedUrls["rotyre"] = "www.rotyre.com"; $deniedUrls["testserver"] = "shop3.testsrv.rotyre.com"; $allow = array("94.242.250.124", "88.207.201.63"); //if(in_array($_SERVER['REMOTE_ADDR'], $allow)) { //if (in_array($_SERVER['REMOTE_ADDR'], $allow) && in_array($_SERVER["HTTP_X_FORWARDED_FOR"], $allow)) { if (!in_array($url["path"], $deniedUrls) || $_SERVER['HTTP_HOST'] == "shop3.testsrv.rotyre.com") { //if (!in_array( $url["host"], $deniedUrls) && isset($url["host"])) { //if($_SERVER["REMOTE_ADDR"] == "94.242.250.124") { require($_SERVER["DOCUMENT_ROOT"] . "/reload.php"); // //Screen From Cookie // if (!isset($_SESSION['screen_width'])) { // if (isset($_COOKIE['screen_width'])) { // $_SESSION['screen_width'] = $_COOKIE['screen_width']; // } // } // // if (!isset($_SESSION['screen_height'])) { // if (isset($_COOKIE['screen_height'])) { // $_SESSION['screen_height'] = $_COOKIE['screen_height']; // } // } ?> // if (!isset($_SESSION['screen_width']) || !isset($_SESSION['screen_height'])) { ?> // } else { ?>
echo print_r($_SESSION); ?>