<br/> <label>New Email Address:</label><br/> <input type="text" name="eAddress" /> <input type="submit" value="✓" name="submitEmail" /> </form> </div> <br/> <a id="displayOrderHistory" class="needsPointer">Order History</a> <p class="def">View previous orders and most frequent purchases for easy re-order.</p> <div id="orderHistory" class="hidden"> <?php $HTMLString = ""; if (isDatabaseConnected()) { $result = mysqli_query($link, sqlStatements("SELECT", "USER ORDERS")); $OrderFLAG = FALSE; while ($row = mysqli_fetch_array($result)) { $HTMLString .= "<a target='_blank' href='orderDisplay.php?order=" . $row['order_id'] . "'>Order # " . $row['order_id'] . "</a> - <span class='dateItalic'>" . $row['date_placed'] . "</span><br/>"; $OrderFLAG = TRUE; } if ($OrderFLAG == FALSE) { $HTMLString .= "<p>Currently No Orders</p>"; } echo $HTMLString; } ?> </div> <br/><br/><br/>
} $HTMLBlock .= "</div>"; echo $HTMLBlock; //Output one filter group. Example Bow Range. $HTMLBlock = ""; } } ?> </div> </div> <div class="styleProductsMain"> <div class="productName"> <?php if (isDatabaseConnected()) { $result = mysqli_query($link, sqlStatements("SELECT", "PRODUCTS")); //Calls the function to return the products SQL script. $DataRoleString = ""; $HTMLOutput = ""; while ($row = mysqli_fetch_array($result)) { $DataRoleString = "data-skill_level='" . $row['skill_level'] . "' data-color='" . $row['color'] . "' data-product_type='" . $row['product_type'] . "'"; $ScriptString .= detailedProductScript($row); //INCLUDE IF STATEMENTS FOR THE TYPE OF PRODUCT. ADD CERTAIN data- ATTRIBUTES TO THE DIV. if (strcmp($row['product_type'], "bow") == 0) { $DataRoleString .= " data-bow_style='" . $row['bow_style'] . "' data-weight='" . $row['weight'] . "' data-material='" . $row['material'] . "' data-bow_range='" . $row['bow_range'] . "'"; } else { if (strcmp($row['product_type'], "quiver") == 0) { $DataRoleString .= " data-model='" . $row['model'] . "' data-size='" . $row['size'] . "'"; } else { if (strcmp($row['product_type'], "scope") == 0) { $DataRoleString .= " data-scope_diameter='" . $row['scope_diameter'] . "' data-length='" . $row['length'] . "' data-magnification='" . $row['magnification'] . "'";
//Set the flag saying it is an order from a non member.s } } if ($FLAGQuery == TRUE && isLoggedIn()) { //Checks to see if the order number is in the query string and if the user is logged in. $result = mysqli_query($link, sqlStatements("SELECT", "IS RIGHT ORDER")); //Checks to see if the order belongs to this user. } if (@($row = mysqli_fetch_array($result) || $FLAGNonMember == TRUE)) { //If the order belongs to this user or if the order is from a non member. $FLAG = TRUE; //Sets the flag that the order can be displayed. } if ($FLAG == TRUE) { //If the order can be displayed. $result = mysqli_query($link, sqlStatements("SELECT", "COMPLETE ORDER")); //Retrieves all of the order information from the order_product table regarding this order. $HTMLString = ""; //Initialize the HTMLString variable to be blank. $totalPrice = 0; //Start the total price off at 0. //Creates the header for the order display. $HTMLString .= "<div class='headerOrderInfo'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div class='oneProductCell'>\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div class='oneProductCellOrderDisplay'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<p>Product Name</p>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div class='oneProductCellOrderDisplay'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<p>Quantity</p>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div class='oneProductCellOrderDisplay'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<p>Price</p>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div class='oneProductCellOrderDisplay'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<p>Total Price</p>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>"; //Loop while there are still products that need t be displayed. while ($row = mysqli_fetch_array($result)) { $totalPrice += $row['price'] * $row['quantity']; //Increase the total price by the cost of the current item. //Creates the HTML for each product's cell. $HTMLString .= "<div class='oneProductOrderDisplay'>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class='oneProductCell'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<img src='Images/Products/Thumbnail/" . $row['product_id'] . ".png' />\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class='oneProductCellOrderDisplay'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<p>" . $row['product_name'] . "</p>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class='oneProductCellOrderDisplay'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<p>" . $row['quantity'] . "</p>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class='oneProductCellOrderDisplay'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<p>\$" . $row['price'] . "</p>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class='oneProductCellOrderDisplay'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<p>\$" . $row['price'] * $row['quantity'] . "</p>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t</div>"; } //Creates the HTML for the footer of the order details.
function userRegister(&$link) { $FLAG = TRUE; $ErrorString = ""; $result = mysqli_query($link, sqlStatements("SELECT", "USEDEMAIL")); //Calls the function to return the login SQL script. //Email Used Checked if ($row = mysqli_fetch_array($result) || empty($_POST['registerEmail'])) { $FLAG = FALSE; $ErrorString .= "<p>This email is already registered or is blank.</p>"; } else { if (preg_match("/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}\$/", $_POST['registerEmail']) != TRUE) { $FLAG = FALSE; $ErrorString .= "<p>You have entered an invalid email.</p>"; } } $result = mysqli_query($link, sqlStatements("SELECT", "USEDUSER")); //Calls the function to return the login SQL script. //Password Used Check if ($row = mysqli_fetch_array($result) || empty($_POST['registerUserName'])) { $FLAG = FALSE; $ErrorString .= "<p>This user name is already taken or is blank.</p>"; } //Password Blank Check. if (empty($_POST['registerPassword'])) { $FLAG = FALSE; $ErrorString .= "<p>There is currently no password entered.</p>"; } //First Name Check if (empty($_POST['registerFirstName'])) { $FLAG = FALSE; $ErrorString .= "<p>There is currently no first name entered.</p>"; } //Last Name Check if (empty($_POST['registerLastName'])) { $FLAG = FALSE; $ErrorString .= "<p>There is currently no last name entered.</p>"; } //Street Address Check if (empty($_POST['registerStreetAdd'])) { $FLAG = FALSE; $ErrorString .= "<p>There is currently no street address entered.</p>"; } //City Check if (empty($_POST['registerCity'])) { $FLAG = FALSE; $ErrorString .= "<p>There is currently no city entered.</p>"; } //Postal Code Check if (preg_match("/^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJKLMNPRSTVWXYZ] ?\\d[ABCEGHJKLMNPRSTVWXYZ]\\d\$/", $_POST['registerPostalCode']) != TRUE || empty($_POST['registerPostalCode'])) { $FLAG = FALSE; $ErrorString .= "<p>You have entered an invalid postal code.</p>"; } //Phone Number Check if (preg_match("/^[0-9]{3}-[0-9]{3}-[0-9]{4}\$/", $_POST['registerPhone']) != TRUE || empty($_POST['registerPhone'])) { $FLAG = FALSE; $ErrorString .= "<p>You have entered an invalid phone number.</p>"; } if ($FLAG === TRUE) { mysqli_query($link, sqlStatements("INSERT", "REGISTER")); $result = mysqli_query($link, sqlStatements("SELECT", "LOGIN_REGISTER")); //Calls the function to return the login SQL script. //Check to see if the database call returned any rows. if ($row = mysqli_fetch_array($result)) { $_SESSION['UserID'] = $row['cust_id']; //Store the user's user name in the session. //Create a string that will display a dialog saying the user has logged in. $ScriptString = "<script>\$(document).ready(function () {"; $ScriptString .= "\$('#loggedInUser').text('Thank you for signing in to Full Quiver, " . $row['f_name'] . "!'); "; $ScriptString .= "\$('#signedInDialog').dialog('open');"; $ScriptString .= "});"; $ScriptString .= "</script>"; } } else { $ScriptString = "<script>\$(document).ready(function () {"; $ScriptString .= "\$('#failedRegister').text('You have made a few errors. Please correct them before continuing.'); "; $ScriptString .= "\$('#errorList').html('" . $ErrorString . "');"; $ScriptString .= "\$('#failRegisterDialog').dialog('open');"; $ScriptString .= "});"; $ScriptString .= "</script>"; } echo $ScriptString; }