<?php
// Start of Main Logic ::: Get data from Payment Processor // 
// -------------------------------------------------------//
$cbreceipt  = $_REQUEST['cbreceipt'];   $time =$_REQUEST['time'];
$item       = $_REQUEST['item'];        $cbpop=$_REQUEST['cbpop'];
$czip       = $_REQUEST['czip'];          $country=$_REQUEST['ccountry']; 
$cemail     = $_REQUEST['cemail'];      $level = $_REQUEST[level];  //eg $level=5; <-- via query_str

$cname      = stripslashes(str_replace("'","",$_REQUEST[cname]));
list($fname,$lname) = explode(" ",$cname);    
$subtype = "customer";
$key=intval($item);  

// Basic Check //
// ------------//
if($cbreceipt=="" || $key=="" || $cemail=="") {
 $errmsg1 = "<center><h2>Oops ... unable to locate the thankyou page!</h2></center>
 rcpt: $cbreceipt | KEY: $key | Email: $cemail<BR />If you want to test, please do a 
 <font color=red>test purchase</font>by consulting DigiResult's Staging Server - http://staging.digiresults.com/";
 $err_flag1=1;
}
// CB POP validation //
// -----------------//
$cbseed = $subm_mbrs[skey];
$digiseed = $subm_mbrs[drkey];

//if($cbseed!="") {  // $cbseed = ClickBank Secret Key
if($digiseed!="") {  // $cbseed = ClickBank Secret Key
  $rcpt=$_REQUEST['cbreceipt']; $time=$_REQUEST['time'];
  $item=$_REQUEST['item'];      $cbpop=$_REQUEST['cbpop'];

  $xxpop=sha1("$digiseed|$rcpt|$time|$item");
  $xxpop=strtoupper(substr($xxpop,0,8));

  if ($cbpop==$xxpop) { $cbvldEflag=1; }
  
  if( !$cbvldEflag )  {  // INVALID PURCHASE - POP failed //
      $errmsg2 = "<h2>System Error - $cbvldEflag</h2><P> Please contact the site owner
      with your Clickbank Receipt (<font color=red>$cbreceipt</font>) for assistance. 
      <P>We apologize for the inconvenience. <P>&nbsp;</P>";        $err_flag2=1;      
    }
}
?>