session_start(); if (!isset($_SESSION['referer']) || (!preg_match("/".$_SERVER['HTTP_HOST']."/i",$_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']))) { if (isset($_SERVER['HTTP_REFERER'])) $_SESSION['referer'] = $_SERVER['HTTP_REFERER']; else $_SESSION['referer'] = '0'; } ?>