$referrer = urlencode($_SERVER['HTTP_REFERER']); $referrer = str_replace("http://","", $referrer); $referrer = str_replace("https://","", $referrer); if(!$_GET['apflag']) header("".$_SERVER["QUERY_STRING"]); if(!$_COOKIE['apid']) setcookie("apid", $_GET['apid'], time()+300000000); ?>