document.getElementById('optin').submit();
";
$auto_optin="$optin_form";
echo $auto_optin;
}
}
function setPayee($product, $itemnumber, $pct1, $pct2)
{
global $sys_paypal, $tier;
global $sys_eq1_pct, $sys_eq1_paypal;
global $sys_eq2_pct, $sys_eq2_paypal;
$email = $sys_paypal; #sale defaults to merchant
$tier=0;
if(isset($_COOKIE['aff']) && strtolower($email)<>strtolower($_COOKIE['aff']))
{
$affiliate=strtolower($_COOKIE['aff']);
$sql="SELECT * FROM nicknames
WHERE email='".$affiliate."'";
$nres=@mysql_query($sql);
if(@mysql_num_rows($nres)>0) {
$nrec=@mysql_fetch_assoc($nres);
$sponsor=$nrec['sponsor'];
}
# See if affiliate should get this sale.
$affpct = 0;
$t1sales = 0;
$t2sales = 0;
$affreferrals = 0;
$sql="SELECT * FROM sales
WHERE productID=".$product."
AND refunded=0
AND item_number='".$itemnumber."'
AND affiliate='".$affiliate."'";
$sres=@mysql_query($sql);
while($sales=@mysql_fetch_array($sres))
{
# Affiliate referral
$affreferrals++;
if($sales['tier'] == 1)
$t1sales++;
if($sales['tier'] == 2)
$t2sales++;
}
if($affreferrals > 0)
{
$t1pct = ($t1sales / $affreferrals)*100;
$t2pct = ($t2sales / $affreferrals)*100;
if($pct1 > 0 && $t1pct<$pct1) {
$email = urldecode($affiliate);
$tier = 1;
} else {
if($sys_two_tier && $sponsor != "" && $pct2 > 0 && $t2pct<$pct2) {
$email = urldecode($sponsor);
$tier = 2;
}
}
}
}
/*__________ Calculate Equity Partner Share ____________*/
if($email == $sys_paypal) #sale to merchant
{
if($sys_eq1_paypal <> "")
{
$totsales=0;
$p1sales=0;
$p2sales=0;
$sql="SELECT * FROM sales
WHERE productID=".$product."
AND refunded=0
AND item_number='".$itemnumber."'
AND tier=0";
$sres=@mysql_query($sql);
while($sales=@mysql_fetch_array($sres))
{
$totsales+=$sales['payment_amount'];
if($sales['receiver_email']==$sys_eq1_paypal)
$p1sales+=$sales['payment_amount'];
if($sales['receiver_email']==$sys_eq2_paypal)
$p2sales+=$sales['payment_amount'];
}
$p1_pct=($p1sales / $totsales)*100;
$p2_pct=($p2sales / $totsales)*100;
if($p1_pct < $sys_eq1_pct) {
$email=$sys_eq1_paypal;
} elseif($p2_pct < $sys_eq2_pct) {
$email=$sys_eq2_paypal;
}
}
}
return $email;
}
# Set privacy policy to insure current IE browsers will accept the cookie.
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
$action="none";
if(isset($_REQUEST['action'])) $action = $_REQUEST['action'];
switch ($action)
{
case "squeeze" :
if($sys_giveaway)
{
$url = $_SERVER[PHP_SELF]."?action=squeeze&dld=1";
break;
}
case "otodownload" :
if(!isset($_GET["dld"]) && !isset($_GET["e"]))
{
# Check for sale to this IP address
$oto = false;
if($action=="otodownload") $oto = true;
$ip = $_SERVER["REMOTE_ADDR"];
$sql="SELECT * FROM sales
WHERE productID=".$productID."
AND ip_address='".$ip."'
ORDER BY expires DESC";
$sres=@mysql_query($sql);
if(@mysql_num_rows($sres)==0)
$nosale=true;
$sales=@mysql_fetch_array($sres);
if($oto && $sales['item_number']!=$sys_oto_number)
$nosale=true;
# Make sure sale isn't expired
if(time()>strtotime($sales['expires']))
$nosale=true;
if(!$nosale){
$firstname=$sales['firstname'];
$lastname=$sales['lastname'];
$fullname=$sales['firstname']." ".$sales['lastname'];
$email=$sales['payer_email'];
$txn_id=$sales['txn_id'];
$affiliate=#sales['affiliate'];
setcookie("custfirst", $firstname, time()+(60*60*24*365), "/", "." . $sys_domain);
setcookie("custlast", $lastname, time()+(60*60*24*365), "/", "." . $sys_domain);
setcookie("custfull", $fullname, time()+(60*60*24*365), "/", "." . $sys_domain);
setcookie("custemail", $email, time()+(60*60*24*365), "/", "." . $sys_domain);
setcookie("txn_id", $txn_id, time()+(60*60*24*365), "/", "." . $sys_domain);
# Sales record found.
switch ($action)
{
case "squeeze" :
$url = $_SERVER[PHP_SELF]."?action=squeeze&id=".$sales['txn_id']."&dld=1";
break;
case "otodownload" :
$url = $_SERVER[PHP_SELF]."?action=download&id=".$sales['txn_id']."&dld=1";
break;
default :
$url = $_SERVER[PHP_SELF];
break;
}
header("Location: $url");
}
elseif($_GET["retry"]<11)
{
# Allow 60 seconds for PayPal to post IPN record
$retry = 0;
if(isset($_GET["retry"]))
$retry = $_GET["retry"] + 1;
$seconds = 60 - ($retry * 5);
$refresh = "";
$header = $sys_tmpl_folder."header.html";
$footer = $sys_tmpl_folder."footer.html";
$filename = $sys_tmpl_folder."from_paypal.html";
@include($header);
include($filename);
@include($footer);
} else {
# IP not found in sales records. Show error message.
$header = $sys_tmpl_folder."header.html";
$footer = $sys_tmpl_folder."footer.html";
$filename = $sys_tmpl_folder."payment_timeout.html";
@include($header);
include($filename);
@include($footer);
}
exit;
}
break;
}
if(isset($_GET['dc']))
{
$dc=$_GET['dc'];
$rightnow = date('Y-m-d H:i:s');
$sql="SELECT * FROM coupons
WHERE productID=".$productID."
AND code ='".$dc."'
AND expires > '".$rightnow."'";
$resource=@mysql_query($sql);
while($result=@mysql_fetch_assoc($resource)) {
$discount=$result['id'];
$item_price=$result['price'];
}
}
if(isset($_GET["e"]))
{
switch ($action) {
case "presale" :
case "jvsignup" :
case "affsignup" :
$target="?action=".$action;
break;
}
if(isset($_GET['dc'])) {
if(!isset($target)) {
$target = "?dc=".$_GET['dc'];
} else {
$target .= "&dc=".$_GET['dc'];
}
}
if($_GET["e"] == "")
{
# Clear affiliate cookie.
setcookie("aff", FALSE, time()+(60*60*24*365), $sys_affcookiepath, "." . $sys_domain);
header("Location: $_SERVER[PHP_SELF]$target");
exit;
} else {
if (!eregi("@", $_GET["e"])) {
$e = trim($_GET['e']);
$sql="SELECT * FROM nicknames
WHERE nickname = '".$e."'";
$eres=@mysql_query($sql);
$erec=@mysql_fetch_array($eres);
// Replace the affiliate nickname with their Paypal email address
if($erec['nickname']==$e) {
$_GET["e"] = $erec['email'];
} else {
unset($_GET["e"]);
}
}
# Make sure this affiliate hasn't been banned
$sql="SELECT * FROM banned
WHERE email='".strtolower($_GET['e'])."'";
$res=@mysql_query($sql);
if(@mysql_num_rows($res)==0)
{
# Set cookie and redirect visitor if it's through an affiliate link.
if(!$sys_cust_only)
{
$validaff = true;
} else {
$validaff = false;
$where="";
if(!$sys_glbaff)
$where=" AND productID=".$productID;
$sql="SELECT * FROM nicknames
WHERE email='".strtolower($_GET['e'])."'".$where;
$res=@mysql_query($sql);
if(@mysql_num_rows($res)>0)
{
# Affiliate is valid
$validaff = true;
} else {
# See if this affiliate bought the product
$sql="SELECT * FROM sales
WHERE payer_email = '".strtolower($_GET['e'])."'
AND refunded <> 1".$where;
$salesres = @mysql_query($sql);
while($salesrec = @mysql_fetch_array($salesres))
{
$validaff = true;
break;
}
}
}
if($validaff)
{
setcookie("aff", strtolower($_GET['e']), time()+(60*60*24*365), $sys_affcookiepath, "." . $sys_domain);
if($_GET['taf'])
{
header("Location: $_SERVER[PHP_SELF]?taf=1");
} else {
header("Location: $_SERVER[PHP_SELF]$target");
}
} else {
# Clear affiliate cookie and request sales page
setcookie("aff", $sys_paypal, time()+(60*60*24*365), $sys_affcookiepath, "." . $sys_domain);
header("Location: $_SERVER[PHP_SELF]$target");
}
exit;
}
else
{
# Clear affiliate cookie of banned affiliate
setcookie("aff", $sys_paypal, time()+(60*60*24*365), $sys_affcookiepath, "." . $sys_domain);
header("Location: $_SERVER[PHP_SELF]$target");
exit;
}
}
}
if(isset($_COOKIE['aff']) && $_COOKIE['aff']!="")
{
$email = $_COOKIE['aff'];
$affiliate = $_COOKIE['aff'];
} else {
$email = $sys_paypal;
}
if($sys_disabled) {
$header = $sys_tmpl_folder."header.html";
$footer = $sys_tmpl_folder."footer.html";
$filename = $sys_tmpl_folder."offline.html";
@include($header);
include($filename);
@include($footer);
exit;
}
switch ($action) {
# CHECK FOR ADDON ACTION
#_______________________
case "a" :
if ($_GET['fn'])
{
$numdotdots = count(explode("/",$sys_install_folder))-2;
$dots="";
for ($i=0; $i<$numdotdots; $i++) {
$dots = $dots."../";
}
$filename = $dots."rap_admin/addons/".$_GET['fn'].".php";
break;
}
break;
# HANDLE PRE-SALES PAGE
# _______________________
case "presale" :
$filename = $sys_tmpl_folder."presale.html";
break;
# HANDLE ORDER VIA PAYPAL
# _______________________
case "order" :
if($sys_giveaway && !isset($_GET["oto"]))
{
# Send visitor straight to the squeeze page
$filename = $sys_tmpl_folder . "squeeze.html";
break;
}
if($sys_get_zips && !isset($_GET["gotzip"]) && !isset($_GET["oto"]))
{
# Show location info form.
$filename = $sys_tmpl_folder . "zips.html";
break;
} else {
$country = "";
$state = "";
$zipcode = "";
if($sys_get_zips)
{
# retrieve location info from cookies.
$zips = explode("|", $_COOKIE["zips"]);
$country = $zips[0];
$state = $zips[1];
$zipcode = $zips[2];
}
# Which salesletter template?
if(isset($_COOKIE['slsltr']))
{
$salesletter = $_COOKIE['slsltr'];
} else {
# Get salesletter template
$sql = "SELECT * from salesletters
WHERE productID = '".$instrow['id']."'
AND disabled <> 1
ORDER BY hits LIMIT 1";
$slres = @mysql_query($sql);
$slrow = @mysql_fetch_array($slres);
$salesletter = $slrow['template'];
}
# Send them through the order process.
if(isset($_COOKIE['aff']))
{
$where="";
if(!$sys_glbaff)
$where=" AND productID=".$productID;
$sql="SELECT * FROM nicknames
WHERE type='jv'
AND email='".$_COOKIE['aff']."'".$where;
$pres=@mysql_query($sql);
if(@mysql_num_rows($pres) > 0) {
if($sys_jv_item_pct>0)
$sys_item_pct=$sys_jv_item_pct;
if($sys_jv_oto_pct>0)
$sys_oto_pct=$sys_jv_oto_pct;
if($sys_jv_item_pct2>0)
$sys_item_pct2=$sys_jv_item_pct2;
if($sys_jv_oto_pct2>0)
$sys_oto_pct2=$sys_jv_oto_pct2;
}
}
if(isset($_GET["oto"]))
{
# Buying OTO.
$email = $sys_paypal;
if(isset($_COOKIE['aff']))
{
$checkotosale = true;
if($sys_otocust_only)
{
$checkotosale = false;
# Restrict OTO commissions to OTO customers only.
$sale = verifyOTO(urldecode($_COOKIE['aff']));
if(is_array($sale))
{
$checkotosale = true;
}
}
if($checkotosale)
$email = setPayee($productID, $sys_oto_number, $sys_oto_pct, $sys_oto_pct2);
}
$item_name = $sys_oto_name;
$item_number = $sys_oto_number;
$item_price = $sys_oto_price;
$item_download_url = "http://$sys_domain" . $sys_install_folder . "?action=otodownload";
$item_cancel_url = "http://$sys_domain" . $sys_install_folder . "?action=download";
$item_ipn_url = "http://$sys_domain" . "/rap_admin/ipn.php";
$_SESSION['orderbutton']=$sys_oto_orderbutton;
} else {
# Regular purchase.
if($sys_item_pct < 100) {
$email = setPayee($productID, $sys_item_number, $sys_item_pct, $sys_item_pct2);
} elseif(isset($_COOKIE['aff']) && $_COOKIE['aff']<>$sys_paypal) {
$tier = 1;
$email = $_COOKIE['aff'];
} else {
$tier = 0;
$email = $sys_paypal;
}
$item_name = $sys_item_name;
$item_number = $sys_item_number;
$item_price = $sys_item_price;
$item_download_url = "http://$sys_domain" . $sys_install_folder . "?action=squeeze";
$item_cancel_url = $sys_cancel_url;
$item_ipn_url = "http://$sys_domain" . "/rap_admin/ipn.php";
$_SESSION['orderbutton']=$sys_item_orderbutton;
}
# Get customer IP address.
$ip = $_SERVER["REMOTE_ADDR"];
if(isset($_GET['dc'])) {
$dc=$_GET['dc'];
$rightnow = date('Y-m-d H:i:s');
$sql="SELECT * FROM coupons
WHERE productID=".$productID."
AND code ='".$dc."'
AND expires > '".$rightnow."'";
$resource=@mysql_query($sql);
while($result=@mysql_fetch_assoc($resource)) {
$discount=$result['id'];
$item_price=$result['price'];
}
}
if($email == "") $email = $sys_paypal;
if($_COOKIE['aff'] == $sys_paypal) {
$affiliate = $sys_paypal;
} else {
$affiliate = $_COOKIE['aff'];
}
# Submit to PayPal.
$header = $sys_tmpl_folder."header.html";
$footer = $sys_tmpl_folder."footer.html";
$filename = $sys_tmpl_folder."goto_paypal.html";
@include($header);
include($filename);
## include("http://".$sys_domain."/rap_admin/".$_SESSION['orderbutton']);
$numdotdots = count(explode("/",$sys_install_folder))-2;
$dots="";
for ($i=0; $i<$numdotdots; $i++) {
$dots = $dots."../";
}
$p = $dots."rap_admin/".$_SESSION['orderbutton'];
include($p);
echo <<< END
END;
@include($footer);
exit;
}
break;
# GATHERED COUNTRY / STATE / ZIP INFO
# ___________________________________
case "zips" :
unset($_SESSION['errmsg']);
# Check for required fields
if($_REQUEST["country"] == "" | $_REQUEST["state"] == "" | $_REQUEST["zipcode"] == "")
{
$_SESSION['errmsg'] = "All fields are Required! RETRY";
$filename = $sys_tmpl_folder."zips.html";
} else {
setcookie("zips", "$_GET[country]|$_GET[state]|$_GET[zipcode]", time()+(60*60*24*365), $sys_install_folder, "." . $sys_domain);
header("Location: $_SERVER[PHP_SELF]?action=order&gotzip=1");
exit;
}
break;
# HANDLE SQUEEZE/DOWNLOAD PAGE
# ____________________________
case "squeeze" :
case "download" :
If(isset($_REQUEST['id'])){
# Check that Transaction ID is valid
$id = $_REQUEST['id'];
$sql="SELECT * FROM sales
WHERE txn_id='".$id."'";
$sres=@mysql_query($sql);
$sales=@mysql_fetch_array($sres);
if($sales['txn_id']==$id){
# Check that download link has not expired
if(time()<=strtotime($sales['expires'])){
if($sales['item_number']==$sys_oto_number){
# Download One-time offer
if($sys_taf)
{
$filename = $sys_tmpl_folder . "ototaf.html";
} else {
$filename = $sys_tmpl_folder . "otodownload.html";
}
} elseif(isset($_REQUEST['rx'])) {
# Download front-end offer
$filename = $sys_tmpl_folder . "download.html";
} else {
if($action=="squeeze")
{
$firstname=$sales['firstname'];
$lastname=$sales['lastname'];
$fullname=$sales['firstname']." ".$sales['lastname'];
$email=$sales['payer_email'];
$txn_id=$sales['txn_id'];
$affiliate=#sales['affiliate'];
$fullurl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
$root_path=substr($fullurl,0,strrpos($fullurl, "/"));
$awreturnurl=$root_path.$install_folder."/?action=download target='iframe'";
setcookie("custfirst", $firstname, time()+(60*60*24*365), "/", "." . $sys_domain);
setcookie("custlast", $lastname, time()+(60*60*24*365), "/", "." . $sys_domain);
setcookie("custfull", $fullname, time()+(60*60*24*365), "/", "." . $sys_domain);
setcookie("custemail", $email, time()+(60*60*24*365), "/", "." . $sys_domain);
setcookie("txn_id", $txn_id, time()+(60*60*24*365), "/", "." . $sys_domain);
if(!$sys_bypass_squeeze && !$sys_aw_flag)
{
$filename = $sys_tmpl_folder . "squeeze.html";
} else {
# Show appropriate page.
if ($sys_oto_flag) {
$filename = $sys_tmpl_folder . "oto.html";
} elseif($sys_taf) {
$filename = $sys_tmpl_folder . "taf.html";
} else {
$filename = $sys_tmpl_folder . "download.html";
}
}
} else {
if($sys_oto_flag) {
$filename = $sys_tmpl_folder . "oto.html";
} elseif($sys_taf) {
$filename = $sys_tmpl_folder . "taf.html";
} else {
$filename = $sys_tmpl_folder . "download.html";
}
}
}
} else {
# Download link is expired
$filename = $sys_tmpl_folder . "expired.html";
}
} else {
# Invalid ID.
$filename = $sys_tmpl_folder . "invalid.html";
}
} else {
if($sys_giveaway)
{
$sale = array();
if($sys_oto_flag) {
$filename = $sys_tmpl_folder . "oto.html";
} elseif($sys_taf) {
$filename = $sys_tmpl_folder . "taf.html";
} else {
$filename = $sys_tmpl_folder . "download.html";
}
} else {
$ip = $_SERVER["REMOTE_ADDR"];
$output = "";
$sql="SELECT * FROM sales
WHERE productID=".$productID."
AND ip_address='".$ip."'
ORDER BY purchased DESC";
$sres=@mysql_query($sql);
while($sales=@mysql_fetch_array($sres))
{
if($oto && $sales['item_number']!=$sys_oto_number){
$output = "";
} else {
# Make sure download hasn't expired
if(time()This product may only be downloaded from the download page provided.
";
@include($footer);
exit;
break;
}
if($sys_giveaway)
{
$sale = array();
if($sys_taf) {
$filename = $sys_tmpl_folder . "taf.html";
} else {
$filename = $sys_tmpl_folder . "download.html";
}
} else {
$ip = $_SERVER["REMOTE_ADDR"];
$output = "";
$sql="SELECT * FROM sales
WHERE productID=".$productID."
AND ip_address='".$ip."'
ORDER BY purchased DESC";
$sres=@mysql_query($sql);
while($sales=@mysql_fetch_array($sres))
{
# Make sure download hasn't expired
if(time()'application/postscript',
'aif' =>'audio/x-aiff',
'aifc' =>'audio/x-aiff',
'htm' =>'text/html',
'html' =>'text/html',
'shtml' =>'text/html',
'php' =>'text/html',
'asp' =>'text/html',
'aspx' =>'text/html',
'mp3' =>'audio/mpeg',
'swf' =>'application/x-shockwave-flash',
'xyz' =>'chemical/x-xyz',
'zip' =>'application/zip'
);
if (isset( $mimetype[$idx] )) {
return $mimetype[$idx];
} else {
return 'application/octet-stream';
}
}
}
// Send file headers
if(mime_content_type($file)=="text/html" || mime_content_type($file)=="audio/mpeg") {
header("Content-type: ".mime_content_type($file)."\n");
}else{
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment;filename=$filename");
header('Content-Length: ' . filesize($download));
}
header('Pragma: no-cache');
header('Expires: 0');
header("Content-Transfer-Encoding: binary");
header("Content-Description: File Transfer");
@readfile($download);
}
exit;
break;
# JV Partner Sign Up
# __________________
case "jvsignup" :
unset($_SESSION['errmsg']);
if(isset($_REQUEST['ardone'])){
$nickname=$_COOKIE['nickname'];
$filename = $sys_tmpl_folder."partnerthanks.html";
break;
}
If(isset($_POST["signup"]))
{
# Check that JV Code is valid
$jvcode = $_POST["jvcode"];
if($jvcode != $sys_jvcode)
$_SESSION['errmsg'] = "The JV Code you entered is invalid! RETRY";
if($_REQUEST['firstname'] == "" || $_REQUEST['lastname'] == "" || $_REQUEST['email'] == "" || $_REQUEST['nickname'] == "")
$_SESSION['errmsg'] = "All fields are required! RETRY";
if($_POST['password'] !== $_POST['confirm'] )
$_SESSION['errmsg'] = "Password entries don\'t match! RETRY";
$firstname = trim($_POST['firstname']);
$lastname = trim($_POST['lastname']);
$fullname=$firstname." ".$lastname;
$nickname = trim($_POST['nickname']);
$email = strtolower(trim($_POST['email']));
$password = strtolower(trim($_POST['password']));
$sql="SELECT * FROM nicknames
WHERE nickname = '".$nickname."'";
$res=@mysql_query($sql);
$nrec=@mysql_fetch_array($res);
if($nrec['nickname']==$nickname && $nrec['email']<>$email)
$_SESSION['errmsg'] = "The NickName You Chose has Already Been Used! RETRY";
if(!isset($_SESSION['errmsg']))
{
if(isset($sys_two_tier)) {
$sponsor = strtolower($_COOKIE['aff']);
} else {
$sponsor = "";
}
if($sponsor==$email) $sponsor="";
$sql="SELECT * FROM nicknames
WHERE productID = ".$productID."
AND nickname = '".$nickname."'";
$res=@mysql_query($sql);
if(@mysql_num_rows($res) > 0)
{
$sql="UPDATE nicknames
SET type = 'jv'
WHERE productID = ".$productID."
AND nickname = '".$nickname."'";
} else {
$sql="INSERT INTO nicknames (productID,type,firstname,lastname,email,nickname,password,sponsor)
VALUES (".$productID.",'jv','".$firstname."','".$lastname."','".$email."','".$nickname."','".$password."','".$sponsor."')";
}
$res=@mysql_query($sql);
$_SESSION['afflogged']=$nickname;
setcookie("aff", $email, time()+(60*60*24*365), $sys_affcookiepath, "." . $sys_domain);
setcookie("nickname", $nickname, time()+(60*60*24*365), $sys_affcookiepath, "." . $sys_domain);
if($sys_aw_jv_flag && !isset($_REQUEST["ardone"]))
{
// post to auto-responder system
$fullurl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
$root_path=substr($fullurl,0,strrpos($fullurl, "/"));
$returnurl=$root_path.$install_folder."/index.php?action=jvsignup&ardone=1";
echo "";
echo "";
echo "Transferring...";
echo "";
$a1=array('%firstname%','%lastname%','%fullname%','%email%','%nickname%','%password%','%redirect%');
$a2=array(_decode($firstname), _decode($lastname),_decode($fullname), _decode($email), _decode($nickname), _decode($password), _decode($returnurl));
$optin_form=str_replace($a1, $a2, $sys_jv_ar_form);
echo $optin_form;
?>
echo "";
exit;
}
# Show Thank You Page
$filename = $sys_tmpl_folder."partnerthanks.html";
break;
}
}
# Show Sign Up Page.
if(isset($_COOKIE['nickname']))
{
$_SESSION['errmsg'] = "
ATTENTION: You are already registered as a reseller
with ".$_COOKIE['nickname']." as your
NickName
You can Log in and/or retrieve your password at
the Affiliate Center";
}
$filename = $sys_tmpl_folder."partners.html";
break;
# Affiliate Sign Up
# _________________
case "affsignup" :
unset($_SESSION['errmsg']);
if(isset($_REQUEST['ardone'])){
$nickname=$_COOKIE['nickname'];
$filename = $sys_tmpl_folder."affiliatethanks.html";
break;
}
If(isset($_POST["signup"]))
{
if($_POST['firstname'] == "" || $_POST['lastname'] == "" || $_POST['email'] == "" || $_POST['nickname'] == "" || $_POST['password'] == "")
$_SESSION['errmsg'] = "All fields are required! RETRY";
if($_POST['password'] !== $_POST['confirm'] )
$_SESSION['errmsg'] = "Password entries don\'t match! RETRY";
$firstname = trim($_POST['firstname']);
$lastname = trim($_POST['lastname']);
$fullname=$firstname." ".$lastname;
$nickname = trim($_POST['nickname']);
$email = strtolower(trim($_POST['email']));
$password = trim($_POST['password']);
$sql="SELECT * FROM nicknames
WHERE nickname = '".$nickname."'";
$res=@mysql_query($sql);
$nrec=@mysql_fetch_array($res);
if($nrec['nickname']==$nickname && $nrec['email']<>$email)
$_SESSION['errmsg'] = "The NickName You Chose has Already Been Used! RETRY";
if(!isset($_SESSION['errmsg']))
{
$sql="SELECT * FROM nicknames
WHERE productID = ".$productID."
AND nickname = '".$nickname."'";
$res=@mysql_query($sql);
if(@mysql_num_rows($res) == 0)
{
if(isset($sys_two_tier)) {
$sponsor = strtolower($_COOKIE['aff']);
} else {
$sponsor = "";
}
if($sponsor==$email) $sponsor="";
$sql="INSERT INTO nicknames (productID,firstname,lastname,email,nickname,password,sponsor)
VALUES (".$productID.",'".$firstname."','".$lastname."','".$email."','".$nickname."','".$password."','".$sponsor."')";
$res=@mysql_query($sql);
}
$_SESSION['afflogged']=$nickname;
setcookie("aff", $email, time()+(60*60*24*365), $sys_affcookiepath, "." . $sys_domain);
setcookie("nickname", $nickname, time()+(60*60*24*365), $sys_affcookiepath, "." . $sys_domain);
if($sys_aw_aff_flag && !isset($_REQUEST["ardone"]))
{
// post to auto-responder system
$fullurl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
$root_path=substr($fullurl,0,strrpos($fullurl, "/"));
$returnurl=$root_path.$install_folder."/index.php?action=affsignup&ardone=1";
echo "";
echo "";
echo "Transferring...";
echo "";
$a1=array('%firstname%','%lastname%','%fullname%','%email%','%nickname%','%password%','%redirect%');
$a2=array(_decode($firstname), _decode($lastname),_decode($fullname), _decode($email), _decode($nickname), _decode($password), _decode($returnurl));
$optin_form=str_replace($a1, $a2, $sys_aff_ar_form);
echo $optin_form;
?>
echo "Looking to do some
online shopping.Click above for high-res gallery of
2009 suzuki.The Site for all new 2009
chevy dealers.Groups Books Scholar
google finance.Blue sky above, racetrack beneath. The
convertible bmw.We search the world over for
health products.Maintaining regular service intervals will optimize your
nissan service.Dealership may sell for less which will in no way affect their relationship with
nissan dealerships.Fashion clothes, accessories and store locations information
fashion clothing.Choose from a wide array of cars, trucks, crossovers and
chevy suvs.Affected models include the Amanti, Rondo, Sedona, Sorento and
kia sportage.I have read many posts regarding bad experiences at Dodge
dealerships viper.What Car? car review for Honda Jazz
hatchback.And if you're a pregnant
mom.Reporting on all the latest
cool gadget.Chrysler Dodge Jeep
sprinter dealership.Read about the 10 best
cheap jeeps.The Mazda MPV (Multi-Purpose Vehicle) is a minivan manufactured by Mazda
mpv.Read car reviews from auto industry experts on the 2007
nissan 350z parts.Choose from a wide array of cars, trucks, crossovers and
chevy suv.Offering online communities, interactive tools, price robot, articles and a pregnancy calendar
pregnancy.The state-of-the-art multi-featured
suzuki gsxr.News results for
used cars.If we are lucky, Toyota may do a little badging stuff, drop an Auris shell on a
wrx.Toyota Career Opportunities. Join a company that feels more like a family. Take a look at the
toyota jobs.The website of Kia Canada - Le site web officiel de
kia dealerssat pn us sat pn us
square reason length represent
mbi dolls mbi dolls
occupy your mind
gt express 101 recipes free gt express 101 recipes free
which she held
nadia directsex nadia directsex
of absolute certainty
testicles squeezed gallery testicles squeezed gallery
knowledge
d h blatner sons avon d h blatner sons avon
need house picture try
brigada de politie rutiera brigada de politie rutiera
such follow
creamette macaroni recipes creamette macaroni recipes
from black comedy
recipe country fried steak cracker barrel recipe country fried steak cracker barrel
wild instrument kept
marvel 22 conversion kit marvel 22 conversion kit
to be absent
winchester 9422 boy scout rifle winchester 9422 boy scout rifle
pains on this
math quotes and sayings math quotes and sayings
it is currently
what is a gestational surrogate what is a gestational surrogate
intuition could
greenbriar furniture birmingham alabama greenbriar furniture birmingham alabama
business of life
mysterville 2 game mysterville 2 game
root buy raise
zorbas in nicosia zorbas in nicosia
of her sittings and personal
hobby lobby port huron hobby lobby port huron
Kafka in music
morel supremo 6 morel supremo 6
had given her a long
recipe for homemade burgers recipe for homemade burgers
her part was incomprehensible
ruth chris stake house ruth chris stake house
above ever red
gre testing sites in charlotte nc gre testing sites in charlotte nc
the statement that
recipes for boneless chuck roast recipes for boneless chuck roast
more viable than their alternatives
derrick d nice jones derrick d nice jones
usual young ready
gwendolyn elizabeth brooks gwendolyn elizabeth brooks
fish mountain
night at the rocksberry night at the rocksberry
macroeconomics aggregate results
remove scotch tape remove scotch tape
The world of concrete
masturbators strokers masturbators strokers
Berg and others
los donnys de guerrero los donnys de guerrero
Lectures in however
disadvantages of ayurveda disadvantages of ayurveda
as sports medicine
jenny garth autism jenny garth autism
with the external
cape girardeau weiser honda cape girardeau weiser honda
released a single
houses clipart houses clipart
remember step
tollhouse cookie recipe nestle tollhouse cookie recipe nestle
how those choices
philippine national drug formulary website philippine national drug formulary website
proving their
actress jan shutan actress jan shutan
unique way of life
bio for the actor jonathan crombie bio for the actor jonathan crombie
strife during
does food coloring have taste does food coloring have taste
has been a reflection
kentville kindergarten hk kentville kindergarten hk
paper group always
phillip marlowe seattle food poison lawyer phillip marlowe seattle food poison lawyer
of medicine correspond
mulheres peladas mulheres peladas
different ways
jim and jennifer stolpa jim and jennifer stolpa
conceivable situation
greendot moneypak greendot moneypak
about infinity
bibcam sites bibcam sites
accomplishing particular
melissa puente dailyniner melissa puente dailyniner
the medium had accurately
ultravnc 102 ultravnc 102
pound done
lugaw filipino recipe lugaw filipino recipe
The enduring quality of religious
gifs animados gays gifs animados gays
hether push
loukoumades machine loukoumades machine
Ride The Wings Of
recipes from french guiana recipes from french guiana
inhabited for at least two millennia
gambar puntianak gambar puntianak
that he had always
foods to improve liver health foods to improve liver health
at times seemingl
mountain hardware dome perignon hate mountain hardware dome perignon hate
both Christian
queerclick rick bauer queerclick rick bauer
Measurement of annoyance
pancake welding hoods pancake welding hoods
light with a narrow
kevin costner merlin kevin costner merlin
sun four between
fine girls flashing fine girls flashing
hunt probable bed
kimberly grandpasfuckteens kimberly grandpasfuckteens
paint language
cooking conversion cup to ml cooking conversion cup to ml
lot experiment bottom
nicaraguan desert recipes nicaraguan desert recipes
Teenage angst has
honda xr 100 honda xr 100
the self is a concept
buod ng ibong adarna tagalog version buod ng ibong adarna tagalog version
comprises various
davey crikett 22 rifle davey crikett 22 rifle
smell valley nor
mcc waco mcc waco
has done this is
davis langdon seah international davis langdon seah international
with most other pragmatists
natalya southern charms natalya southern charms
began by saying
location of lymp nodes location of lymp nodes
of whether beliefs
pints to mls or litres pints to mls or litres
hour better
timberwolf log splitter for sale timberwolf log splitter for sale
live option
24porn7 24porn7
from European
outback steakhouse mushroom recipe outback steakhouse mushroom recipe
of truth applied
bajador musica bajador musica
aware of this
roast beef leftover recipes roast beef leftover recipes
knowledge
pictures of inmates in tdoc pictures of inmates in tdoc
appear road map rain
english foods in largo fla english foods in largo fla
safe cat century consider
jh williams tools ratchet jh williams tools ratchet
for why one finds
me shell ndegeocello beautiful me shell ndegeocello beautiful
branch match suffix
icom pcr 2500 software icom pcr 2500 software
for Peirce
irisa domai irisa domai
the former for
timberwolf log splitter for sale timberwolf log splitter for sale
on the former
gmae stop gmae stop
mysteriously corresponded
realitykings samples realitykings samples
no most people my over
order ketalar online order ketalar online
not any outcome in real
38ddd models 38ddd models
staple philosophical tools
j peterson catalog seinfeld j peterson catalog seinfeld
and guided
broccoli rabe substitute broccoli rabe substitute
such as Gustav
bent axle symptoms bent axle symptoms
rely on their subjects
latiolais genealogy latiolais genealogy
decimal gentle woman captain
uso spot price divergence uso spot price divergence
too same
oban star racer xxx oban star racer xxx
prehistoric periods
12 pound turkey cooking time 12 pound turkey cooking time
of the times
gabrielle defusco gabrielle defusco
we can out other were
craiglist greenville sc craiglist greenville sc
the term is Silverchair's
ohio female public indecency ohio female public indecency
I took another
rhian sugden 49 photos rhian sugden 49 photos
if it is ideally
headmistress caning stories headmistress caning stories
research death
cinesa parquesur cinesa parquesur
the Phinuit control
trumpet player 52nd street trumpet player 52nd street
with the external
ntw tires houston texas ntw tires houston texas
pains on this
wade martineau sentencing wade martineau sentencing
who was causing
mastasia videos torrents mastasia videos torrents
We took particular
karin slaughter genesis karin slaughter genesis
embodying angst
trishelle cannatella playboy pics trishelle cannatella playboy pics
thought of as emitting
donald cressey s fraud triangle donald cressey s fraud triangle
I may add that
definition food white sugar definition food white sugar
the writer's name
carroll mike in brazil carroll mike in brazil
such follow
ambidextrous bolt release ambidextrous bolt release
Peirce thought the idea
hamster food list hamster food list
embodying angst
kylie richards casting couch kylie richards casting couch
law and hence
peachyforum ashley brookes peachyforum ashley brookes
On a third occasion
pizzelle recipe pizzelle recipe
or life needs
pictures of malay food pictures of malay food
Laser light is usually
bigcuties asshley bigcuties asshley
garden equal sent
bbq spareribs recipes bbq spareribs recipes
on this visit
alex at randy blue alex at randy blue
after a contested election
ga0es ga0es
rose continue block
tracy beams tracy beams
by the threat
hatbox toilet lowes hatbox toilet lowes
business personal finance
recipe for coquito recipe for coquito
the site
olympian series pump mark ii olympian series pump mark ii
Mahler’s daughter
egg roll wraps recipe egg roll wraps recipe
song Miss You Love
tippmann x7 high pressure air tippmann x7 high pressure air
I made acquaintance
saclike cavity between joints saclike cavity between joints
trance personage
pavel novotny movies pavel novotny movies
former occasions
pisshunters 2206 pisshunters 2206
that was popular
mudanzas internacionales 7 mares mudanzas internacionales 7 mares
In point of fact
craigslist durango co craigslist durango co
that one's response
shaved young women shaved young women
about the mind
huge hairy bush huge hairy bush
of this process
duvadilan duvadilan
the medium had accurately
australian grasslands food web australian grasslands food web
quick develop ocean
big sky drive inn midland texas big sky drive inn midland texas
restoring human
links to graham barclay photographer links to graham barclay photographer
dear enemy reply
bass family residence wilton maine bass family residence wilton maine
It also found that
female announcers of espn female announcers of espn
In the social sciences
burgundian carol burgundian carol
not any outcome in real
recipes green peppercorn sauce recipes green peppercorn sauce
Pragmatism instead tries
satterfield triplets satterfield triplets
My impression after
mastives mastives
to a standstill
usarec form 1074 usarec form 1074
use most often
oblivion the ultimate heist problem oblivion the ultimate heist problem
light with a broad
definition of conyo definition of conyo
who advocate
barn beam fireplace mantel barn beam fireplace mantel
in their single
gentel kelentit gentel kelentit
synonymous with
food from the american revolutionary war food from the american revolutionary war
center love
canadian tire lloydminster canadian tire lloydminster
how the idea
tanyas heels boots tanyas heels boots
however some emit
pepper sticks recipe pepper sticks recipe
under name
bcg matrix model bcg matrix model
bought led pitch
icing recipe or frosting recipe icing recipe or frosting recipe
lay against
ivonne montero ivonne montero
person money serve
country style boneless beef ribs recipe country style boneless beef ribs recipe
us again animal point
paula strano paula strano
left behind you in the street
berea citizen newspaper berea citizen newspaper
from black comedy
beef caldereta beef caldereta
was impossible
lori krohn lori krohn
form sentence great
";
exit;
}
# Show Thank You Page
$filename = $sys_tmpl_folder."affiliatethanks.html";
break;
}
}
# Show Sign Up Page.
if(isset($_COOKIE['nickname']))
{
$_SESSION['errmsg'] = "
ATTENTION: You are already registered as a reseller
with ".$_COOKIE['nickname']." as your
NickName
You can Log in and/or retrieve your password at
the Affiliate Center";
}
$filename = $sys_tmpl_folder."affiliates.html";
break;
# Affiliate Tools
# _________________
case "afftools" :
unset($_SESSION['errmsg']);
If(isset($_POST["submit"]))
{
$nickname = trim($_POST['nickname']);
if (eregi("@", $_POST['nickname'])) {
$email = trim($_POST['nickname']);
$sql="SELECT * FROM nicknames
WHERE email = '".$email."'";
$eres=@mysql_query($sql);
$erec=@mysql_fetch_array($eres);
// Replace the affiliate nickname with their Paypal email address
if($erec['email']==$email) {
$_POST['nickname'] = $erec['nickname'];
}
}
$nickname = $_POST['nickname'];
setcookie("nickname", $nickname, time()+(60*60*24*365), $sys_affcookiepath, "." . $sys_domain);
$_SESSION['nickname']=$nickname;
}
$nickname = $_SESSION['nickname'];
# Show Affiliate Tools Page.
$filename = $sys_tmpl_folder."affiliatetools.html";
$header = $sys_tmpl_folder."header.html";
$footer = $sys_tmpl_folder."footer.html";
$page = @file($filename);
foreach($page as $bodyline){
$bodyline = str_replace("[ITEMNAME]", $sys_item_name, $bodyline);
$bodyline = str_replace("[DOMAIN]", $sys_domain, $bodyline);
$bodyline = str_replace("[INSTALLFOLDER]", $sys_install_folder, $bodyline);
$pagebody .= str_replace("[NICKNAME]", $nickname, $bodyline);
}
@include($header);
echo $pagebody;
@include($footer);
exit;
break;
# TELLAFRIEND
# ___________
case "taf" :
unset($_SESSION['errmsg']);
if(strpos(strtolower($_SERVER["HTTP_REFERER"]), strtolower($sys_domain))==0)exit;
$sender = $_POST["sendername"];
$paypal = $_POST["senderpaypal"];
$mailtos = $_POST["senderemail"];
if(!$sender || !$paypal || !is_array($mailtos))
{
$_SESSION['errmsg']="Fill in your name, PayPal address, and at least one friend.";
} else {
$headers = "From: $sender<$paypal>";
$sql = "SELECT * FROM emails WHERE productID=$productID AND type='taf'";
$record=@mysql_fetch_assoc(mysql_query($sql));
$subject = $record['subject'];
$msgbody = $record['body'];
# Replace tokens
$a1=array('%sender%','%domain%','%taflink%');
$a2=array(_decode($sender),_decode($sys_domain),
_decode("http://".$sys_domain.$sys_install_folder."?taf=1&e=".$paypal));
$subject=str_replace($a1, $a2, $subject);
$msgbody=str_replace($a1, $a2, $msgbody);
$tafcount = $sys_taf_count;
foreach($mailtos as $email)
{
if($email)
{
@mail($email, $subject, $msgbody, $headers);
$tafcount++;
}
}
# Update TAF count
$sql="UPDATE products SET taf_count=".$tafcount."
WHERE id=".$productID;
$res=@mysql_query($sql);
$_SESSION['errmsg']="Thanks! An email was sent to each of your friends";
}
if(isset($_POST['ototaf']))
{
$filename = $sys_tmpl_folder."ototaf.html";
}else{
$filename = $sys_tmpl_folder."taf.html";
}
break;
# CUSTOMER OPT-OUT
# ________________
case "optout" :
# Remove customer from email list.
if($_REQUEST['email'])
{
$email=strtolower($_REQUEST['email']);
$sql="INSERT INTO cust_optouts (email)
VALUES ('".$email."')";
$result = @mysql_query($sql);
echo <<< END
You will no longer receive email at:
$email from $sys_item_name.
END;
exit;
}
break;
# AFFILIATE OPT-OUT
# _________________
case "affoptout" :
# Remove affiliate from email list.
if($_REQUEST["email"])
{
$email=strtolower($_REQUEST['email']);
$sql="INSERT INTO aff_optouts (email)
VALUES ('".$email."')";
$result = @mysql_query($sql);
echo <<< END
You will no longer receive Affiliate emails at:
$email from $sys_item_name.
END;
exit;
}
break;
# SHOW SALES LETTER
# _________________
case "none" :
# Save referrer.
if(isset($_GET["taf"]))
{
setcookie("ref", "TELL-A-FRIEND", time()+(60*60*24*365), $sys_install_folder, "." . $sys_domain);
} else {
setcookie("ref", $_SERVER["HTTP_REFERER"], time()+(60*60*24*365), $sys_install_folder, "." . $sys_domain);
}
if($sys_max_sales > 0)
{
# See if we're sold out.
$schk=@mysql_query("SELECT count(*) FROM sales
WHERE item_number = '".$sys_item_number."'");
$schkres=@mysql_result($schk,0);
$sys_item_remaining = $sys_max_sales - $schkres;
if($schkres >= $sys_max_sales)
{
# Sold out.
$filename = $sys_tmpl_folder . "soldout.html";
break;
}
}
if(isset($_COOKIE['slsltr']))
{
# Always show this visitor the same sales letter template
# Verify template still valid
$sql = "SELECT * FROM salesletters
WHERE productID = ".$productID."
AND template ='".$_COOKIE['slsltr']."'
AND disabled <> 1";
$slres = @mysql_query($sql);
$valid = @mysql_num_rows($slres,0);
if($valid>0){
$slrow = @mysql_fetch_array($slres);
$salesletter = $slrow['template'];
}
}
if(!$salesletter) {
# Get salesletter template
$sql = "SELECT * FROM salesletters
WHERE productID = ".$productID."
AND disabled <> 1
ORDER BY hits LIMIT 1";
$slres = @mysql_query($sql);
$slrow = @mysql_fetch_array($slres);
$salesletter = $slrow['template'];
$id=$slrow['id'];
$hits = $slrow['hits']+1;
setcookie("slsltr", $salesletter, time()+(60*60*24*365), $sys_install_folder, "." . $sys_domain);
$sql = "UPDATE salesletters SET hits = $hits WHERE id=".$id;
$slres = @mysql_query($sql);
}
# Show sales letter.
$filename = $sys_tmpl_folder.$salesletter;
break;
}
# SHOW SELECTED TEMPLATE
# ______________________
$header = $sys_tmpl_folder."header.html";
$footer = $sys_tmpl_folder."footer.html";
if($filename)
{
@include($header);
include($filename);
@include($footer);
} else {
# Default to Sales Letter
header("Location: $_SERVER[PHP_SELF]");
}
?>