View file www/pr.php

File size: 1.35Kb
<?
include('../includes/common.php');

$id = trim($_GET['id']);

if(!is_numeric($id)){
	header("Location: $SITE_URL");
	exit;
}

$p_row = mysql_fetch_object(mysql_query("select * from partners where id=$id and status=1"));
if($p_row->id==""){
	header("Location: $SITE_URL");
	exit;
}

$tmp_arr =  GetHTTPParams();
$ip = $tmp_arr['ip'];
$proxy_ip = $tmp_arr['proxy_ip'];
$proxy_type = $tmp_arr['proxy_type'];


$arr = Array(
	"partner_id" => $id,
	"ip" => $ip,
	"proxy_ip" => $proxy_ip,
	"proxy_type" => $proxy_type,
	"regdate" => time(),
	"user_agent" => addslashes($_SERVER['HTTP_USER_AGENT']),
	"referer" => addslashes($_SERVER['HTTP_REFERER'])
);

$ip_country_id = IP2CountryID($ip);
if($ip_country_id>0){
	$arr["ip_country_id"] = $ip_country_id;
}
$proxy_country_id = IP2CountryID($proxy_ip);
if($proxy_country_id>0){
	$arr["proxy_country_id"] = $proxy_country_id;
}

if(($click_id=AddRecord("partner_clicks",$arr,true))){
	setcookie("PARTNER_CLICK",$click_id,time()+365*86400);
}

if ((isset($_GET['currency'])) && (0 < intval($_GET['currency'])))
{
	header("Location: $SITE_URL/currency.php?currency=".intval($_GET['currency']));
	exit;
}

if ($_GET['p'] == 1)
{
	header("Location: $SITE_URL");
//	header("Location: $SITE_URL/register.php");
	exit;
	
}
else
{
	header("Location: $SITE_URL");
	exit;
}
exit;
?>