GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/Software/ |
Upload File : |
<?php // ******************************************************************************************** // 11/2009 Sandy Sund // Main screen // Script is part of the Product Key program to give ability to checkout product key // if user is a admin they will have the ability to view available products, view reports,add new products // ProductKey.phpinc is called from index.php // ProcessData.php will be used to process data, ProductKeyOptions.php will be used to display. // ******************************************************************************************** require_once('../Connections/products.php'); // setup database if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } // Set user ID $valid_login='Y'; if (isset($_SESSION['userId']) && $_SESSION['userId'] != '') { $sess_ID = $_SESSION['userId'];} else { $sess_ID ='ERROR';} if (isset($_SESSION['userStudentId']) && $_SESSION['userStudentId'] != '') { $userID = $_SESSION['userStudentId'];} else { $userID ="ERROR"; $valid_login='N';} // get a recordset of all product data mysql_select_db($database_products, $products); $query_Recordset_product = "SELECT * FROM product"; $Recordset_product = mysql_query($query_Recordset_product, $products) or die(mysql_error()); $row_Recordset_product = mysqli_fetch_assoc($Recordset_product); $totalRows_Recordset_product = mysql_num_rows($Recordset_product); $maxRows_Recordset_Available = 1000; $pageNum_Recordset_Available = 0; if (isset($_GET['pageNum_Recordset_Available'])) { $pageNum_Recordset_Available = $_GET['pageNum_Recordset_Available']; } $startRow_Recordset_Available = $pageNum_Recordset_Available * $maxRows_Recordset_Available; // get a recordset of all product descriptions that are available for user to checkout mysql_select_db($database_products, $products); $query_Recordset_Available = " SELECT distinct(product.productDescription ) FROM product, productkey WHERE productkey.productkeyAvailable = 'Y'"; $query_limit_Recordset_Available = sprintf("%s LIMIT %d, %d", $query_Recordset_Available, $startRow_Recordset_Available, $maxRows_Recordset_Available); $Recordset_Available = mysql_query($query_limit_Recordset_Available, $products) or die(mysql_error()); $row_Recordset_Available = mysqli_fetch_assoc($Recordset_Available); if (isset($_GET['totalRows_Recordset_Available'])) { $totalRows_Recordset_Available = $_GET['totalRows_Recordset_Available']; } else { $all_Recordset_Available = mysql_query($query_Recordset_Available); $totalRows_Recordset_Available = mysql_num_rows($all_Recordset_Available); } $totalPages_Recordset_Available = ceil($totalRows_Recordset_Available/$maxRows_Recordset_Available)-1; // get a recordset of all user information from the user table $maxRows_Recordset_userInfo = 1000; $pageNum_Recordset_userInfo = 0; if (isset($_GET['pageNum_Recordset_userInfo'])) { $pageNum_Recordset_userInfo = $_GET['pageNum_Recordset_userInfo']; } $startRow_Recordset_userInfo = $pageNum_Recordset_userInfo * $maxRows_Recordset_userInfo; mysql_select_db($database_products, $products); $query_Recordset_userInfo = "SELECT `user`.userId, `user`.userFirstName, `user`.userLastName, `user`.userEmail FROM `user` WHERE `user`.userStudentId = '$userID'"; $query_limit_Recordset_userInfo = sprintf("%s LIMIT %d, %d", $query_Recordset_userInfo, $startRow_Recordset_userInfo, $maxRows_Recordset_userInfo); $Recordset_userInfo = mysql_query($query_limit_Recordset_userInfo, $products) or die(mysql_error()); $row_Recordset_userInfo = mysqli_fetch_assoc($Recordset_userInfo); $userName= $row_Recordset_userInfo['userFirstName']." ".$row_Recordset_userInfo['userLastName']; $userEmail= $row_Recordset_userInfo['userEmail']; if (isset($_GET['totalRows_Recordset_userInfo'])) { $totalRows_Recordset_userInfo = $_GET['totalRows_Recordset_userInfo']; } else { $all_Recordset_userInfo = mysql_query($query_Recordset_userInfo); $totalRows_Recordset_userInfo = mysql_num_rows($all_Recordset_userInfo); } $totalPages_Recordset_userInfo = ceil($totalRows_Recordset_userInfo/$maxRows_Recordset_userInfo)-1; // get records to show keys that where assigned to the current user that is logged in mysql_select_db($database_products, $products); $query_Recordset_AssignedKeys = "SELECT * FROM product JOIN productkey on product.productID = productkey.productID JOIN productlocation on productlocation.productkeyID =productkey.productkeyID WHERE productlocation.userStudentID = '$userID' ORDER BY productlocation.productlocationDateOut; "; $Recordset_AssignedKeys = mysql_query($query_Recordset_AssignedKeys, $products) or die(mysql_error()); $row_Recordset_AssignedKeys = mysqli_fetch_assoc($Recordset_AssignedKeys); $totalRows_Recordset_AssignedKeys = mysql_num_rows($Recordset_AssignedKeys); $valid_AssingedKeys = 'Y'; if ($totalRows_Recordset_AssignedKeys < 1) {$valid_AssingedKeys = 'N' ;} debugTrackBegin(); if (dc()) { echo basename(__FILE__)," line ",__LINE__,": ","<b>".__FILE__."</b><br>\n"; } if (!isset($courseNumber)) { $courseNumber =""; } $headTitle = '_CST_ - Assigned Product Keys'; $pageTitle = '<br>Product Keys'; include('common/pageHeader.phpinc'); $sectionTitle = $courseNumber."Product Key"; include('common/sectionHeader.phpinc'); // set default color for tables $color='#FEFDE9'; $color= rotate_colors($color); ?> <title>Product Key Options</title> <fieldset> <legend>Product Keys </legend> <!-- By students being able to check out there own product keys gives the ability to track where the keys are currently at. --> <?php if ($valid_login=='N') { echo "<p class='errorbold'> <br>*** Error Invalid User ID **** Please log in. <br> <p>"; } else // valid login { ?> Product keys that are currently assigned to: <?php echo "$userName / $userID " ; if ($totalRows_Recordset_AssignedKeys > 0) { ?> <table style="text-align:center;" align="center" cellpadding="1" cellspacing="2" border="0" > <tr> <td class="bold">Product Key Description </td> <td class="bold">Product Key </td> <td class="bold"> Check Out Date </td> <td> </td> </tr> <?php do { if (empty($row_Recordset_AssignedKeys['productlocationDateIn'])) { ?> <tr class="row_odd"> <td class="normal"><?php echo $row_Recordset_AssignedKeys['productDescription']; ?> </td> <td class="normal"><?php echo $row_Recordset_AssignedKeys['productkeyNumber']; ?> </td> <td class="normal"><?php echo $row_Recordset_AssignedKeys['productlocationDateOut']; ?></td> <td><form name='checkin' method="post" action='ProcessData.php' > <input type='submit' value='Check In' /> <input type="hidden" name="f_productkeyID" id="productkeyID" value= <?php echo $row_Recordset_AssignedKeys['productkeyID']; ?> /> <input type="hidden" name="f_productkeyNumber" id="productkeyNumber" value= <?php echo $row_Recordset_AssignedKeys['productkeyNumber']; ?> /> <input type="hidden" name="f_userID" id="userID" value=<?php echo $userID ?> /> <input type="hidden" name="f_option" id="option" value="Checkin"/> </form></td> </tr> <?php } // if not checked back in } while ($row_Recordset_AssignedKeys = mysqli_fetch_assoc($Recordset_AssignedKeys)); ?> </table> <?php } // if $totalRows_Recordset_AssignedKeys > 0 ?> <table style="text-align:center;" align="center" cellpadding="15" cellspacing="0" border="0" > <tr> <td width="50%"><form name='checkout' method="post" action='ProductKeyOptions.php' > <div align="center"> <input type="hidden" name="f_userID" id="userID" value=<?php echo $userID ?> /> <input type="hidden" name="f_option" id="option" value="Checkout"/> <input type='submit' value='Check Out Product Key' /> </div> </form></td> <td width="50%"><form name='resend' method="post" action='ProcessData.php' > <div align="center"> <input type="hidden" name="f_userID" id="userID" value=<?php echo $userID ?> /> <input type="hidden" name="f_option" id="option" value="Resend"/> <input type='submit' value='Resend / Email Checked Out Keys' /> </div> </form></td> </tr> <?php $admin='N'; if ($_SESSION['userPermissions']=="ADMIN") {$admin='Y';} if ($admin=='Y' or $admin=='N' ) // **** TAKE out N before going live { // show the rest ?> <tr><td colspan="2"> <span class="pageMessage"> *** If Admin show the stuff below(will show all for now for testing **) Admin = <?php echo $admin ?> </span></td> </tr> <tr> <!-- <td width="50%"> <form name='import' method="post" action='ProcessData.php'> <div align="center"> <input type="hidden" name="f_userID" id="userID" value=<?php echo $userID ?> /> <input type="hidden" name="f_option" id="option" value="Import"/> <input type='submit' value='Import Product Keys' /> </div> </form> </td>--> <td colspan="2"> <table><tr><td> <form name='location`' method="post" action='ProductKeyOptions.php' > <div align="center"> <input type="hidden" name="f_userID" id="userID" value=<?php echo $userID ?> /> <input type="hidden" name="f_option" id="option" value="Report_On_Checked_Out_Keys"/> <input type='submit' value='Location of Checked Out Keys' /> </div> </form> </td> <td> <form name='location1' method="post" action='ProductKeyOptions.php' > <div align="center"> <input type="hidden" name="f_userID" id="userID" value=<?php echo $userID ?> /> <input type="hidden" name="f_option" id="option" value="Report_On_All_Keys"/> <input type='submit' value='All Keys' /> </div> </form> </td> <td> <form name='location2' method="post" action='ProductKeyOptions.php' > <div align="center"> <input type="hidden" name="f_userID" id="userID" value=<?php echo $userID ?> /> <input type="hidden" name="f_option" id="option" value="Report_On_Checked_In_Keys"/> <input type='submit' value='Keys Checked Back In' /> </div> </form> </td> </tr> </table> </td> </tr> <tr> <td> <p align="center" class="classDate">Keys Available for: </p> <div align="center"> <table border="1" cellpadding="1" cellspacing="1"> <?php $color='#FEFDE9'; $color= rotate_colors($color); do { $color= rotate_colors($color); ?> <tr bgcolor ='<?php echo $color ?>'> <td class="normal"><?php echo $row_Recordset_Available['productDescription']; ?></td> </tr> <?php } while ($row_Recordset_Available = mysqli_fetch_assoc($Recordset_Available)); ?> </table> </div></td> <td> <p align="center" class="classDate">Add New Product Key </p> <!-- $option='Add'; ?> --> <form name='add' method="post" action='ProcessData.php' > <div align="center"> <input type="hidden" name="f_userID" id="userID" value=<?php echo $userID ?> /> <input type="hidden" name="f_option" id="option" value="Add"/> <?php $add_form= add_productkey_form(); echo $add_form; ?> </div> </form></td> </tr> <?php } // end if ADMIN ?> </table> <?php } // end if valid user name ?> </fieldset> <? include('common/sectionFooter.phpinc'); include('common/pageFooter.phpinc'); // ******************************************************************************************** // ** If admin show the option of inserting a new product w/key // ******************************************************************************************** function add_productkey_form() { $add_form=" <table align='center'> <tr > <td nowrap='nowrap' align='right' class='normal'> Description: </td> <td class='normal'><input name='f_productDescription' type='text' class='normal' value='' size='42' /></td> </tr> <tr> <td nowrap='nowrap' align='right' class='normal'>Product Key:</td> <td class='normal'><input type='text' name='f_productkeyNumber' value='' size='42' /></td> </tr> <tr> <td nowrap='nowrap' align='right' class='normal'>Mulit Use Key :</td> <td class='normal'><select name='f_mulitUse' id='mulitUse' > <option value='N' selected='selected'>N</option> <option value='Y'>Y</option> </select> </td> </tr> <tr > <td nowrap='nowrap' align='right'> </td> <td class='normal'><input type='submit' value='Add Key' /></td> </tr> </table> "; return $add_form; } // ******************************************************************************************** // ** Rotate colors for table rows // ******************************************************************************************** function rotate_colors($color) { if($color=='#FEFDE9' ) $color='#EDEDED'; else $color='#FEFDE9'; return $color; } ?> <?php mysql_free_result($Recordset_product); mysql_free_result($Recordset_Available); mysql_free_result($Recordset_userInfo); mysql_free_result($Recordset_AssignedKeys); ?>