Sindbad~EG File Manager
<?php
// This page enables the user to download a time-limited version of MathXpert from an emailed download link.
if(!isset($_GET['CustomerID']) || !isset($_GET['ProductID']))
{ header("Location: ./index.php");
// redirect to main web page
}
require_once('DB.php');
require_once('query.php');
require_once('queryWebGrades.php');
require_once('dates.php');
session_start();
$CustomerID = $_GET['CustomerID'];
$ProductID = $_GET['ProductID'];
if($ProductID == 7)
$_SESSION['WhichDisk'] = 7;
else if($ProductID==8)
$_SESSION['WhichDisk'] = 3;
else
$_SESSION['WhichDisk'] = 1;
$_SESSION['OK'] = "ok";
$_SESSION['ProductType'] = "paid";
$days = 153;
$_SESSION['TimeLimit'] = $days;
// next fetch the product name from the database using $ProductID
$sql = "SELECT ProductName FROM `Products` WHERE ProductID='$ProductID';";
$result = query($sql);
$result->fetchInto($r);
$ProductName = $r[0];
// next fetch the email address from the database
$sql = "SELECT Email FROM `Customers` WHERE CustomerID='$CustomerID';";
$result = query($sql);
$result->fetchInto($r);
$Email = $r[0];
$found = false;
// see if this email is already in the WebGrades database
$sql = "SELECT StudentNumber FROM `Students` WHERE Email='$Email';";
$results = queryWebGrades($sql);
if($results!= NULL)
{ $results->fetchInto($r);
if($r != NULL)
{ $StudentNumber = $r[0];
$found = true;
}
}
if($found == false)
{ // enter this new student
$sql = "INSERT INTO `Students` (Email,FirstName,LastName) VALUES('$Email','','');";
queryWebGrades($sql); // store the new record
// Now we need to bear in mind that when a student registers for WebGrades, his email might already be there with empty name strings.
}
$deleted = false;
if($Email=="beesonpublic@gmail.com")
{ // remove old entry from Expiration table
$sql = "DELETE FROM `Expiration` WHERE StudentID='$StudentNumber' AND ProductID='$ProductID';";
queryWebGrades($sql);
$deleted = true;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<?php include ('include/head.php');
// compute the expiration date, which will be $days days from now
$today = getdate();
$months = $days/30; // so it will be 5 when days is 153
$ExpirationDatePHPArray = add_months($today, $months);
$ExpirationDateSQLFormat = SqlDate($ExpirationDatePHPArray);
// see if there's already an entry in the Expiration table for this student and product
$sql = "SELECT * FROM `Expiration` WHERE StudentID='$StudentNumber' AND ProductID='$ProductID';";
$result = queryWebGrades($sql);
$result->fetchInto($r);
if($r != NULL)
$todayflag = false; // don't touch the existing database entry entry. They can download again, but the expiration date won't change.
else
{ $sql = "INSERT INTO `Expiration` (StudentID, ProductID, ExpirationDate) VALUES('$StudentNumber', '$ProductID', '$ExpirationDateSQLFormat');";
queryWebGrades($sql);
$todayflag = true;
}
?>
<body onmousemove="closesubnav(event);">
<?php include ('include/body.php'); ?>
<div class="style1" id="pageName">
<p></p>
<h3> This page allows you to download your copy of <?php echo $ProductName ?>. </h3>
<body>
<p></p>
<form action="download4.php">
<input type="submit" name="Submit32" value="Download Now For 32-bit Windows">
<input type="submit" name="Submit64" value="Download Now For 64-bit Windows">
</form>
<p></p>
<p> This copy will expire on <?php echo format_date($ExpirationDatePHPArray) ?>, which is five months from
<?php if($todayflag)
echo "today.";
else
echo "the date of your first download. ";
?>
</p>
</div>
<table>
<tr><td width="40"></td> <td> Some browsers may not give any visible sign that the download is taking place (for example the Safari browser).</td> </tr>
<tr> <td width="40"></td><td> If it seems that nothing is happening after you click download, probably your file has downloaded or is downloading anyway. Check the folder where your browser puts its downloads. </td></tr>
<tr><td width="40"></td><td> To find out if your computer is running a 32-bit or 64-bit version of Windows:
<tr><td width="40"></td><td> 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.
<tr><td width="40"></td><td> 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.
</table>
<?php include ('include/footer.php'); ?>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists