/** * 会员添加修改数据库操作 * @author MaWei (http://www.phpyrb.com) * @date 2014-8-4 下午3:23:27 */ function addupdata() { $data = array(); $_REQUEST['id'] && ($data['id'] = intval($_REQUEST['id'])); $data['uname'] = text($_REQUEST['name']); $data['email'] = text($_REQUEST['email']); $_REQUEST['passwd'] && ($data['passwd'] = sha1_encrypt(text($_REQUEST['passwd']))); $data['home'] = text($_REQUEST['home']); $data['status'] = intval($_REQUEST['status']); $data['qq'] = intval($_REQUEST['qq']); $data['sex'] = intval($_REQUEST['sex']); if ($_FILES['file']['name']) { $avatar = uploads(array('path' => 'avatar', 'ImgWidth' => 150, 'ImgHeight' => 150), true); $data['avatar'] = $avatar['thumb']; } $data['lasttime'] = time(); empty($_REQUEST['uid']) && ($data['registertime'] = time()); $data['lastip'] = get_client_ip(); $reid = add_updata($data, 'Member'); if ($reid === false) { $this->error('保存失败!', U('Admin/Member/index')); } else { $this->success('保存成功!', U('Admin/Member/index')); } }
public function CreatePoiImageAction() { //只接受文件流 $img = uploads('temp/poi/'); logDebug(json_encode($img)); if (is_array($img) && !isset($img[0]['error']) && FALSE != $img) { $this->di['wechat']->createPoiLogo($img); foreach ($img as $val) { unlink(ROOT_DIR . DIRECTORY_SEPARATOR . 'Public' . DIRECTORY_SEPARATOR . $val); } returnJSON(array('err' => '1', 'wechat_url' => $this->di['wechat']->url)); return; } returnJSON(array('err' => '0', 'errmsg' => $img[0]['error'])); return; }
public function cardUpdateAction() { $card = new \App\Models\Card(); $data1['card_id'] = $this->request->getPost('card_id'); $id = $this->request->getPost('id'); $card_info = $card->findCard($id); $logo = uploads('Uploads'); if ($logo == false) { $data3['logo_url'] = $card_info->logo_url; } elseif ($logo[0]['error']) { return $logo[0]['error']; } else { $logo_data = $this->di['wechat']->cardLogo($logo); $data3['logo_url'] = $logo_data->url; } $data3['notice'] = $this->request->getPost('notice'); $data3['description'] = $this->request->getPost('description'); $data3['color'] = $this->request->getPost('color'); $data3['service_phone'] = $this->request->getPost('service_phone'); $data3['code_type'] = $this->request->getPost('code_type'); $data3['can_share'] = $this->request->getPost('can_share') == 'true' ? true : false; $data3['can_give_friend'] = $this->request->getPost('can_give_friend') == 'true' ? true : false; $data3['date_info'] = array('type' => 'DATE_TYPE_FIX_TIME_RANGE', 'begin_timestamp' => (int) strtotime($this->request->getPost('begin_timestamp')), 'end_timestamp' => (int) strtotime($this->request->getPost('end_timestamp'))); $card_type = strtolower($this->request->getPost('card_type')); $data1[$card_type]['base_info'] = $data3; $card_info = $this->di['wechat']->cardUpdate(json_encode($data1, JSON_UNESCAPED_UNICODE)); //print_r($card_info); if ($card_info) { $base['card_id'] = $data1['card_id']; $get_card_info = $this->di['wechat']->cardGet(json_encode($base, JSON_UNESCAPED_UNICODE)); $data3['status'] = $get_card_info->card->groupon->base_info->status; $res = $card->saveData($data3); if ($res) { echo '修改成功'; } else { echo '保存数据库失败,请刷新数据'; } } $this->view->disable(); }
<?php if ($_POST['InsertAds']) { if ($link != '') { uploads($file = 'picture', $folder = '../images/ads/'); mysql_query("INSERT INTO " . ads . " SET \n\t\t\t\tlink='" . $_POST['link'] . "',picture='{$picture}', title='" . $_POST['title'] . "',\n\t\t\t\tstt='" . $_POST['order'] . "',alignment='" . $_POST['alignment'] . "',\n\t\t\t\tpostdate='" . time() . "'"); echo "Thêm quảng cáo thành công"; } } if ($_POST['Ads']) { if ($_SESSION['modn'] == '1') { if ($link != '') { uploads($file = 'picture', $folder = '../images/ads/'); if ($picture == '') { $picture = $_POST['picture_hidden']; } else { unlink("../images/ads/" . $_POST['picture_hidden']); } mysql_query("UPDATE " . ads . " SET \n\t\t\t\tlink='" . $_POST['link'] . "',picture='{$picture}', title='" . $_POST['title'] . "',\n\t\t\t\tstt='" . $_POST['order'] . "',alignment='" . $_POST['alignment'] . "',\n\t\t\t\tpostdate='" . time() . "' WHERE id='" . intval($_GET['Edit']) . "'"); echo "Cập nhật quảng cáo thành công"; } } else { echo "<span id=\"thongbao\"> Bạn không có quyền thực hiện chức năng này </span>"; } } if ($_POST['ItemHid']) { if ($_SESSION['modn'] == '1') { $action = '';
/** * 会员添加修改数据库操作 * @author MaWei (http://www.phpyrb.com) * @date 2014-8-4 下午3:23:27 */ function addupdata() { $data = array(); $table = null; $type = $_REQUEST['type']; switch ($type) { case 'member': $_REQUEST['id'] && ($data['id'] = intval($_REQUEST['id'])); $data['uname'] = text($_REQUEST['name']); $data['email'] = text($_REQUEST['email']); $_REQUEST['passwd'] && ($data['passwd'] = sha1_encrypt(text($_REQUEST['passwd']))); $data['home'] = text($_REQUEST['home']); $data['status'] = intval($_REQUEST['status']); $data['qq'] = intval($_REQUEST['qq']); $data['sex'] = intval($_REQUEST['sex']); $data['grade'] = intval($_REQUEST['grade']); if ($_FILES['file']['name']) { $avatar = uploads(array('path' => 'avatar', 'ImgWidth' => 150, 'ImgHeight' => 150), true); $data['avatar'] = $avatar['thumb']; } $data['lasttime'] = time(); empty($_REQUEST['uid']) && ($data['registertime'] = time()); $data['lastip'] = get_client_ip(); $table = 'Member'; $jumpUrl = U('Admin/Member/index'); break; case 'grade': if (intval($_REQUEST['is_muti'])) { $name = $_REQUEST['name']; $grade = intval($_REQUEST['grade']); $type = intval($_REQUEST['gradetype']); if (strpos($name, ',') !== false) { $name = explode(',', $name); $data['type'] = $type; $i = 1; $reid = null; foreach ($name as $k => $v) { $data['name'] = text($v); $data['level'] = $i; $data['grade'] = $i * $grade; $reid = add_updata($data, 'Grade'); $i++; } if ($reid === false) { $this->error('保存失败!', U('Admin/Member/grade')); } else { $this->success('保存成功!', U('Admin/Member/grade')); } exit; } else { $data['name'] = text($name); $data['level'] = 1; $data['grade'] = $grade; } } else { $data['name'] = text($_REQUEST['name']); $data['level'] = intval($_REQUEST['level']); $data['grade'] = intval($_REQUEST['grade']); $data['type'] = intval($_REQUEST['gradetype']); } $table = 'Grade'; $jumpUrl = U('Admin/Member/grade'); break; case 'gradeType': $data['name'] = text($_REQUEST['name']); $data['alias'] = text($_REQUEST['alias']); $table = 'GradeType'; $jumpUrl = U('Admin/Member/gradeType'); break; default: $this->error('非法操作!', U('Admin/Member/index')); exit; } $reid = add_updata($data, $table); if ($reid === false) { $this->error('保存失败!', $jumpUrl); } else { $this->success('保存成功!', $jumpUrl); } }
<form method="post" action="" enctype="multipart/form-data"> <table width="95%" border="0" align="center" cellpadding="5" cellspacing="0"> <?php $sqlstr = mysql_query("SELECT * FROM " . userpost . " WHERE id='" . intval($id_1) . "'"); if (mysql_num_rows($sqlstr) > 0) { $row = mysql_fetch_array($sqlstr); ?> <tr> <td colspan="2" class="height_row"> <table border="0" align="left" cellpadding="3" cellspacing="0" width="100%"> <?php if ($_POST['UploadEdit']) { uploads($file = 'picture', $folder = 'images/product/'); if ($picture != '') { $path_src = "images/product/" . $picture; $path_desc = "images/product/thumb/" . $picture; $path_desc1 = "images/product/icon/" . $picture; crop($path_src, $path_desc, 100, 100); crop($path_src, $path_desc1, 26, 24); } if (is_file('images/product/' . $picture)) { @($_SESSION['picture3'] .= '|' . $picture); } } ?> <tr> <td colspan="2" > <div id="settyper" align="center">Chọn kiểu gõ <input value="1" name="typer" onClick="return Mudim.SetMethod(4);" type="radio"> Tự động <input checked="checked" value="1" name="typer" onClick="return Mudim.SetMethod(2);" type="radio"> Telex <input value="1" name="typer" onClick="return Mudim.SetMethod(1);" type="radio"> VNI <input value="0" name="typer" onClick="return Mudim.SetMethod(0);" type="radio"> Tắt</div> </td>
?> "> <script type="text/javascript" src="<?php echo $domain; ?> /css/mudim.js"></script> <form action="" method="post" enctype="multipart/form-data"> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="border"> <tr ><td class="proTop textLeftMenu" style="padding-left:10px;" colspan="2"><img src="<?php echo $domain; ?> /images/icon_muiten.gif" /> Đăng ký thành viên</td> </tr> <div style="text-align:left; color:#FF0000; width:400px"> <?php if ($_POST['Upload']) { uploads($file = 'picture', $folder = 'images/members/'); if (is_file('images/members/' . $picture)) { @($_SESSION['picture'] = $picture); } } if ($_POST['Send']) { echo "<tr><td colspan=2 style='text-align:left; color:#FF0000;text-align:center'>"; $submit = ''; if (text($_POST['code']) != @$_SESSION['code']) { $alert = "Mã xác nhận không chính xác"; $submit = true; } if (text($_POST['email']) == '') { $alert = "Mời bạn nhập địa chỉ Email"; $submit = true; }
function index() { dump($_FILES); dump(uploads()); $this->display(); }
/** * 书箱添加修改数据库 * @author MaWei (http://www.phpyrb.com) * @date 2014-8-7 下午10:45:59 */ function add_updata() { $data = array(); $_REQUEST['id'] && ($data['id'] = intval($_REQUEST['id'])); $data['cateid'] = intval($_REQUEST['cateid']); $data['price'] = intval($_REQUEST['price']); $data['score'] = intval($_REQUEST['score']); $data['status'] = intval($_REQUEST['status']); $data['title'] = h(text($_REQUEST['title'])); $data['author'] = h(text($_REQUEST['author'])); $data['publish'] = h(text($_REQUEST['publish'])); $data['book_base'] = h(text($_REQUEST['intro'])); if ($_FILES['file']['name']) { $avatar = uploads(array('path' => 'cover', 'ImgWidth' => 105, 'ImgHeight' => 160), true); $data['cover'] = $avatar['thumb']; } $_REQUEST['id'] ? $data['utime'] = time() : ($data['ctime'] = $data['utime'] = time()); $reid = add_updata($data, 'Book'); if ($reid === false) { $this->error('添加修改失败', U('Admin/Book/edit', array('id' => intval($_REQUEST['id'])))); } else { $this->success('添加修改成功', U('Admin/Book/index')); } }
/** * 书箱添加修改数据库 * @author MaWei (http://www.phpyrb.com) * @date 2014-8-7 下午10:45:59 */ function add_updata() { for ($i = 0; $i < 50; $i++) { $data = array(); $_REQUEST['id'] && ($data['id'] = intval($_REQUEST['id'])); $data['cateid'] = intval($_REQUEST['cateid']); $data['tagid'] = implode(',', $_REQUEST['tagids']); $data['grade'] = intval($_REQUEST['grade']); $data['status'] = $_REQUEST['status'] ? intval($_REQUEST['status']) : 1; $data['title'] = h(text($_REQUEST['title'])); $data['uid'] = $this->uid; $data['uptime'] = time(); $data['recommend'] = intval($_REQUEST['recommend']); $intro = text($_REQUEST['intro']); $data['keyword'] = text($_REQUEST['keyword']); $data['discription'] = $_REQUEST['discription'] ? $_REQUEST['discription'] : mb_substr($intro, 0, 150); if ($_FILES['cover']['name']) { $avatar = uploads(array('path' => 'cover', 'ImgWidth' => 105, 'ImgHeight' => 160, 'filename' => 'cover'), true); $data['cover'] = $avatar['thumb']; } $reid = add_updata($data, 'Sourc'); if ($reid === false) { $this->error('添加修改失败', U('Admin/Sourc/edit')); } else { $temp = array(); $temp['sourc_id'] = $_REQUEST['id'] ? intval($_REQUEST['id']) : $reid; $temp['intro'] = $intro; $temp['content'] = $_REQUEST['content']; $reid = add_updata($temp, 'SourcContent', 'sourc_id'); // if($reid === false){ // $this->error('添加修改失败',U('Admin/Sourc/index')); // } // $this->success('添加修改成功',U('Admin/Sourc/index')); } } }
<?php include "check.php"; ?> <div style="width:96%" align="left"><strong>THÊM SLIDE :</strong></div> <?php if ($_POST['InsertAds']) { uploads($file = 'picture', $folder = '../images/slide/'); mysql_query("INSERT INTO " . slide . " SET \r\n\t\t\t\tlink='" . $_POST['link'] . "',picture='{$picture}',stt='" . $_POST['order'] . "'"); echo "Thêm quảng cáo thành công"; } if ($_POST['Ads']) { uploads($file = 'picture', $folder = '../images/slide/'); if ($picture == '') { $picture = $_POST['picture_hidden']; } mysql_query("UPDATE " . slide . " SET \r\n\t\t\t\tlink='" . $_POST['link'] . "',picture='{$picture}',stt='" . $_POST['order'] . "' WHERE id='" . intval(@$_GET['Edit']) . "'"); echo "Cập nhật quảng cáo thành công"; } if ($_POST['ItemDel']) { $action = ''; if ($_POST['element'] == '') { echo '<script>alert(\'Mời bạn chọn ít nhất 1 bản tin\')</script>'; $action = true; } if ($action == '') { mysql_query("DELETE FROM " . slide . " WHERE id in (" . implode(",", $_POST['element']) . ")"); } } if ($_POST['ItemHid']) {