<?php if ($_POST['submit']) { $unit = new product_class(); $tool = new My_Tool(); $sam = new guard(); //檢查傳入值-------------------------- $name = htmlspecialchars(trim($_POST['name'])); if (empty($name)) { $tool->error(get_msg("name_error")); } else { $name = $sam->var_check($name); } $unit->table = $pro_class_table; $unit->get_vars(); $buff = array(); $unit->get_history($unit->upid, $buff); $unit->add(); $tool->show(get_msg("add_success"), $_SERVER['HTTP_REFERER']); exit; } ?> <form method="post" action=""> <input type="hidden" name="upid" value="<?php print $_GET['id']; ?> " /> 類別名稱:<input type="text" name="name" size="20" /> 排序: <input type="text" name="no" value="100" /> <input type="submit" name="submit" value="新增類別" />
if ($_FILES['no_pic_file']['size'] == 0) { $pic_no_pic = $_POST['pic_no_pic']; } else { if (!$tool->image_check($_FILES['no_pic_file']['type'], $_POST['pic_jpg'], $_POST['pic_gif'], $_POST['pic_png'])) { $tool->error("背景圖片檔案格式有誤!"); } $img = new img_uploader(); $img->set_path($_FILES['no_pic_file']); //置入路徑 $img->set_width($_POST['pic_width']); //決定縮圖大小,大圖大小 $img->set_savepath("../images/file"); //設定儲存路徑 $pic_no_pic = $img->save("add"); } $sql = "UPDATE `{$now_table}` SET \n`pic_quality` = '" . $sam->var_check($_POST['pic_quality']) . "',\n`pic_width` = '" . $sam->var_check($_POST['pic_width']) . "',\n`pic_width_small` = '" . $sam->var_check($_POST['pic_width_small']) . "',\n`pic_bg` = '" . $pic_bg . "',\n`pic_bg_w` = '" . $sam->var_check($_POST['pic_bg_w']) . "',\n`pic_bg_h` = '" . $sam->var_check($_POST['pic_bg_h']) . "',\n`pic_no_pic` = '" . $pic_no_pic . "',\n`pic_max_size` = '" . $sam->var_check($_POST['pic_max_size']) . "',\n`pic_jpg` = '" . $sam->var_check($_POST['pic_jpg']) . "',\n`pic_gif` = '" . $sam->var_check($_POST['pic_gif']) . "',\n`pic_png` = '" . $sam->var_check($_POST['pic_png']) . "',\n`f_show` = '" . $sam->var_check($_POST['f_show']) . "',\n\n`f_show_new` = '" . $sam->var_check($_POST['f_show_new']) . "',\n`f_show_commend` = '" . $sam->var_check($_POST['f_show_commend']) . "',\n`f_show_sp` = '" . $sam->var_check($_POST['f_show_sp']) . "',\n\n`f_line` = '" . $sam->var_check($_POST['f_line']) . "',\n`f_pic_w` = '" . $sam->var_check($_POST['f_pic_w']) . "',\n`f_pic_h` = '" . $sam->var_check($_POST['f_pic_h']) . "',\n`f_pic_sw` = '" . $sam->var_check($_POST['f_pic_sw']) . "',\n`f_pic_sh` = '" . $sam->var_check($_POST['f_pic_sh']) . "',\n`f_order` = '" . $sam->var_check($_POST['f_order']) . "',\n`file_info` = '" . $_POST['file_info'] . "'\n WHERE `" . $now_table . "`.`id` =1 "; mysql_query($sql); } //更新資料END---------------------------------------------------------------- //***************************取出原設定********************************** $sql = "select * from `{$now_table}` where id=1"; $row = mysql_fetch_array(mysql_query($sql)); $pic_quality = $row['pic_quality']; //壓縮品質 $pic_width = $row['pic_width']; //上傳圖片寬度限制 $pic_width_small = $row['pic_width_small']; //上傳圖片寬度限制 $pic_bg = $row['pic_bg']; //圖片外框背景路徑 $pic_bg_w = $row['pic_bg_w'];