$_SESSION['price'] = $price; $_SESSION['quantity'] = $quantity; $_SESSION['colourway'] = $colourway; $_SESSION['weight'] = $weight; $_SESSION['yards'] = $yards; $_SESSION['unitWeight'] = $unitWeight; $_SESSION['fiber'] = $fiber; $_SESSION['description'] = $description; message("bad", " Error uploading file: image name already exists. Product has not been updated. <a href=\"edit_product.php?id=" . $item . "\">Go back.</a>"); exit(0); } $item_array = array(':name' => $name, ':brand' => $brand, ':price' => $price, ':quantity' => $quantity, ':colourway' => $colourway, ':weight' => $weight, ':yards' => $yards, ':unitWeight' => $unitWeight, ':fiber' => $fiber, ':description' => $description, ':image' => $image, ':item' => $item); $sql = 'UPDATE Inventory SET name=:name, brand=:brand, price=:price, quantity=:quantity, colourway=:colourway, weight=:weight, yards=:yards, unitWeight=:unitWeight, fiber=:fiber, description=:description, image=:image WHERE `item#`=:item'; db_edit_entry($item_array, $sql); } else { $item_array = array(':name' => $name, ':brand' => $brand, ':price' => $price, ':quantity' => $quantity, ':colourway' => $colourway, ':weight' => $weight, ':yards' => $yards, ':unitWeight' => $unitWeight, ':fiber' => $fiber, ':description' => $description, ':item' => $item); $sql = 'UPDATE Inventory SET name=:name, brand=:brand, price=:price, quantity=:quantity, colourway=:colourway, weight=:weight, yards=:yards, unitWeight=:unitWeight, fiber=:fiber, description=:description WHERE `item#`=:item'; db_edit_entry($item_array, $sql); } message("good", " Successfully updated! <a href=\"product.php?id=" . $item . "\">Continue</a>"); } else { die('Error editing product'); } } else { message("bad", "You do not have permission to view this page. <a href=\"index.php\">Go Home</a>"); } } else { message("bad", " You must be a logged in administrator to do this! <a href=\"login.php\">Log in</a>"); } output_page_footer(); output_html5_footer();
$newpassA = md5($newpass); if (db_check_user($email, $oldpass)) { $sql .= 'password=:password, '; $user_array[':password'] = $newpassA; } else { $problemCode = 0; $_SESSION['fName'] = $fName; $_SESSION['lName'] = $lName; $_SESSION['problem'] = $problemCode; message("bad", " Incorrect password. Try again. <a href=\"edit_user.php\">Go Back.</a>"); exit(0); } } } $sql .= 'firstName=:firstName, lastName=:lastName WHERE email=:email'; db_edit_entry($user_array, $sql); message("good", " Successfully updated your information! <a href=\"my_page.php\">Continue</a>"); } else { $problemCode = 0; if ($errorFN) { $problemCode += 1; } if ($errorLN) { $problemCode += 2; } $_SESSION['fName'] = $fName; $_SESSION['lName'] = $lName; $_SESSION['problem'] = $problemCode; header('Location: edit_user.php'); exit(0); }