Sindbad~EG File Manager

Current Path : /usr/home/beeson/public_html/helpwithmath_old/italian/italian/
Upload File :
Current File : /usr/home/beeson/public_html/helpwithmath_old/italian/italian/AfterTransaction.php

<?php  // this page will receive the response from the payment gateway when the transaction is successful.
session_start();
require_once("GetSerialNumber.php");
require_once('DB.php');
require_once('query.php');
$OrderID = $_SESSION['OrderID'];
if(is_null($OrderID))
   { header("Location: index.php");  // do not pass Go, do not collect $200
   }
// First, get the CustomerID
$sql = "SELECT CustomerID, Status FROM Orders WHERE OrderID='$OrderID';";
$q = Query($sql);
$q->fetchInto($row);
$CustomerID = $row[0];
$OrderStatus = $row[1];
if($OrderStatus != "authorized")
   { header("Location: purchase.php");  // we didn't come from PaymentInfo.php, or it would have been authorized.
   }
// Maybe we got here as a result of a "Refresh".  In that case don't generate a new serial number:
$sql = "SELECT SerialNumber FROM Registered WHERE CustomerID='$CustomerID';";
$qr = Query($sql);
$qr->fetchInto($rowreg);
$RegisteredFlag = $qr->nrows == 0 ? false : true;
// if $RegisteredFlag is false, that means this is the first time on this page for this CustomerID  
// What product(s) did this customer order?  
$sql = "SELECT Products.ProductID, ProductName, Quantity FROM `Order Details`,Products WHERE OrderID='$OrderID' AND `Order Details`.ProductID=Products.ProductID;";
$q = Query($sql); 
$nitems = 0;
while($q->fetchInto($row2))
    { $ProductIDs[$nitems] = $row2[0];
      $ProductNames[$nitems] = $row2[1];
      $quantities[$nitems] = $row2[2];
	  if($row2[0] == 1 || $row2[0] == 4)
	    {  $WhichDisks[$nitems] =  7;
		}
	  else if ($row2[0] == 2 || $row2[0] == 5) 
	    {  $WhichDisks[$nitems] = 3;
		}
	  else
	    { $WhichDisks[$nitems] = 1;
		}
	  if($RegisteredFlag)
	     {  $SerialNumbers[$nitems] = $rowreg[0];
		 }
	  else
         { $SerialNumbers[$nitems] = getSerialNumber($WhichDisks[$nitems]);  // generate a new serial number	 
	       $SerialNumber = $SerialNumbers[$nitems];
	       $sql = "INSERT INTO Registered (SerialNumber,CustomerID) VALUES('$SerialNumber','$CustomerID');";
	       Query($sql);  // register the serial number to this customer	 
		 }
	  ++$nitems;
    }
if($nitems == 1)
   { $SerialNumber = $SerialNumbers[0];
   }	
