} if (isset($_POST['add'])) { //添加 $filed = array(); foreach ($_POST as $key => $value) { if ($key != "add" && $key != "t1") { $filed[] = $value; } } $info = serialize($filed); operate::insertoneline('material', array('mid', 'title', 'info'), array($_GET['db'], $_POST['t1'], $info)); $errcon = "添加成功"; include "./tpl/succ.tpl"; } if (isset($_POST['edit'])) { //修改 $filed = array(); foreach ($_POST as $key => $value) { if ($key != "edit" && $key != "t1") { $filed[] = $value; } } $info = serialize($filed); operate::updateoneline('material', array('title', 'info'), array($_POST['t1'], $info), 'id=' . $_POST['edit']); $errcon = "修改成功"; include "./tpl/succ.tpl"; } $content = unserialize($table['info']); $data = operate::getmuchlinesql('select * from material where mid=' . $table[0] . ' order by id desc limit 30'); include "./tpl/database.tpl"; }
<?php define('ACCESS', '1'); session_start(); include 'conn/connect.php'; include 'conn/operate.php'; if (!isset($_SESSION['username'])) { header("Location: login.php"); } if (isset($_POST['act'])) { if ($_POST['act'] == 'edit_profile') { //修改信息 if (trim($_POST['password']) == '') { operate::updateoneline('member', array('Email', 'name', 'phone', 'qq'), array($_POST['Email'], $_POST['name'], $_POST['phone'], $_POST['qq']), 'username = "******"'); } else { operate::updateoneline('member', array('password', 'Email', 'name', 'phone', 'qq'), array(md5($_POST['password']), $_POST['Email'], $_POST['name'], $_POST['phone'], $_POST['qq']), 'username = "******"'); } operate::loginsession($_SESSION['username']); $errurl = "javascript:window.history.go(-1)"; $errinfo = "修改成功!"; include 'templete/err.html'; } else { if ($_POST['act'] == 'rent') { //检测数据填写情况 if (trim($_POST['title']) == "" || empty($_FILES) || trim($_FILES['pic']['name']) == "" || !isset($_POST['select2'])) { $errurl = "javascript:window.history.go(-1)"; $errinfo = "物品名称、商品主图、地区信息必须填写!"; include 'templete/err.html'; } //上传图片 $pic = '';