$val) { if (is_array($val)) { array_add_slashes($array[$var]); } else { $array[$var] = addslashes($array[$var]); } } } error_reporting(0); set_magic_quotes_runtime(0); if (!get_magic_quotes_gpc()) { // I use this convention on all my scripts to ensure every variable is addslahed : array_add_slashes($_GET); array_add_slashes($_POST); array_add_slashes($_COOKIE); } $ref=0; $u=""; if (isset($_SERVER["HTTP_REFERER"])) //is the referer var set? { $r = strtolower($_SERVER["HTTP_REFERER"]); //make it lower case $r = str_replace('https://', 'http://', $r); //replace https:// with http:// $r = str_replace('http://www.', '', $r); // delete the leading www. $pos = strpos($r, 'http://'); $i = ($pos === false) ? 0 : 2; $s = explode('/', $r); $u = $s[$i]; // $u now contains the domain name of the referer $u = addslashes($u); $result = @mysql_query("SELECT pid FROM skadpsites WHERE site='$u'",$db); $ref=1; } //print "Hello, you came from ".$u; $aff_id=0; $c_ip = $_SERVER["REMOTE_ADDR"]; $c_time = time(); if (isset($_COOKIE[$cookiename])) { //if that visitor has come from an affiliate site before, then do nothing //that will favor the first affiliate referrer; if you want you can change that. $aff_id = @unserialize(stripslashes($_COOKIE[$cookiename])); } else{ if ($ref==1){ if (@mysql_num_rows($result) == 1) { $aff_id = @mysql_result($result, 0); @setcookie($cookiename, serialize($aff_id), time() + 31536000, $cookiepath, $cookiedomain, $cookiesecure); //set a cookie on his/her computer } } } $sql="INSERT INTO skadvisitors (customer_ip, customer_time, aff_id,fromurl) VALUES (\"$c_ip\",$c_time,$aff_id,\"$u\")"; // print $sql; @mysql_query($sql,$db); // add visitor to the database ?> Skeleton Adventures Screensaver
 
Members Enter Site Skip Intro