Sindbad~EG File Manager

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

<?php  // this page will receive the response from the payment gateway when the transaction is successful.
//  version number updated to 4.20 9.7.12
//  version number changed to 4.26 on 9.25.12 so Grapher serial numbers will be generated properly.
session_start();
 
$OrderID = $_SESSION['OrderID'];
if(is_null($OrderID))
   {  
      header("Location: index.php");  // do not pass Go, do not collect $200
   }
require_once("GetSerialNumber.php");
require_once('DB.php');
require_once('query.php');
require_once('queryWebGrades.php');
// 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")
   {  exit();  // we didn't come from PaymentInfo.php, or it would have been authorized.  Also we get here if user refreshes the page
   }
 
// 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];
      $VersionNumber = 510;   // sorry for hard-coding it
      if($ProductIDs[$nitems] >= 4 && $ProductIDs[$nitems] <= 6)  // it's a lab edition
          ++$VersionNumber;    // lab editions get odd version numbers
      $ProductNames[$nitems] = $row2[1];
	  // in the database the order of products is Calc, Precalc, Algebra, Lab Calc, Lab Precalc, Lab Algebra, CallHome Calc, Precalc, Alg, and finally Grapher
      $quantities[$nitems] = $row2[2];
	  if($row2[0] == 1 || $row2[0] == 4 || $row2[0] == 7)  // normal, lab, and one-semester Calculus
	    {  $WhichDisks[$nitems] =  7;
           $_SESSION['WhichDisk'] = "7";
		}
	  else if ($row2[0] == 2 || $row2[0] == 5 || $row2[0] == 8)  // normal, lab, and one-semester Precalculus
	    {  $WhichDisks[$nitems] = 3;
         //  if(strcmp($_SESSION['WhichDisk'],"7"))
                $_SESSION['WhichDisk'] = "3";
		}
	  else if($row2[0] == 3 || $row2[0] == 6 || $row2[0] == 9) // normal, lab, and one-semester Algebra
	    { $WhichDisks[$nitems] = 1;
        //  if(strcmp($_SESSION['WhichDisk'],"7") && strcmp($_SESSION['WhichDisk'],"3"))
                $_SESSION['WhichDisk'] = "1";
		}
	  else if($row2[0] == 10)
	    { $WhichDisks[$nitems] = 0;   // Grapher
		//  if(strcmp($_SESSION['WhichDisk'],"7") && strcmp($_SESSION['WhichDisk'],"3") && strcmp($_SESSION['WhichDisk'],"1"))
		       $_SESSION['WhichDisk'] = "0";
		}
     if(isset($_SESSION['TimeLimit']))
	    $days = $_SESSION['TimeLimit'];
	 else 
	    $days = 0;
     $SerialNumbers[$nitems] = getSerialNumber($WhichDisks[$nitems], $VersionNumber, $days);  // 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	 
 
 
	  if( 7<= $ProductIDs[$nitems] && $ProductIDs[$nitems] <= 9)  // it's a time-limited (one-semester) edition
		      {  $_SESSION['TimeLimit'] = 153;  // five months  
			  }
		   else 
		      {  $_SESSION['TimeLimit'] = 0;
			  }
	  ++$nitems;
    }
if($nitems >= 1)
    {
     $_SESSION['OK'] = "ok";
     $_SESSION['ProductType'] = "paid";
    }
