require_once "includes/form.php"; require_once "includes/comments.php"; $iRecipeID = 5; // make this comment id if (isset($_GET["RecipeID"])) { $iRecipeID = $_GET["RecipeID"]; } $oRecipe = new Recipe(); $oRecipe->load($iRecipeID); // construct comment box $oReplyForm = new Form(); if (isset($_POST["reply"])) { if (isset($_SESSION["UserID"]) == false) { header("Location:recipePage.php?message=signIn&RecipeID=" . $iRecipeID); exit; // terminates request } $oReplyForm->data = $_POST; $oComment = new Comment(); $oComment->comment = $_POST["commentBox"]; $oComment->userID = $oCustomer->userID; $oComment->originalID = $oComment->commentID; $oComment->save(); header("Location:recipePage.php?message=commentAdded&RecipeID=" . $iRecipeID); exit; // terminates request } $oReplyForm->makeCommentBoxTextArea("commentBox"); $oReplyForm->makeSubmit("reply", "Add Comment", "displayBlock blueButton2 bgBlue marginBottom10 paddingTop10 paddingBottom10 floatRight"); echo $oReplyForm->HTML; require_once "includes/footer.php";
// will prompt message to come up exit; // terminates request } } // form markup: $oForm2->makeInput("firstName", "First Name *", "doubleColumn heightApplied floatLeft"); $oForm2->makeInput("lastName", "Last Name *", "doubleColumn heightApplied floatLeft"); $oForm2->makeInput("username", "Username *", "doubleColumn heightApplied floatLeft "); $oForm2->makeInput("email", "Email *", "doubleColumn heightApplied floatLeft "); $oForm2->makeInput("address", "Address *", "doubleColumn heightApplied floatLeft "); $oForm2->makeInput("telephone", "Telephone *", "doubleColumn heightApplied floatLeft"); $oForm2->makePassword("password", "Password *", "doubleColumn heightApplied floatLeft"); $oForm2->makePassword("confirmPassword", "Confirm Password *", "doubleColumn heightApplied floatLeft"); $oForm2->makeCheckBox("newsSignUp", "Subscribe to the Get in my Belly Newsletter"); $oForm2->makeSubmit("create", "Create", "blueButton2 bgBlue marginBottom10"); ?> <h1 class="textAlignCenter marginBottom30">User Login</h1> <!-- login form --> <div class="mainForms eight columns floatLeft marginBottom50"> <h2 class="formHeader paddingTop10 paddingBottom20">Login</h2> <?php echo $oForm1->HTML; ?> </div> <!-- sign up form --> <div class="mainForms2 eight columns floatLeft marginBottom50" > <h2 class="formHeader paddingTop10 paddingBottom20">Create Account</h2> <span class="displayBlock positionRelative recipeCaption captionLine textAlignCenter marginBottom10">* Required Fields </span> <?php
$oProduct = new Product(); $oProduct->load($_POST["productID"]); $oProduct->stockLevel = $_POST["stockLevel"]; $oProduct->save(); // redirect after adding new page successfully to that new location header("Location:editProductStock.php?message=stockUpdated"); exit; // terminates request } $aForms = array(); $aAllProducts = ProductManager::getAllProducts(); for ($iCount = 0; $iCount < count($aAllProducts); $iCount++) { $oProduct = $aAllProducts[$iCount]; $oStockLevelForm = new Form(); $aStickyData = array(); $aStickyData["stockLevel"] = $oProduct->stockLevel; $oStockLevelForm->data = $aStickyData; // form markup: $oStockLevelForm->stockInput("stockLevel", "", "floatLeft"); $oStockLevelForm->makeHiddenField("productID", $oProduct->productID); $oStockLevelForm->makeSubmit("save", "Save", "blueButton bgBlue selfClear"); $aForms[] = $oStockLevelForm; } // stock level form echo View::renderProductStockMgtEdit($aAllProducts, $aForms); if (isset($_GET["message"]) == true) { if ($_GET["message"] == "stockUpdated") { echo '<div class="stockUpdate formSuccess textAlignCenter">Stock level has now been updated.</div>'; } } require_once "includes/footerAdmin.php";
$oRecipe->imagePath = $sImageName; $oRecipe->userID = $oCustomer->userID; $oRecipe->recipeTypeID = $_POST["recipeCategory"]; $oRecipe->save(); header("Location: submitRecipe.php?message=submitted"); exit; } } //html markup: $oSubmitForm->makeInput("recipeTitle", "Recipe Title *", "eight columns floatLeft marginBottom10"); $oSubmitForm->makeSelect("recipeCategory", "Recipe Category *", RecipeTypeManager::listAllTypes(), "eight columns floatLeft marginBottom10"); $oSubmitForm->makeImageUpload("imageUpload", "Image Upload *"); $oSubmitForm->makeTextArea("authorNotes", "Author Notes *", "eight columns floatLeft marginBottom10"); $oSubmitForm->makeTextArea("ingredients", "Ingredients *", "eight columns floatLeft marginBottom10"); $oSubmitForm->makeTextArea("directions", "Directions *", "clearBoth marginRight10 marginBottom30 marginLeft10"); $oSubmitForm->makeSubmit("submit", "submit", "blueButton2 bgBlue marginBottom10"); ?> <h1 class="textAlignCenter marginBottom30">Submit a Recipe</h1> <span class="displayBlock positionRelative recipeCaption captionLine textAlignCenter marginBottom10">* Required Fields </span> <!-- submit recipe form starts here --> <div class="otherForms"> <?php echo $oSubmitForm->HTML; if (isset($_GET["message"]) == true) { if ($_GET["message"] == "submitted") { echo '<div class="recipeSubmitted formSuccess">Recipe Submitted!</div>'; } } ?> </div>
// redirect after adding new page successfully to that new location if (isset($_SESSION['url'])) { $url = $_SESSION['&url']; } else { $url = "index.php"; } // default page for header("Location: {$url}?message=subscribed"); // perform correct redirect. exit; // terminates request } } // form markup: $oNewsletterForm->newsletterSubscribeInput("email"); $oNewsletterForm->makeSubmit("subscribe", "Subscribe", "pinkButton bgPink marginLeft10"); ?> <!-- sign up for newsletter --> <div class="clearBoth newsLetterSignUp sixteen columns bg3A newsLetter marginRightNone marginBottom50 marginLeftNone"> <span class="floatLeft paddingLeft20 marginTop5">To receive a bellyful of tasty recipes:</span> <div class="floatLeft" > <!-- subscribe form --> <?php echo $oNewsletterForm->HTML; if (isset($_GET["message"]) == true) { if ($_GET["message"] == "subscribed") { echo '<div class="formSuccess">You are now subscribed</div>'; } } ?>
$oForm->data = $_POST; $oForm->checkRequired("MemberName"); $oForm->checkRequired("MemberPassword"); $oForm->checkRequired("MemberEmail"); //checkEqual doesn't work. $oForm->checkEqual("MemberPassword", "ConfirmPassword"); if ($oForm->valid == true) { $oNewMember = new Member(); $oNewMember->MemberName = $_POST["MemberName"]; $oNewMember->MemberPassword = password_hash($_POST["MemberPassword"], PASSWORD_DEFAULT); $oNewMember->MemberEmail = $_POST["MemberEmail"]; $oNewMember->save(); header("Location:login.php"); exit; } } $oForm->makeTextInput("Name", "MemberName"); $oForm->makePasswordInput("Password", "MemberPassword"); $oForm->makePasswordInput("Confirm Password", "ConfirmPassword"); $oForm->makeTextInput("Email", "MemberEmail"); $oForm->makeSubmit("Register!"); ?> <div class="mainBackground"> <h3>Register</h3> <?php echo $oForm->html; ?> </div> <?php require_once 'includes/footer.php';
} else { if (password_verify($_POST["MemberPassword"], $oTestMember->MemberPassword) == false) { $oForm->raiseCustomError("MemberPassword", "Please Enter Valid Password"); } else { //record the CustomerID to session $_SESSION["MemberID"] = $oTestMember->MemberID; header("Location:viewCategories.php?CategoryID=6"); //redirect to exit; } } } } $oForm->makeTextInput("Email", "MemberEmail"); $oForm->makePasswordInput("Password", "MemberPassword"); $oForm->makeSubmit("Login"); ?> <div class="mainBackground"> <h3 class="titleHeader">Login</h3> <?php echo $oForm->html; ?> <h3 class="titleHeader">Dont have an account? <a href="register.php">Register Here</a></h3> </div>
$oCustomer->Address = $_POST["Address"]; $oCustomer->Phone = $_POST["Phone"]; $oCustomer->Email = $_POST["Email"]; $oCustomer->Password = $_POST["Password"]; $oCustomer->save(); header("Location:congrats.php"); exit; } } $oForm->makeTextInput("Name", "Name"); $oForm->makeTextInput("Address", "Address"); $oForm->makeTextInput("Phone", "Phone"); $oForm->makeTextInput("Email", "Email"); $oForm->makePasswordInput("Password", "Password"); $oForm->makePasswordInput("Confirm Password", "Confirm_Password"); $oForm->makeSubmit("Sign Up"); ?> <?php echo $oForm->html; ?> <!-- <form class="register" action="" method="post"> <div class="row"> <label for="">Name</label> <input type="text" name="firstName" id="firstNname" value=""> </div> <div class="row"> <label for="" for="">Address</label> <input type="text" name="firstName" id="firstNname" value="">
require_once "includes/header.php"; require_once "includes/product.php"; require_once "includes/productManager.php"; require_once "includes/form.php"; $iProductID = 1; if (isset($_GET["ProductID"])) { $iProductID = $_GET["ProductID"]; } $oProduct = new Product(); $oProduct->load($iProductID); $oBasketForm = new Form("addToBasket.php"); // form markup: $oBasketForm->makeHiddenField("ProductID", $iProductID); $oBasketForm->quantityInput("quantity", "Quantity", "addQuantity"); $oBasketForm->makeSubmit("addToBasket", "Add to Basket", "displayBlock clearBoth blueButton2 bgBlue marginTop10 marginBottom10"); // main product info: echo View::renderShopItem($oProduct, $oBasketForm); if (isset($_GET["message"]) == true) { if ($_GET["message"] == "itemAdded") { echo '<div class="addToBasket formSuccess">Item has been added to basket.</div>'; } if ($_GET["message"] == "noQuantity") { echo '<div class="addToBasket formError">* Must select quantity.</div>'; } } $aAllProducts = ProductManager::getAllProducts(); ?> <!-- latest shop items section -->
$oProduct->ingredients = $_POST["ingredients"]; $oProduct->stockLevel = $_POST["stockLevel"]; $oProduct->save(); header("Location: addProduct.php?message=added"); exit; } } //html markup $oProductForm->makeInput("productName", "Product Name *", "eight columns floatLeft marginBottom10"); $oProductForm->makeInput("productDescription", "Product Description *", "eight columns floatLeft marginBottom10"); $oProductForm->makeImageUpload("imageUpload", "Image Upload *"); $oProductForm->makeInput("productSize", "Product Size *", "eight columns floatLeft marginBottom10"); $oProductForm->makeInput("productPrice", "Product Price *", "eight columns floatLeft marginBottom10"); $oProductForm->makeTextArea("ingredients", "Ingredients *", "eight columns floatLeft marginBottom10 selfClear"); $oProductForm->quantityInput("stockLevel", "Stock Level *", "addStockLevel"); $oProductForm->makeSubmit("add", "Add Product", "clearBoth blueButton bgBlue marginBottom30"); ?> <h1 class="textAlignCenter marginBottom30">Add a Product</h1> <span class="displayBlock positionRelative recipeCaption captionLine textAlignCenter marginBottom10">* Required Fields </span> <!-- add product form starts here --> <div class="otherForms addProductForm"> <?php echo $oProductForm->HTML; if (isset($_GET["message"]) == true) { if ($_GET["message"] == "added") { echo '<div class="formSuccess">New Product added succesfully!</div>'; } } ?> </div>
$oForm2->raiseCustomError("currentPassword", "* incorrect password"); } if ($oForm2->valid == true) { $oCustomer->password = password_hash($_POST["password"], PASSWORD_DEFAULT); $oCustomer->save(); // redirect after adding new page successfully to that new location header("Location:editMyDetails.php?message=passwordChanged"); exit; // terminates request } } // html markup: $oForm2->makePasswordBlank("password", "New Password *"); $oForm2->makePasswordBlank("confirmPassword", "Confirm Password *"); $oForm2->makePasswordBlank("currentPassword", "Current Password"); $oForm2->makeSubmit("changePassword", "Change Password", "displayBlock clearBoth blueButton2 bgBlue marginTop10 marginBottom10"); ?> <h1 class="textAlignCenter marginBottom30">Edit My Account</h1> <!-- my details --> <div class="mainForms2 eight columns floatLeft marginBottom50" > <h2 class="paddingTop10 paddingBottom20 textAlignCenter">Edit My Details</h2> <span class="displayBlock positionRelative recipeCaption captionLine textAlignCenter marginBottom10">* Required Fields </span> <?php echo $oForm1->HTML; if (isset($_GET["message"]) == true) { if ($_GET["message"] == "updated") { echo '<div class="formSuccess">Your details have now been updated.</div>'; } } ?> </div>
if ($bLoaded == false) { $oForm->raiseCustomError("Email", '<p class="validate">Bad Email!</p>'); } else { if ($oCheckCustomer->Password != $_POST["Password"]) { $oForm->raiseCustomError("Password", '<p class="validate">Bad Password!</p>'); } } if ($oForm->valid == true) { $_SESSION['CustomerID'] = $oCheckCustomer->CustomerID; $oCart = new Cart(); // // $oCart->add(1); // // $oCart->add(5); // // $oCart->add(5); // // $oCart->add(4); $_SESSION["cart"] = $oCart; //redirect header("Location:my_account.php"); exit; } } $oForm->makeTextInput("Email", "Email"); $oForm->makePasswordInput("Password", "Password"); $oForm->makeSubmit("Log In"); ?> <?php echo $oForm->html; ?> <?php require_once "includes/footer.php";
} } // html form markup $oDeliveryPayForm->makeHeader3("Delivery & Billing Address"); $oDeliveryPayForm->makeInput("name", "Name", "inputHeight"); $oDeliveryPayForm->makeInput("delivery", "Delivery Address", "inputHeight"); $oDeliveryPayForm->makeCheckBox("deliveryAdd", "* use address in my account details"); $oDeliveryPayForm->makeInput("billing", "Billing Address", "inputHeight"); $oDeliveryPayForm->makeCheckBox("billingAdd", "* same as delivery address"); $oDeliveryPayForm->makeHeader3("Payment Information"); $oDeliveryPayForm->makeInput("paymentType", "Payment Method", "inputHeight"); $oDeliveryPayForm->makeInput("accountName", "Account Name", "inputHeight"); $oDeliveryPayForm->makeInput("ccNumber", "Credit Card Number", "inputHeight"); $oDeliveryPayForm->makeInput("expiry", "Expiry Date", "inputHeight inputQuarter marginRight10 floatLeft"); $oDeliveryPayForm->makeInput("security", "Security", "inputHeight inputQuarter floatLeft"); $oDeliveryPayForm->makeSubmit("checkout", "CheckOut", "clearBoth blueButton bgBlue floatRight selfClear"); ?> <!-- delivery and billing --> <div class="checkOutForm sixteen columns mainForms floatLeft marginBottom30"> <!-- name --> <?php echo $oDeliveryPayForm->HTML; ?> </div> <?php require_once "includes/footerAdmin.php"; ?>
// $oRecipe -> imagePath = $sImageName; // $oRecipe -> userID = $oCustomer -> userID; // $oRecipe -> recipeTypeID = $_POST["recipeCategory"]; $oRecipe->save(); header("Location: editRecipe.php?message=updated&RecipeID=" . $oRecipe->recipeID); exit; } } //html markup: $oEditForm->makeInput("recipeTitle", "Recipe Title *", "eight columns editRecipe floatLeft marginBottom10"); $oEditForm->makeSelect("recipeCategory", "Recipe Category *", RecipeTypeManager::listAllTypes(), "eight columns floatLeft editRecipe marginBottom10"); $oEditForm->makeImageUpload("imageUpload", "Image Upload *"); $oEditForm->makeTextArea("authorNotes", "Author Notes *", "eight columns editRecipe floatLeft marginBottom10"); $oEditForm->makeTextArea("ingredients", "Ingredients *", "eight columns editRecipe floatLeft marginBottom10"); $oEditForm->makeTextArea("directions", "Directions *", "clearBoth editRecipe marginRight10 marginBottom30 marginLeft10"); $oEditForm->makeSubmit("update", "update", "blueButton2 bgBlue marginBottom10"); ?> <h1 class="textAlignCenter marginBottom30">Edit Recipe</h1> <span class="displayBlock positionRelative recipeCaption captionLine textAlignCenter marginBottom10">* Required Fields </span> <!-- submit recipe form starts here --> <div class="otherForms"> <?php echo $oEditForm->HTML; if (isset($_GET["message"]) == true) { if ($_GET["message"] == "updated") { echo '<div class="recipeUpdate formSuccess">Recipe Update Successful!</div>'; } } ?> </div>
$oForm = new Form(); $oForm->data = $aExistingData; if (isset($_POST["submit"]) == true) { $oForm->data = $_POST; $oForm->checkRequired("Name"); $oForm->checkRequired("Address"); $oForm->checkRequired("Phone"); $oForm->checkRequired("Email"); if ($oForm->valid == true) { $oExistingCustomer->Name = $_POST["Name"]; $oExistingCustomer->Address = $_POST["Address"]; $oExistingCustomer->Phone = $_POST["Phone"]; $oExistingCustomer->Email = $_POST["Email"]; $oExistingCustomer->save(); header("Location:my_account.php?CustomerID=" . $oExistingCustomer->CustomerID); exit; } } $oForm->makeTextInput("Name", "Name"); $oForm->makeTextInput("Address", "Address"); $oForm->makeTextInput("Phone", "Phone"); $oForm->makeTextInput("Email", "Email"); $oForm->makeSubmit("Update"); ?> <h3>Edit Details</h3> <?php echo $oForm->html; ?>
$oForm = new Form(); if (isset($_POST["submit"])) { $oForm->data = $_POST; $oForm->checkRequired("CategoryName"); $oForm->checkRequired("CategoryDesc"); if ($oForm->valid == true) { $oNewCategory = new Category(); $oNewCategory->CategoryName = $_POST["CategoryName"]; $oNewCategory->CategoryDesc = $_POST["CategoryDesc"]; $oNewCategory->save(); header("Location:viewCategories.php?CategoryID=6"); exit; } } $oForm->makeTextInput("Category Name", "CategoryName"); $oForm->makeTextInput("Category Description", "CategoryDesc"); $oForm->makeSubmit("Post"); ?> <div class="mainBackground"> <h3>New Category</h3> <?php echo $oForm->html; ?> </div> <?php require_once 'includes/footer.php';
require_once 'includes/member.php'; $iMemberID = $_SESSION["MemberID"]; $oExisitingMember = new Member(); $oExisitingMember->load($iMemberID); $aExisitingData = []; $aExisitingData["MemberName"] = $oExisitingMember->MemberName; //photo should go in here too to edit photo. $oForm = new Form(); $oForm->data = $aExisitingData; if (isset($_POST["submit"])) { $oForm->data = $_POST; $oForm->checkRequired("MemberName"); //photo should go in here too to edit photo. if ($oForm->valid) { $oExisitingMember->MemberName = $_POST["MemberName"]; $oExisitingMember->save(); header("Location:profile.php"); } } $oForm->makeTextInput("Member Name", "MemberName"); $oForm->makeSubmit("Update Details"); ?> <div class="mainBackground"> <h3>Edit Details</h3> <?php echo $oForm->html; ?> </div> <?php require_once 'includes/footer.php';