if($RegisteredFlag == false)	
   { // Next send the customer a confirming email--one time only.
	 $from = "sales@HelpWithMath.com";
	 $sql = "SELECT Email FROM Customers WHERE CustomerID='$CustomerID';";
	 $q = Query($sql);
	 $q->fetchInto($rows);
     $to = $rows[0];
	 $subject = "Your MathXpert serial number";
	 if($nitems == 1)
	    { $message = "Thank you for your purchase of $ProductName at www.HelpWithMath.com. " .
	           "For your records, here is the serial number ".
			   "that you were given at the website: " . $SerialNumber;
        }
	 else  // $nitems > 1  
	    { $message = "Thank you for your purchase of software at www.HelpWithMath.com. ".
		            "For your records, here are the serial numbers that you were given at the website: \n\n" ;
		  for($i=0; $i < $nitems; $i++)
		     { $message = $message . $ProductNames[$i] . "    " . $SerialNumbers[$i] . "\n";
			 }
	    }		
     mail("$to", "$subject", $message, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from");
	 // and send HelpWithMath an email including the referring page, so we can pay what we owe for click-throughs
	 $message = "The following sale was made to $to:\n\n";
	 $message = $message . "Referring page = " . $_SESSION['ReferringPage'] . "\n";	 
	 if($nitems == 1)
	    {  if($quantities[0] == 1)
		      $message = $message . "One copy of " . $ProductNames[0] . "\n";
	       else
		      $message = $message . " " . $quantities[0] . " copies of " . $ProductNames[0] . "\n";
		}
     else
	    { for($i=0; $i < $nitems; $i++)
		     { if($quantities[$i] == 1)
		         $message = $message . "One copy of " . $ProductNames[$i] . "\n";
	          else
		         $message = $message . " " . $quantities[$i] . " copies of " . $ProductNames[$i] . "\n";
	         }
	   }
	 mail("sales@HelpWithMath.com", "report of sale", $message, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from");      	  
   }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- DW6 -->
<?php 
include ('include/head.php'); 
?>
<body onmousemove="closesubnav(event);"> 
<?php include ('include/body.php'); ?>
  <div class="style1" id="pageName"> 
  <p></p>
  <h2> Your transaction has been approved.  Thank you for your business. </h2>
  <p>
    <h3>You will receive a confirming email from the credit card processor. </h3>
	<h3>Do not use your browser's back button.  </h3>
	<h3>Use the navigation bar buttons above if you want to continue browsing at Help With Math.</h3>
	<?php if($nitems == 1) 
	         { echo	"<h3>Your serial number is shown below. </h3>";
			 }
      	  else
		     { echo "<h3>Your serial numbers are shown below.</h3>";
			 }
	?>
        <p>You can use this serial number when installing MathXpert,  or you can use it to activate a trial version,  
	      if you installed one already.  You should cut and paste this serial number somewhere where you won't lose it.
		  Just in case, we will also send this serial number to you in an email.   You cannot install MathXpert without 
		  a serial number.     
	   </p>
	   <p>If you have already installed a trial version of MathXpert, all you need to do is activate it with this 
	   serial number.   If not, and you chose to purchase a CD, we intend to ship it within 24 hours.   Whether or not you
	   chose to have a CD shipped,  you can download MathXpert now by clicking the button below.  
	   </p>  
	   
	   <form action="Install/SaveOrRun.html" method="post" enctype="multipart/form-data" name="form1">
   <table width="500" border="0">
<?php if($nitems == 1) { ?>   
     <tr> 
	    <td width="250"> Copy and save this serial number:</td>
        <td width="250"> <input size="21" type="text" name="SerialNumber" value=<?php echo $SerialNumber ?>></td>
     </tr>	 
<?php  }
   else 
      { ?> <tr> <td width="250"> Copy and save these serial numbers:</td><td width="250">  </td></tr>
	    <?php for($i=0; $i<$nitems; $i++)
	       {  ?> <tr>
		             <td width="250"> <?php echo $ProductNames[$i] ?> </td>
                     <td width="250"> <input size="21" type="text" name=<?php echo "SerialNumber".$i ?> value=<?php echo $SerialNumbers[$i] ?>></td>
                 </tr>
     <?php } 
	  }?>
   </table>   
   <p>
		When you use a serial number to install MathXpert,  you will need to copy or paste the three pieces separately.
        That is the way InstallShield designed their installation software, so we will have to live with it,
        but I recommend pasting the three pieces individually rather than re-typing.
   </p>
   <p>  It is always a good idea to temporarily disable your antivirus software when installing software.  In particular,
        if you are running Norton Antivirus, you must at least turn off the "Autodetect" feature while installing MathXpert.
		(That problem initially affected two customers before we put this warning here.)  After that, we have had
		hundreds of successful installations, and only one customer who had installation difficulties,
		but if you should be the second, please contact us for help in resolving the problem.
   </p>
	  <p></p>
		<input type="submit" name="Submit" value="Download Now">         
		</p>
   </form>
	</p>
 </div>   
<?php include ('include/footer.php'); 
?>
</body>
</html>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists