redirect(''); } else { // include needed database functions include_once $BASE_PATH . 'database/products.php'; $name = strip_tags($_POST['name']); $price = strip_tags($_POST['price']); $quantity = strip_tags($_POST['quantity']); $brandid = strip_tags($_POST['brandid']); $description = strip_tags($_POST['description']); $image = ""; if (($_FILES["image"]["type"] == "image/jpeg" || $_FILES["image"]["type"] == "image/jpg") && $_FILES["image"]["size"] < $maxfilesize) { $image = base64_encode(file_get_contents($_FILES['image']['tmp_name'])); } if (!empty($name) && !empty($price) && isset($quantity) && !empty($brandid)) { if ($brandid == 'other') { $newbrand = strip_tags($_POST['newbrand']); if (!empty($newbrand)) { include_once $BASE_PATH . 'database/brands.php'; $brandid = addBrand($newbrand); } else { echo "Fill new brand name"; die; } } addProduct($name, $price, $quantity, $brandid, $description, $image); } else { echo "Fill all fields"; die; } redirect('pages/manager/products/list_products.php'); }
$userLevel = filter_input(INPUT_POST, 'userLevel'); update_user($userID, $firstName, $lastName, $email, $userName, $password, $userLevel); $user = edit_user($userID); include 'view/usersInfoForm.php'; break; case 'createSample': $brand = filter_input(INPUT_POST, 'brand'); $origin = filter_input(INPUT_POST, 'origin'); $batch = filter_input(INPUT_POST, 'batch'); $survey_values = array($brand, $origin, $batch); createSample($brand, $origin, $batch); include 'view/samples.php'; break; case 'addBrand': $brand = filter_input(INPUT_POST, 'brand'); addBrand($brand); include 'view/brands.php'; break; case 'addOrigin': $origin = filter_input(INPUT_POST, 'origin'); addOrigin($origin); include 'view/brands.php'; break; case 'submitSurvey': $responses = array(); $sampleID = filter_input(INPUT_POST, 'sampleID'); $responses[] = filter_input(INPUT_POST, 'question1'); $responses[] = filter_input(INPUT_POST, 'question2'); $responses[] = filter_input(INPUT_POST, 'question3'); $responses[] = filter_input(INPUT_POST, 'question4'); $responses[] = filter_input(INPUT_POST, 'question5');