$e = BoltEnrollment::lookup($user->id, $course_id); if ($e) { page_header(); echo "You are already enrolled in {$course->name}.\n <p>\n Are you sure you want to start over from the beginning?\n <p>\n "; show_button("bolt_sched.php?action=start_confirm&{$url_args}", "Yes", "Start this course from the beginning"); show_button("bolt_sched.php?action=resume&{$url_args}", "Resume", "Resume course from current position"); page_footer(); exit; } // fall through // fall through case 'start_confirm': start_course(); break; case 'update_info': update_info(); start_course(); break; case 'prev': $view = finalize_view($view_id, BOLT_ACTION_PREV); debug_show_state(unserialize($view->state), "Initial"); if ($view->prev_view_id) { $view = BoltView::lookup_id($view->prev_view_id); $iter = new BoltIter($course_doc); $iter->decode_state($view->state); $iter->at(); $mode = $view->mode; if ($mode == BOLT_MODE_ANSWER) { $v2 = BoltView::lookup_id($view->prev_view_id); $result = BoltResult::lookup_id($v2->result_id); srand($v2->id);
session_start(); //Checking session name for security. include "LoginSecurity.php"; include "db.php"; echo "<h2>Edit item</h2>"; echo "<form action='food_inventory.php?page=1' method='POST'>\n\t\t\t\t\t\t<input type='submit' value='Home' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<hr />\n\t\t\t\t"; $id = NULL; $action = NULL; if (isset($_GET['action'])) { $action = $_GET['id']; } if (isset($_GET['id'])) { $id = $_GET['id']; } if (isset($_POST['update'])) { update_info($id); } //Display Food. display_food($id); //Validate input. validate(); function display_food($id) { $sql = "SELECT f.food_id, f.food_name, f.food_description, f.regular_price, f.sale_price, f.on_sale,\n\t\t\t\t\t\t\tf.sale_start_date, f.sale_end_date, f.category_id, pic, f.cyclone_card_item, f.cyclone_card_price, c.category_id, c.category_description\n\t\t\t\t\t\t\tFROM food f INNER JOIN category c ON c.category_id = f.category_id\n\t\t\t\t\t\t\tWHERE food_id = " . $id; $result = mysql_query($sql); //Query to get all unique category types to populate our drop-down list. $categorysql = "SELECT DISTINCT category_description, category_id FROM category ORDER BY category_description"; $categoryresult = mysql_query($categorysql); echo "<form action='?action=submit&id=" . $id . "' method='post' id='edit_food_form'>\n\t\t\t\t\t\t<table border=1 class='full_input'>\n\t\t\t\t\t\t<th>Image</th>\n\t\t\t\t\t\t<th>Name</th>\n\t\t\t\t\t\t<th>Description</th>\n\t\t\t\t\t\t<th>Price</th>\n\t\t\t\t\t\t<th>Cyclone Card Item</th>\n\t\t\t\t\t\t<th>Cyclone Card Price</th>\n\t\t\t\t\t"; while ($row = mysql_fetch_array($result)) { //For thumbnails with the food image.
header("location:./error.html"); exit; } if ($_POST['action'] === "updateSetting") { if (isset($_POST['nickname']) && isset($_POST['oldPassword']) && isset($_POST['newPassword']) && isset($_POST['profile'])) { $nickname = $_POST['nickname']; $oldPassword = $_POST['oldPassword']; $newPassword = $_POST['newPassword']; $profile = $_POST['profile']; try { $conn = connect(); } catch (Exception $error) { header("location:./admin/setting.php?failed"); exit; } if (update_password($conn, $oldPassword, $newPassword) && update_info($conn, $nickname, $profile)) { header("location:./admin/setting.php?success"); } else { header("location:./admin/setting.php?failed"); } } else { header("location:./admin/setting.php?failed"); } } if ($_POST['action'] === "del") { if (isset($_POST['id']) && is_num($_POST['id'])) { try { $conn = connect(); del_item($conn, $_POST['id']); } catch (Exception $error) { header("location:./admin/admin.php");
if (!(isset($_POST['oldpwd']) && isset($_POST['newpwd']))) { echo '信息填写不完整'; exit; } echo update_pwd($_SESSION['ewu_username'], $_POST['oldpwd'], $_POST['newpwd']); break; case 'updateInfo': if (!isset($_SESSION['ewu_username'])) { echo '尚未登录'; exit; } if (!(isset($_POST['email']) && isset($_POST['gender']) && isset($_POST['studentNo']) && isset($_POST['campus']) && isset($_POST['qq']) && isset($_POST['phone']) && isset($_POST['hidePhone']))) { echo '信息填写不完整'; exit; } echo update_info($_SESSION['ewu_username'], $_POST['email'], $_POST['gender'], $_POST['studentNo'], $_POST['campus'], $_POST['qq'], $_POST['phone'], $_POST['hidePhone']); break; case 'logout': signout(); echo '1'; break; case 'reset': if (isset($_POST['username']) && isset($_POST['auth_key']) && isset($_POST['pwd'])) { echo reset_pwd($_POST['username'], $_POST['auth_key'], $_POST['pwd']); } else { exit('信息填写不完整'); } break; default: echo '服务器错误,无法识别的请求'; }
$location = $photoInfoObj->getLocation(); $tag_list = $photoInfoObj->getTags(); // 保存一份tag_str到数据库中 $tag_json = json_encode($tag_list); $ratio = $photoInfoObj->getRatio(); $filename = $photoInfoObj->getFilename(); $thumbnail_filename = $photoInfoObj->getThumbnailFilename(); // 增加模特信息 $model_id = insert_model($model); // tag 信息 $tag_id_list = array(); foreach ($tag_list as $tag) { $tag_id_list[] = insert_tag($tag); } echo "处理照片: " . $filename . "<br>"; // 添加照片信息到数据库 insert_photo($filename, $thumbnail_filename, $model_id, $title, $photographer, $model, $timestamp, $location, $ratio, $tag_id_list, $tag_json); } } function get_photo_path() { $file_path = __DIR__ . DIRECTORY_SEPARATOR . PHOTO_PATH_FILE; if (file_exists($file_path)) { return file_get_contents($file_path); } return DEFAULT_PATH; } $photo_path = get_photo_path(); echo "the photo path is " . $photo_path . "<br>"; update_info($photo_path);