here is my PHP
Code: Select all
# This is a session tracker to provide for A/B testing on the website.
session_start();
# Initialize a random number
srand ((float) microtime() * 10000256);
# Define the array
$whichdeal = array(1 => "4.0", 2 => "5.0"); //shortcut for below values start at 0
# Choose the poison
$random_key = array_rand($whichdeal);
# Set the value of Dealinfo
$dealnum = $random_key;
$cookie = $_COOKIE['cellularbuys'];
if (!isset($_COOKIE['cellularbuys'])){
setcookie('cellularbuys', $dealnum, time()+60*60*24*30, "/");
} else {
if ($cookie == "1"){
$oflag = "sof2";
} else if ($cookie == "2"){
$oflag = "sfcart";
} else {
$oflag = "sof1";
}Code: Select all
<script type="text/JavaScript">
<!--
if(document.cookie = "cellularbuys"){
document.write("it Exists: "+ document.cookie.split("=")[2])
cookieTst= document.cookie.split("=")[2]
if(cookieTst == "1"){
document.write("WE ARE 1")
oflag=document.write("&o=sof2")
}else{
document.write("WE ARE 2")
oflag=document.write("&o=sfcart")
}
}else{
document.write("no Cookie Yet")
oflag=document.write("&o=sof1")
}
//-->
</script>in PHP it looks like this
Code: Select all
<a href="www.xxx.com?r-erwerwe<? echo $oflag; ?>"ckick here </a>