Jojee
11-27-2008, 09:06 PM
I'm using Toxic Goblin referrer script.
This is the code of the click.php:
if(isset($_REQUEST["id"]) || isset($_REQUEST["site"]))
{
include('config.php');
include($full_path.'functions.php');
$tgdb = mysql_connect($tgdbHost, $tgdbUser, $tgdbPass) or die(mysql_error());
mysql_select_db($tgdbName, $tgdb);
if(preg_match('!^[0-9]+$!', $_REQUEST["id"]))
{
$click_result = mysql_query("select hit_id, url from tg_ref_hits where hit_id='".$_REQUEST["id"]."'");
}
elseif(!empty($_REQUEST["site"]))
{
$url = addslashes($_REQUEST["site"]);
$click_result = mysql_query("select hit_id, url from tg_ref_hits where url='$url' order by hit_id desc limit 1");
}
else
{
$click_result = null;
}
$click = mysql_fetch_object($click_result);
if(is_object($click))
{
mysql_query("update tg_ref_hits set hits_out = hits_out+1 where hit_id = '".$click->hit_id."'");
$url = stripslashes($click->url);
$forward_result = mysql_query("select forward from tg_ref_approved where url = '$url'");
$forward_row = mysql_fetch_array($forward_result);
if ($forward_row['forward'] != "")
{
$url = $forward_row['forward'];
}
}
else
{
if (isset($_REQUEST["site"]))
{
$url = $_REQUEST["site"];
}
else
{
$url = &$_SERVER['SERVER_NAME'];
}
}
}
else
{
$url = &$_SERVER['SERVER_NAME'];
}
header("Location: http://$url");
exit;
?>
It works great - when you click out from my top links, it goes to where it's supposed to. Example:
Your Cute Design Resource ~ Neskaya.Net (http://neskaya.net)
But I have my top links section also in subdomains, and it tries to access subdomain.neskaya.net/click.php?id=whatever instead of neskaya.net/click.php?id=whatever, and then it doesn't work.
Example:
88x31 Cute Pixel Bunny Button Maker [88 x 31] (http://dressupgames.neskaya.net/88x31buttonmaker_bunny.php)
If you click under top links there, it doesn't work.
How do I fix the code so that it always goes to http://neskaya.net/referrers/click.php?id=whatev and doesn't include the subdomain?
Thanks :3
This is the code of the click.php:
if(isset($_REQUEST["id"]) || isset($_REQUEST["site"]))
{
include('config.php');
include($full_path.'functions.php');
$tgdb = mysql_connect($tgdbHost, $tgdbUser, $tgdbPass) or die(mysql_error());
mysql_select_db($tgdbName, $tgdb);
if(preg_match('!^[0-9]+$!', $_REQUEST["id"]))
{
$click_result = mysql_query("select hit_id, url from tg_ref_hits where hit_id='".$_REQUEST["id"]."'");
}
elseif(!empty($_REQUEST["site"]))
{
$url = addslashes($_REQUEST["site"]);
$click_result = mysql_query("select hit_id, url from tg_ref_hits where url='$url' order by hit_id desc limit 1");
}
else
{
$click_result = null;
}
$click = mysql_fetch_object($click_result);
if(is_object($click))
{
mysql_query("update tg_ref_hits set hits_out = hits_out+1 where hit_id = '".$click->hit_id."'");
$url = stripslashes($click->url);
$forward_result = mysql_query("select forward from tg_ref_approved where url = '$url'");
$forward_row = mysql_fetch_array($forward_result);
if ($forward_row['forward'] != "")
{
$url = $forward_row['forward'];
}
}
else
{
if (isset($_REQUEST["site"]))
{
$url = $_REQUEST["site"];
}
else
{
$url = &$_SERVER['SERVER_NAME'];
}
}
}
else
{
$url = &$_SERVER['SERVER_NAME'];
}
header("Location: http://$url");
exit;
?>
It works great - when you click out from my top links, it goes to where it's supposed to. Example:
Your Cute Design Resource ~ Neskaya.Net (http://neskaya.net)
But I have my top links section also in subdomains, and it tries to access subdomain.neskaya.net/click.php?id=whatever instead of neskaya.net/click.php?id=whatever, and then it doesn't work.
Example:
88x31 Cute Pixel Bunny Button Maker [88 x 31] (http://dressupgames.neskaya.net/88x31buttonmaker_bunny.php)
If you click under top links there, it doesn't work.
How do I fix the code so that it always goes to http://neskaya.net/referrers/click.php?id=whatev and doesn't include the subdomain?
Thanks :3