<?php

$uacct = $_REQUEST['uacct'];

$uacct = strtoupper($uacct);

switch ($uacct)
{

	case 'UA-501646-8':
	$custDB='tbssg';
	$customerId='57';
	$custDomain='thebodyshopsg.waveo.com';
	break;
	
	case 'UA-501646-11':
	$custDB='tbshk';
	$customerId='164';
	$custDomain='thebodyshophk.waveo.com';
	break;

	case 'UA-501646-9':
	$custDB='marinasquare';
	$customerId='21';
	break;

	default:
    mail('xianghui@waveo.com','tracking error notice', var_export($_REQUEST,true) . "\n" . var_export($_SERVER,true));
	exit;
	break;
}

if (isset($_COOKIE['UNIQUE']))
{
	$uid = $_COOKIE['UNIQUE'] ;
}
else{   
    $uid = "0";
}
 
error_log("+++++++uacct = [$uacct] & unique = [$uid]++++++++++\n", 3, '/usr/local/apache/logs/member_tracking');

echo <<<JAVASCRIPT

function waveo_URLencode(sStr) {
return escape(sStr)
.replace(/\+/g, '%2B')
        .replace(/\"/g,'%22')
        .replace(/\'/g, '%27');
}
if (window.opener != null)
{
		openerurl=window.opener.location.href;
}
else
{
		openerurl='';
}
var waveoTrackingImg=new Image(1,1);
waveoTrackingImg.src= "http://$custDomain/website/member_tracking.php?cachebuster="+ waveo_URLencode(Date()) + Math.random() + "&url=" + waveo_URLencode(location.href) + "&referrer=" + waveo_URLencode(document.referrer) + "&opener=" + waveo_URLencode(openerurl) + "&uid=$uid" + "&uacct=$uacct";

JAVASCRIPT;

?>