if($nitems == 1)
   { $SerialNumber = $SerialNumbers[0];
   }	
 	
    // Next send the customer a confirming email
	 $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)
	    { $ProductName = $ProductNames[0];
          $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";
			 }
	    }
	 
     if($_SESSION['TimeLimit'] > 0  && $nitems==1)
	    { 
		  $message = $message . "\nClick www.helpwithmath.com/DeliverTimeLimited.php?CustomerID=$CustomerID&ProductID=$ProductIDs[0] to download your time-limited copy of $ProductName.\n";
		  $message = $message . "\nIf your browser is Safari, you may not get immediate visual feedback, but your file will be downloading anyway.  Look in your Downloads folder\n";
		}	
     $message = $message . "\nPlease do not reply to this email.  If you need to contact us, use this email address:\n\n" .
	            "contactHelpWithMath@gmail.com\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";
	 if(isset($_SESSION['ReferringPage']))
	    $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("contactHelpWithMath@gmail.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);" onLoad="javascript:__utmSetTrans()"> 

<!--Now get rid of the session variables CustomerID and OrderID,  in case the  
    customer wants to place another order in this same session.  A new OrderID is 
    created in Order.php only for a new customer. -->
<?php 
   unset($_SESSION['CustomerID']);
   unset($_SEESION['OrderID']);
?>
<?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>
 
	<?php
	      if($_SESSION['TimeLimit'] == 0)
		     { if($nitems == 1) 
	              { echo "<h3>Your serial number is shown below. </h3>";
			      }
      	       else
		          { echo "<h3>Your serial numbers are shown below.</h3>";
			      }
			  }
		  else
		     { echo "<h3>Your serial number and a download link have been mailed to $to. </h3>";
			 }
		   
	?>
        <p>You will <span style="font-style: italic">not</span><span style=""> need a </span> serial number when installing MathXpert by download. Your serial number serves as your proof of purchase. If in the future you get a new computer, or a new hard disk, and wish to re-download MathXpert, you can do so using your serial number. You will also receive an automatically-generated email with your serial number (it's probably already in your in-box or your spam-box--don't forget to look in both places).  </p>
<?php 
   if($_SESSION['NeedCD'])
     {  echo "NeedCD is true\n";
	 ?>
        <p> If  you chose to purchase a CD, we will ship it on the next business day at the latest.   Whether or not you
	   chose to have a CD shipped,  you can download MathXpert now by clicking the button below. </p>
	    <p>At the present time, the CD contains a version of MathXpert that <span style="font-style: italic">will </span><span style="">require the serial number to install, and is not &quot;digitally signed&quot;, so users of Vista may see an annoying &quot;security warning&quot; when it starts. Users of Vista should download rather than use a CD, and so should customers who purchased a lab version and intend to severely restrict student permissions. The capabilities of MathXpert itself are the same on the CD and by download. If you do install from the CD, please cut and paste the three pieces of the serial number to avoid transcription errors. </span></p>
 <?php } 
 if($_SESSION['TimeLimit'] == 0)   // not a time-limited version, they can download from here
   { ?> 
<form action="Install/SaveOrRun4.php" 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="300"> <input size="22" 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="300"> <?php echo $ProductNames[$i] ?> </td>
                     <td width="300"> <input size="22" type="text" name=<?php echo "SerialNumber".$i ?> value=<?php echo $SerialNumbers[$i] ?>></td>
                 </tr>
     <?php } 
	  }?>
   </table>   
   <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.
   </p>
   <p> 
		<input type="submit" name="Submit32" value="Download Now For 32-bit Windows">   
		<input type="submit" name="Submit64" value="Download Now For 64-bit Windows">   
    <!-- <input type="submit" name="SubmitMac" value = "Download Now for Mac OS X">    -->
		</p>
   </form>
   <?php 
      }
	?>
	
	<p> If you plan to run MathXpert on a Mac under a Windows simulator such as Parallels, Bootcamp, or WINE,
	choose 64-bit. </p>
 
	<p> To find out if your computer is running a 32-bit or 64-bit version of Windows: </p>

<p> If you are running Windows 7 or Windows Vista: <br>
 Click Start, right-click Computer, and then click Properties.
Under System, you can view the system type. </p>

<p> If you are running Windows XP: <br>
Click Start, right-click My Computer, and then click Properties.
If "x64 Edition" is listed under System, you're running the 64-bit version of Windows XP.
If you don't see "x64 Edition" listed, then you're running the 32-bit version of Windows XP.
	</p>

 </div>   
<?php include ('include/footer.php'); 
?>
</body>
</html>

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