cid : ".$cid); if(trim($cid) == "") { //Dont set cookie just redirect to landing page. $cookiepresent =1; openLandingPage(); exit(); } $cookiename = "ctscreative"; //Step:4 $ctscookie = $HTTP_COOKIE_VARS[$cookiename]; //echo("
ctscookie : ".$ctscookie); if (isset ($ctscookie) && trim($ctscookie)==trim($cid)) { //Step:4a //echo("
cookie is already set and the creativecode is also same: open Landing Page"); $cookiepresent =1; openLandingPage(); } else { //Step:4b //echo("
cookie is not set or the creative code is different. set the cookie and load the landing page"); $cookiepresent =0; setCts($cookiename); openLandingPage(); } //------------------------------------------------------------------------------ //Function :setCts //This function set the Campaign Tracking System Cookie in the client machine //------------------------------------------------------------------------------ function setCts($cookiename){ global $cid; $today = getdate(); $month = $today['mon']; $mday = $today['mday']; $year = $today['year']; $createdon = $year."-".$month."-". $mday; $expires = time()+(3600*24*30); //approximatly 30 days setcookie($cookiename, $cid,$expires,"/"); } //------------------------------------------------------------------------------ function openLandingPage() { $filename = getLandingPageURL(); //echo "
Landing Page : $filename"; $file = fopen ($filename, "r"); if (!$file) { echo "

Unable to open remote file.\n"; exit; } while (!feof ($file)) { $line = fgets ($file, 1024); if(strpos($line,"")>=0) { $line = str_replace("","\n",$line); } if(strpos($line,"")>=0) { $line = str_replace("","\n",$line); } echo($line ); } fclose($file); setCookieTracker(); //Set the client side code for triggering the cookie tracer } //------------------------------------------------------------------------------ function setCookieTracker() { global $cid; global $cookiepresent; $host = getHost(); $url = $host."/ctsisset.php?cookiepresent=$cookiepresent&cid=$cid"; ?> host : $host"; if($host != "http://attackinga.ragedev:81" || $host != "http://stresscenter.ragedev") { $host="http://www.stresscenter.com"; } else { $host=$host; } $defaulturl = $host; $url=""; $strsql = "SELECT * FROM tblctscampaignmediacreatives where creativecode='".$cid."'"; $result=mysql_query($strsql); $recordcount = mysql_num_rows($result); if($recordcount >0){ $line = mysql_fetch_array($result); $url = $line["url"]; $mediaid = $line["mediaid"]; //echo "
creativeurl : ".$url; if($url=="") // if creative doesnot have url { $strsql = "SELECT * FROM tblctscampaignmedias where mediaid='".$mediaid."'"; //echo("
strsql : $strsql"); $result=mysql_query($strsql); $recordcount = mysql_num_rows($result); if($recordcount >0){ $line = mysql_fetch_array($result); $url = $line["mediaurl"]; $campaignid = $line["campaignid"]; //echo "
media url : ".$url; if($url=="") // if media doesnot have url { $strsql = "SELECT * FROM tblctscampaignmaster where campaignid='".$campaignid."'"; //echo("
strsql : $strsql"); $result=mysql_query($strsql); $recordcount = mysql_num_rows($result); if($recordcount >0){ $line = mysql_fetch_array($result); $url = $line["campaignurl"]; //echo "
campaignurl url : ".$url; } } } } } //echo("
url : ".$url); if($url=="") { $url=$defaulturl."/default.php"; } //echo("
substr : ".$url); //echo("
substr : ".substr($url,0,1)); if(substr(trim($url),0,1)=="/") { $url=$host.$url; } //echo "
url : $url"; if($url == $host."/default.php") { $browserspecifichomepage = getBrowserSpecificHomePage(); $url=str_replace("default.php", $browserspecifichomepage, $url); } if(substr($url,0,7) !="http://") { $url = "http://".$url; } $url = $url."?hpg=$hpg_rga_cookie_values&useragent=$useragent"; //echo("
url : ".$url"); return $url; } //------------------------------------------------------------------------------ function getBrowserSpecificHomePage() { /* Depricated *** global $useragent; $filename="home_ie.htm"; if(strpos($useragent,"mac" )>1) { $filename="defaultmac.htm"; }elseif(strpos($useragent,"4.7" )>1 || strpos($useragent,"Netscape/7.0" )>1) { $filename="home_ns.htm"; } */ $filename="default.php"; return $filename; } ?>