## new 4
/*This software is under licence and can only be used with permission granted
from Globel Limited. */
// GET ENV SETTINGS
error_reporting(true);
$MYNAME = $_SERVER["PHP_SELF"]; // produces www/test/test/index.html
$tempstring = pathinfo($MYNAME); // returns an associative array containing information about path
$MYDIRNAME = $tempstring['dirname']; //produces "www/test/test"
if ($MYDIRNAME == "\\"){$MYDIRNAME = "";}
$SCRIPTNAME = $tempstring['basename'];
$WORKINGDIR = $_SERVER["SCRIPT_FILENAME"];
$WORKINGDIR = str_replace("\\", "/", $WORKINGDIR); //full working directory
$ROOTDIR = str_replace($MYNAME, "", $WORKINGDIR); //base directory
$WORKINGDIR = str_replace($SCRIPTNAME, "", $WORKINGDIR); //full working directory
$ROOTURL = $_SERVER["HTTP_HOST"];
$ROOTURL = "http://".$ROOTURL;
$WORKINGURL = $ROOTURL.$MYDIRNAME;
$FIXEDADDRESS = "balaton-spa.co.uk";
$HTTPREFERER = $_SERVER["HTTP_REFERER"];
$stack = "";
$displaylist = "";
$MAXtops = "5";
$MAXcount = 0;
$refexist = false;
$listallrefs = false;
$refcheck = false;
$listname = "";
$listcount = 0;
if ((strpos($HTTPREFERER, $_GET['ref']) == true) or
(strtolower($_GET['ref']) == "allrefs"))
{$refcheck = true;}
if ($_GET['ref'] > "")
{
if ($refcheck)
{
if (strtolower($_GET['ref']) == "allrefs")
{
$listallrefs = true;
$refexist = true;
$listname = "All Referrals
";
}
else
{
$listname = "Top ".$MAXtops." Referrals
";
}
$displaylist = $listname.'';
#$FH = fopen("data.txt", 'wb') or die("Can't Create file");
#hh
if (file_exists("data.txt") == true)
{
$FH = fopen("data.txt", 'r') or die("Can't open file");
$data = fread($FH, filesize("data.txt"));
fclose($FH);
$lines = split(";", $data);
rsort($lines, SORT_NUMERIC);
foreach($lines as $line)
{
if (!($line == ""))
{
$listcount++;
list($count, $exist) = split(",", $line);
if (strtolower($_GET['ref']) == $exist){$count++; $refexist = true;}
$stack .= $count.",".$exist.";";
if (($MAXcount < $MAXtops) or $listallrefs)
{
$MAXcount++;
if ($listallrefs){$displaylist .= $listcount.") ";}
$displaylist .= "".$exist." (".$count.")
";
}
}
}
if ($refexist == false)
{
$stack .= "1,".strtolower($_GET['ref']).";";
if ($MAXcount < $MAXtops)
{
$MAXcount++;
$displaylist .= "".strtolower($_GET['ref'])." (1)
";
}
}
if ($listallrefs == false)
{
$FH = fopen("data.txt", 'wb') or die("Can't Create file");
fwrite($FH, $stack);
fclose($FH);
}
}
else
{
$FH = fopen("data.txt", 'a') or die("Can't Create file");
fwrite($FH, "1,".strtolower($_GET['ref']).";");
fclose($FH);
if ($MAXcount < $MAXtops)
{
$MAXcount++;
$displaylist .= "".strtolower($_GET['ref'])." (1)
";
}
}
if ($listallrefs == false)
{
$displaylist .= "List All
";
}
$displaylist .= '';
$newOUTPUT = GETtemplate($displaylist);
echo $newOUTPUT; exit;
}
else
{
$displaylist .= '
Your item: $item_name usual price: $amount
$MSG
Enter Your Discount Code:
Or Click below to pay regular price of $amount for $item_name
$insert
![]() |
![]() |
|
Copyright 2008 Balaton Spa |