function member_create_qq($qq_openid, $avatar = '', $nickname = '', $gender = 0) { if (!empty($qq_openid)) { $qq_fans = mysqld_select("SELECT * FROM " . table('qq_qqfans') . " WHERE qq_openid=:qq_openid ", array(':qq_openid' => $qq_openid)); if (empty($qq_fans['qq_openid'])) { $row = array('nickname' => $nickname, 'gender' => intval($gender), 'qq_openid' => $qq_openid, 'avatar' => $avatar, 'createtime' => TIMESTAMP); mysqld_insert('qq_qqfans', $row); } else { $row = array('nickname' => $nickname, 'gender' => intval($gender), 'avatar' => $avatar); mysqld_update('qq_qqfans', $row, array('qq_openid' => $qq_openid)); } } }
public function do_formsubmit() { global $_GP; $id = intval($_GP['id']); $insert = array('list_id' => $id, 'str1' => $_GP['str1'], 'str2' => $_GP['str2'], 'str3' => $_GP['str3'], 'create_time' => time()); if (!empty($_GP['iscomment'])) { $insert['str1'] = $_GP['from']; $insert['str2'] = $_GP['content']; } $temp = mysqld_insert('addon10_scene_subscribe', $insert); if ($temp == false) { $return = array('data' => 200, 'success' => false, 'message' => iconv('gb2312', 'utf-8', iconv('gb2312', 'utf-8', '提交失败'))); die(json_encode($return)); } else { $return = array('data' => 200, 'success' => true, 'message' => iconv('gb2312', 'utf-8', '提交成功')); if (!empty($_GP['iscomment'])) { $return = array('data' => array('id' => $id, 'date' => date('Y-m-d H:i:s')), 'success' => 1, 'message' => iconv('gb2312', 'utf-8', '提交成功')); } die(json_encode($return)); } }
public function do_newkeupload() { global $_CMS; $result = array('url' => '', 'message' => '', 'error' => 0); if (!empty($_FILES['imgFile']['name'])) { if ($_FILES['imgFile']['error'] != 0) { $result['state'] = '上传失败,请重试!'; exit(json_encode($result)); } $file = $this->new_file_upload($_FILES['imgFile'], 'other'); if (is_error($file)) { $result['state'] = $file['message']; exit(json_encode($result)); } $result['url'] = $file['path']; $result['filename'] = $file['path']; mysqld_insert('attachment', array('uid' => $_CMS['account']['id'], 'filename' => $_FILES['imgFile']['name'], 'attachment' => $result['filename'], 'type' => 1, 'createtime' => TIMESTAMP)); exit(json_encode($result)); } else { $result['message'] = '请选择要上传的图片!'; $result['error'] = 1; exit(json_encode($result)); } }
<?php $code = $_GP['code']; require WEB_ROOT . '/system/modules/plugin/dispatch/' . $code . '/lang.php'; $item = mysqld_select("SELECT * FROM " . table('dispatch') . " WHERE code = :code", array(':code' => $code)); if (empty($item['id'])) { $data = array('code' => $code, 'name' => $_LANG['dispatch_' . $code . '_name'], 'desc' => $_LANG['dispatch_' . $code . '_desc'], 'enabled' => '1', 'sendtype' => $_LANG['dispatch_' . $code . '_sendtype']); mysqld_insert('dispatch', $data); } else { $data = array('name' => $_LANG['dispatch_' . $code . '_name'], 'desc' => $_LANG['dispatch_' . $code . '_desc'], 'enabled' => '1', 'sendtype' => $_LANG['dispatch_' . $code . '_sendtype']); mysqld_update('dispatch', $data, array('code' => $code)); } message("操作成功", create_url('site', array('name' => 'modules', 'do' => 'dispatch', 'op' => 'display')));
} $paymentlist = mysqld_selectall("select * from " . table("payment") . " where `enabled`=1 and `code`!='gold' and `online`=1 {$paymentconfig} "); $paymentscount = mysqld_selectcolumn("select count(id) from " . table("payment") . " where `enabled`=1 and `code`!='gold' and `online`=1 {$paymentconfig} "); if (empty($paymentscount)) { message("未找到可用的在线支付方式,暂时不支持余额充值。"); } if (checksubmit("submit")) { if (empty($_GP['charge']) || round($_GP['charge'], 2) <= 0) { message("请输入要充值的金额"); } $paytypecode = $_GP['paymentcode']; if (empty($paytypecode)) { message("请选择充值方式。"); } $payment = mysqld_select("select * from " . table("payment") . " where `enabled`=1 and `code`=:code and `code`!='gold' and `online`=1", array('code' => $paytypecode)); if (empty($payment['id'])) { message("未找到付款方式,付款失败"); } $goodtitle = "余额充值" . $_GP['charge'] . "元"; $ordersn = 'bg' . date('Ymd') . random(6, 1); $gold_order = mysqld_select("SELECT * FROM " . table('gold_order') . " WHERE ordersn = '{$ordersn}'"); if (!empty($gold_order['ordersn'])) { $ordersn = 'bg' . date('Ymd') . random(6, 1); } $insert = array('openid' => $openid, 'ordersn' => $ordersn, 'price' => $_GP['charge'], 'status' => 0, 'createtime' => TIMESTAMP); mysqld_insert('gold_order', $insert); $order = mysqld_select("SELECT * FROM " . table('gold_order') . " WHERE ordersn = '{$ordersn}' and openid='{$openid}'"); require WEB_ROOT . '/system/modules/plugin/payment/' . $paytypecode . '/gold_payaction.php'; exit; } include themePage('rechargegold');
} if (empty($_GP['third_login'])) { if (empty($_GP['pwd'])) { message("请输入密码!"); } $pwd = md5($_GP['pwd']); } else { $pwd = ''; } $shop_regcredit = intval($cfg['shop_regcredit']); $openid = date("YmdH", time()) . rand(100, 999); $hasmember = mysqld_select("SELECT * FROM " . table('member') . " WHERE openid = :openid ", array(':openid' => $openid)); if (!empty($hasmember['openid'])) { $openid = date("YmdH", time()) . rand(100, 999); } $data = array('mobile' => $_GP['mobile'], 'pwd' => $pwd, 'createtime' => time(), 'status' => 1, 'istemplate' => 0, 'experience' => 0, 'openid' => $openid); mysqld_insert('member', $data); if (!empty($shop_regcredit)) { member_credit($openid, $shop_regcredit, "addcredit", "注册系统赠送积分"); } $member = get_session_account(); $oldsessionid = $member['openid']; $loginid = save_member_login('', $openid); integration_session_account($loginid, $oldsessionid); message('注册成功!', to_member_loginfromurl(), 'success'); } $qqlogin = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE enabled=1 and `code`='qq'"); if (!empty($qqlogin) && !empty($qqlogin['id'])) { $showqqlogin = true; } include themePage('regedit');
<?php $code = $_GP['code']; require WEB_ROOT . '/system/modules/plugin/thirdlogin/' . $code . '/lang.php'; $item = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE code = :code", array(':code' => $code)); if (empty($item['id'])) { $data = array('code' => $code, 'name' => $_LANG['thirdlogin_' . $code . '_name'], 'enabled' => '0'); mysqld_insert('thirdlogin', $data); } else { $data = array('name' => $_LANG['thirdlogin_' . $code . '_name']); mysqld_update('thirdlogin', $data, array('code' => $code)); } $this->do_thirdlogin_config();
<?php if (checksubmit("submit")) { $insert = array('title' => $_GP['title'], 'amount' => intval($_GP['amount']), 'endtime' => strtotime($_GP['endtime']), 'price' => $_GP['price'], 'gold' => $_GP['gold'], 'awardtype' => intval($_GP['awardtype']), 'credit_cost' => intval($_GP['credit_cost']), 'createtime' => time(), "deleted" => 0, 'content' => htmlspecialchars_decode($_GP['content'])); if (!empty($_FILES['logo']['tmp_name'])) { $upload = file_upload($_FILES['logo']); if (is_error($upload)) { message($upload['message'], '', 'error'); } $logo = $upload['path']; } if (!empty($logo)) { $insert['logo'] = $logo; } mysqld_insert('addon7_award', $insert); message('保存成功', web_url('awardlist'), 'success'); } include addons_page('award');
$ids = $option_idss[$k]; $idsarr = explode("_", $ids); $newids = array(); foreach ($idsarr as $key => $ida) { foreach ($spec_items as $it) { if ($it['get_id'] == $ida) { $newids[] = $it['id']; break; } } } $newids = implode("_", $newids); $a = array("title" => $_GP['option_title_' . $ids][0], "productprice" => $_GP['option_productprice_' . $ids][0], "costprice" => $_GP['option_costprice_' . $ids][0], "marketprice" => $_GP['option_marketprice_' . $ids][0], "stock" => $_GP['option_stock_' . $ids][0], "weight" => $_GP['option_weight_' . $ids][0], "goodsid" => $id, "specs" => $newids); $totalstocks += $a['stock']; if (empty($get_option_id)) { mysqld_insert("shop_goods_option", $a); $option_id = mysqld_insertid(); } else { mysqld_update("shop_goods_option", $a, array('id' => $get_option_id)); $option_id = $get_option_id; } $optionids[] = $option_id; } if (count($optionids) > 0) { mysqld_query("delete from " . table('shop_goods_option') . " where goodsid={$id} and id not in ( " . implode(',', $optionids) . ")"); } else { mysqld_query("delete from " . table('shop_goods_option') . " where goodsid={$id}"); } //总库存 if ($totalstocks > 0) { mysqld_update("shop_goods", array("total" => $totalstocks), array("id" => $id));
if ($order['status'] == 0) { mysqld_update('gold_order', array('status' => 1), array('id' => $order['id'])); mysqld_insert('paylog', array('typename' => '余额充值成功', 'pdate' => $post_data, 'ptype' => 'success', 'paytype' => 'alipay')); member_gold($order['openid'], $order['price'], 'addgold', '余额在线充值-支付宝支付'); } message('余额充值成功!', WEBSITE_ROOT . 'index.php?mod=mobile&name=shopwap&do=fansindex', 'success'); } else { mysqld_insert('paylog', array('typename' => '余额充值未找到订单', 'pdate' => $post_data, 'ptype' => 'error', 'paytype' => 'alipay')); message('余额充值未找到订单!', WEBSITE_ROOT . 'index.php?mod=mobile&name=shopwap&do=fansindex', 'error'); exit; } } } $response_msg = "trade_status=" . $_GET['trade_status']; } else { mysqld_insert('paylog', array('typename' => '验证失败', 'pdate' => $post_data, 'ptype' => 'error', 'paytype' => 'alipay')); $response_msg = $response_msg . "验证失败"; } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>支付宝手机网站支付接口</title> </head> <body> <?php echo $response_msg; ?> </body> </html>
<?php $setting = mysqld_select("SELECT * FROM " . table('addon7_config')); if (checksubmit("submit")) { $cfg = array('title' => $_GP['title']); mysqld_delete('addon7_config', array()); mysqld_insert('addon7_config', $cfg); message('保存成功', 'refresh', 'success'); } include addons_page('setting');
if (is_error($upload)) { message($upload['message'], '', 'error'); } $data['cover2'] = $upload['path']; } if (!empty($_GP['bg_music_url_del'])) { $data['bg_music_url'] = ''; } if (!empty($_FILES['bg_music_url']['tmp_name'])) { $upload = file_upload($_FILES['bg_music_url'], 'music'); if (is_error($upload)) { message($upload['message'], '', 'error'); } $data['bg_music_url'] = $upload['path']; } mysqld_insert('addon10_scene_list', $data); message("添加成功", create_url('site', array('name' => 'addon10', 'do' => 'scene', 'op' => 'setting', 'id' => mysqld_insertid())), "success"); } else { $fields = array('title', 'reply_title', 'reply_description', 'share_title', 'share_content', 'share_cb_url', 'share_cb_tel', 'first_type', 'first_btn_select', 'first_btn_url', 'first_btn_tel', 'bg_music_switch', 'bg_music_icon', 'cover_title', 'cover_subtitle', 'tongji'); $data = array(); foreach ($_GP as $k => $v) { if (in_array($k, $fields)) { $data[$k] = $_GP[$k]; } } if (!empty($theme)) { $data['theme'] = $theme; } if (!empty($_GP['reply_thumb_del'])) { $data['reply_thumb'] = ''; }
<?php $code = $_GP['code']; require WEB_ROOT . '/system/modules/plugin/payment/' . $code . '/lang.php'; $item = mysqld_select("SELECT * FROM " . table('payment') . " WHERE code = :code", array(':code' => $code)); if (empty($item['id'])) { $data = array('code' => $code, 'name' => $_LANG['payment_' . $code . '_name'], 'desc' => $_LANG['payment_' . $code . '_desc'], 'enabled' => '0', 'iscod' => $_LANG['payment_' . $code . '_iscod'], 'online' => $_LANG['payment_' . $code . '_online']); mysqld_insert('payment', $data); } else { $data = array('name' => $_LANG['payment_' . $code . '_name'], 'desc' => $_LANG['payment_' . $code . '_desc'], 'iscod' => $_LANG['payment_' . $code . '_iscod'], 'online' => $_LANG['payment_' . $code . '_online']); mysqld_update('payment', $data, array('code' => $code)); } $this->do_payment_config();
if ($op == 'display') { if (checksubmit('submit')) { if (empty($_GP['charge']) || round($_GP['charge'], 2) <= 0) { message("请输入要充值的金额"); } $fee = round($_GP['charge'], 2); if ($fee > $member['gold']) { message('账户余额不足,最多能提取' . $member['gold'] . '元'); } $ordersn = 'rg' . date('Ymd') . random(6, 1); $gold_order = mysqld_select("SELECT * FROM " . table('gold_teller') . " WHERE ordersn = '{$ordersn}'"); if (!empty($gold_order['ordersn'])) { $ordersn = 'rg' . date('Ymd') . random(6, 1); } member_gold($openid, $fee, 'usegold', '余额提取' . $fee . '元'); mysqld_insert('gold_teller', array('openid' => $openid, 'fee' => $fee, 'status' => 0, 'ordersn' => $ordersn, 'createtime' => time())); message('余额提取申请成功!', 'refresh', 'success'); exit; } $applygold = mysqld_selectcolumn("select sum(fee) from " . table("gold_teller") . " where status=0 and openid=" . $openid); if (empty($applygold)) { $applygold = '0'; } include themePage('outchargegold'); exit; } if ($op == 'history') { $pindex = max(1, intval($_GP['page'])); $psize = 20; $list = mysqld_selectall("select * from " . table("gold_teller") . " where openid=:openid order by createtime desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(":openid" => $openid)); $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('gold_teller') . " where openid=:openid ", array(":openid" => $openid));
message('商品不能空', refresh(), 'error'); } if (checksubmit("submit")) { $optionid = intval($_GP['optionid']); $option = mysqld_select("select * from " . table("shop_goods_option") . " where id=:id limit 1", array(":id" => $optionid)); if ($item['status'] != 3) { message('订单未完成不能评论', refresh(), 'error'); } if (empty($_GP['rsreson'])) { message('请输入评论内容', refresh(), 'error'); } $shop_order_goods = mysqld_select("select * from " . table("shop_order_goods") . " where id=:id limit 1", array(":id" => $ogsid)); if (!empty($shop_order_goods['iscomment'])) { message('订单已评论', refresh(), 'error'); } mysqld_insert('shop_goods_comment', array('createtime' => time(), 'rate' => $_GP['rate'], 'ordersn' => $item['ordersn'], 'optionname' => $option['title'], 'goodsid' => $shop_order['goodsid'], 'comment' => $_GP['rsreson'], 'orderid' => $orderid, 'openid' => $openid)); mysqld_update('shop_order_goods', array('iscomment' => 1), array('id' => $ogsid)); message('评论成功!', mobile_url('myorder', array('status' => intval($_GP['fromstatus']))), 'success'); } include themePage('order_detail_comment'); exit; } if ($op == 'returnpay') { $orderid = intval($_GP['orderid']); $item = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE id = :id AND openid = :openid", array(':id' => $orderid, ':openid' => $openid)); $dispatch = mysqld_select("select id,dispatchname,sendtype from " . table('shop_dispatch') . " where id=:id limit 1", array(":id" => $item['dispatch'])); if (empty($item)) { message('抱歉,您的订单不存在或是已经被取消!', mobile_url('myorder'), 'error'); } $opname = "退款"; if (checksubmit("submit")) {
function member_gold($openid, $fee, $type, $remark) { $member = member_get($openid); if (!empty($member['openid'])) { if (!is_numeric($fee) || $fee < 0) { message("输入数字非法,请重新输入"); } if ($type == 'addgold') { $data = array('remark' => $remark, 'type' => $type, 'fee' => $fee, 'account_fee' => $member['gold'] + $fee, 'createtime' => TIMESTAMP, 'openid' => $openid); mysqld_insert('member_paylog', $data); mysqld_update('member', array('gold' => $member['gold'] + $fee), array('openid' => $openid)); return true; } if ($type == 'usegold') { if ($member['gold'] >= $fee) { $data = array('remark' => $remark, 'type' => $type, 'fee' => $fee, 'account_fee' => $member['gold'] - $fee, 'createtime' => TIMESTAMP, 'openid' => $openid); mysqld_insert('member_paylog', $data); mysqld_update('member', array('gold' => $member['gold'] - $fee), array('openid' => $openid)); return true; } } } return false; }
<?php if (!empty($_FILES['imgFile']['name'])) { if ($_FILES['imgFile']['error'] != 0) { $result['message'] = '上传失败,请重试!'; exit(json_encode($result)); } $file = file_upload($_FILES['imgFile'], 'image'); if (is_error($file)) { $result['message'] = $file['message']; exit(json_encode($result)); } $result['url'] = $file['url']; $result['error'] = 0; $result['filename'] = $file['path']; $result['url'] = WEBSITE_ROOT . 'attachment/' . $result['filename']; $filename = basename($result['url']); mysqld_insert('attachment', array('uid' => $_CMS['account']['id'], 'filename' => $filename, 'attachment' => $result['filename'], 'type' => 1, 'createtime' => TIMESTAMP)); exit(json_encode($result)); } else { $result['message'] = '请选择要上传的图片!'; exit(json_encode($result)); }
$option = mysqld_select("select marketprice,stock from " . table('shop_goods_option') . " where id=:id limit 1", array(":id" => $optionid)); if (!empty($option)) { $marketprice = $option['marketprice']; $goodsOptionStock = $option['stock']; } } if ($goodsOptionStock <= $total && $goodsOptionStock != -1) { $result = array('result' => 0, 'maxbuy' => $goodsOptionStock); die(json_encode($result)); exit; } $row = mysqld_select("SELECT id, total FROM " . table('shop_cart') . " WHERE session_id = :session_id AND goodsid = :goodsid and optionid=:optionid", array(':session_id' => $openid, ':goodsid' => $goodsid, ':optionid' => $optionid)); if ($row == false) { //不存在 $data = array('goodsid' => $goodsid, 'goodstype' => $goods['type'], 'marketprice' => $marketprice, 'session_id' => $openid, 'total' => $total, 'optionid' => $optionid); mysqld_insert('shop_cart', $data); } else { //累加最多限制购买数量 $t = $total + $row['total']; //存在 $data = array('marketprice' => $marketprice, 'total' => $t, 'optionid' => $optionid); mysqld_update('shop_cart', $data, array('id' => $row['id'])); } //返回数据 $carttotal = $this->getCartTotal(); $result = array('result' => 1, 'total' => $carttotal); die(json_encode($result)); } else { if ($op == 'clear') { mysqld_delete('shop_cart', array('session_id' => $openid)); die(json_encode(array("result" => 1)));
} elseif ($insert['m_type'] == 7) { $data = $_GP['seventh']; } elseif ($insert['m_type'] == 8) { $data = $_GP['eighth']; } elseif ($insert['m_type'] == 9) { $data = $_GP['ninth']; } elseif ($insert['m_type'] == 10) { $data = $_GP['tenth']; } if (!empty($data)) { $insert['param'] = serialize($data); } else { $insert['param'] = ''; } if ($item == false) { $temp = mysqld_insert('addon10_scene_page', $insert); } else { $temp = mysqld_update('addon10_scene_page', $insert, array('id' => $item['id'])); } if ($temp == false) { $this->ajaxmessage('数据提交失败'); } else { $this->ajaxmessage('数据提交成功', web_url('scene_page', array('listid' => $list_id, 'op' => 'display')), 'success'); } } $uploadfolder = WEB_ROOT . '/attachment/image/addon10/'; mkdirs($uploadfolder); $tmpfoldername = random(15); copy(ADDONS_ROOT . 'addon10/style/img/default_bg.jpg', $uploadfolder . $tmpfoldername . 'jpg'); $tmpfoldername2 = random(15); copy(ADDONS_ROOT . 'addon10/style/img/default_btn.png', $uploadfolder . $tmpfoldername2 . 'png');
public function do_user() { global $_GP; $operation = !empty($_GP['op']) ? $_GP['op'] : 'listuser'; if ($operation == 'listuser') { $list = mysqld_selectall("select * from " . table('user')); include page('listuser'); } if ($operation == 'rule') { $allrule = mysqld_selectall('SELECT * FROM ' . table('rule')); $id = $_GP['id']; $account = mysqld_select('SELECT * FROM ' . table('user') . " WHERE id=:id", array(':id' => $id)); $username = $account['username']; $userRule = mysqld_selectall('SELECT * FROM ' . table('user_rule') . " WHERE uid=:uid", array(':uid' => $id)); foreach ($allrule as $key => $item) { foreach ($userRule as $rule) { if ($item['modname'] == $rule['modname'] && $item['moddo'] == $rule['moddo']) { $allrule[$key]['check'] = true; } } } if (checksubmit('submit')) { if (empty($id)) { message('操作异常', refresh(), 'error'); } if (!empty($account['id'])) { mysqld_delete('user_rule', array('uid' => $account['id'])); foreach ($allrule as $item) { if (!empty($_GP[$item['modname'] . '-' . $item['moddo']])) { $data = array('uid' => $account['id'], 'modname' => $item['modname'], 'moddo' => $item['moddo']); mysqld_insert('user_rule', $data); } } } message('权限修改成功!', refresh(), 'succes'); } include page('rule'); } if ($operation == 'deleteuser') { mysqld_delete('user', array('id' => $_GP['id'])); mysqld_delete('user_rule', array('uid' => $_GP['id'])); message('删除成功', refresh(), 'success'); } if ($operation == 'changepwduser') { $account = mysqld_select('SELECT * FROM ' . table('user') . " WHERE id=:id", array(':id' => $_GP['id'])); $username = $account['username']; $id = $account['id']; if (checksubmit('submit')) { if (empty($_GP['newpassword'])) { message('密码不能为空', refresh(), 'error'); } if (!empty($account['id'])) { if ($_GP['newpassword'] != $_GP['confirmpassword']) { message('两次密码不一致!', refresh(), 'error'); } $data = array('password' => md5($_GP['newpassword'])); mysqld_update('user', $data, array('id' => $account['id'])); message('密码修改成功!', create_url('site', array('name' => 'user', 'do' => 'listuser')), 'succes'); } else { message($_GP['username'] . '用户名已存在', refresh(), 'error'); } } include page('changepwd'); } if ($operation == 'adduser') { $allrule = mysqld_selectall('SELECT * FROM ' . table('rule')); if (checksubmit('submit')) { if (empty($_GP['username']) || empty($_GP['newpassword'])) { message('用户名或密码不能为空', refresh(), 'success'); } $account = mysqld_select('SELECT * FROM ' . table('user') . " WHERE username=:username", array(':username' => $_GP['username'])); if (empty($account['id'])) { if ($_GP['newpassword'] != $_GP['confirmpassword']) { message('两次密码不一致!', refresh(), 'error'); } $data = array('username' => $_GP['username'], 'password' => md5($_GP['newpassword'])); mysqld_insert('user', $data); $account = mysqld_select('SELECT * FROM ' . table('user') . " WHERE username=:username", array(':username' => $_GP['username'])); if (!empty($account['id'])) { mysqld_delete('user_rule', array('uid' => $account['id'])); foreach ($allrule as $item) { if (!empty($_GP[$item['modname'] . '-' . $item['moddo']])) { $data = array('uid' => $account['id'], 'modname' => $item['modname'], 'moddo' => $item['moddo']); mysqld_insert('user_rule', $data); } } } message('新增用户成功!', web_url('user'), 'succes'); } else { message($_GP['username'] . '用户名已存在', refresh(), 'error'); } } include page('adduser'); } }
} if (!empty($parentid)) { $parent = mysqld_select("SELECT id, name FROM " . table('addon8_article_category') . " WHERE id = '{$parentid}'"); if (empty($parent)) { message('抱歉,上级分类不存在或是已经被删除!', web_url('post'), 'error'); } } if (checksubmit('submit')) { if (empty($_GP['catename'])) { message('抱歉,请输入分类名称!'); } $data = array('name' => $_GP['catename'], 'deleted' => 0, 'displayorder' => intval($_GP['displayorder']), 'icon' => $_GP['icon'], 'parentid' => intval($parentid)); if (!empty($id)) { unset($data['parentid']); mysqld_update('addon8_article_category', $data, array('id' => $id)); } else { mysqld_insert('addon8_article_category', $data); $id = mysqld_insertid(); } message('更新分类成功!', web_url('category', array('op' => 'display')), 'success'); } include addons_page('category'); } elseif ($operation == 'delete') { $id = intval($_GP['id']); $category = mysqld_select("SELECT id, parentid FROM " . table('addon8_article_category') . " WHERE id = '{$id}' and deleted=0 "); if (empty($category)) { message('抱歉,分类不存在或是已经被删除!', web_url('category', array('op' => 'display')), 'error'); } mysqld_update('addon8_article_category', array('deleted' => 1), array('id' => $id, 'parentid' => $id), 'OR'); message('分类删除成功!', web_url('category', array('op' => 'display')), 'success'); }
message('支付成功!', WEBSITE_ROOT . mobile_url('myorder', array('status' => 1)), 'success'); } else { message('该订单不是支付状态无法支付', WEBSITE_ROOT . 'index.php?mod=mobile&name=shopwap&do=myorder', 'error'); } } else { mysqld_insert('paylog', array('typename' => '未找到相关订单', 'pdate' => $xml, 'ptype' => 'error', 'paytype' => 'weixin')); message('未找到相关订单', WEBSITE_ROOT . 'index.php?mod=mobile&name=shopwap&do=myorder', 'error'); } exit; } else { //余额充值 $order = mysqld_select("SELECT * FROM " . table('gold_order') . " WHERE id = :id and ordersn=:ordersn", array(':id' => $orderid, ':ordersn' => $ordersn)); if (!empty($order['id'])) { if ($order['status'] == 0) { mysqld_update('gold_order', array('status' => 1), array('id' => $order['id'])); mysqld_insert('paylog', array('typename' => '余额充值成功', 'pdate' => $xml, 'ptype' => 'success', 'paytype' => 'weixin')); member_gold($order['openid'], $order['price'], 'addgold', '余额在线充值-微支付'); message('余额充值成功!', WEBSITE_ROOT . 'index.php?mod=mobile&name=shopwap&do=fansindex', 'success'); } exit; } else { mysqld_insert('paylog', array('typename' => '余额充值未找到订单', 'pdate' => $xml, 'ptype' => 'error', 'paytype' => 'weixin')); message('未找余额充值订单', WEBSITE_ROOT . 'index.php?mod=mobile&name=shopwap&do=fansindex', 'error'); exit; } } } mysqld_insert('paylog', array('typename' => '微支付出现错误', 'pdate' => $xml, 'ptype' => 'error', 'paytype' => 'weixin')); } else { mysqld_insert('paylog', array('typename' => '签名验证失败', 'pdate' => $xml, 'ptype' => 'error', 'paytype' => 'weixin')); }
$auth_code = $_GP["auth_code"]; require_once WEB_ROOT . '/includes/lib/alipaySDK/UserInfo.php'; $userinfo = new UserInfo(); $alipay_user = $userinfo->getUserInfo($auth_code); if (!empty($alipay_user)) { $alipay_openid = $user_info_resp->user_id; if (!empty($alipay_openid) && (!empty($_SESSION[MOBILE_ALIPAY_OPENID]) && $_SESSION[MOBILE_ALIPAY_OPENID] != $alipay_openid) || empty($_SESSION[MOBILE_ALIPAY_OPENID])) { $nickname = characet($user_info_resp->deliver_fullname); $follow = 1; $avatar = $user_info_resp->avatar; $gender = $user_info_resp->gender; $gender = $gender == 'F' ? 2 : ($gender == 'M' ? 1 : 0); $fans = mysqld_select("SELECT * FROM " . table('alipay_alifans') . " WHERE alipay_openid=:alipay_openid ", array(':alipay_openid' => $alipay_openid)); if (empty($fans['alipay_openid'])) { $row = array('nickname' => $nickname, 'follow' => $follow, 'gender' => intval($gender), 'alipay_openid' => $alipay_openid, 'avatar' => '', 'createtime' => TIMESTAMP); mysqld_insert('alipay_alifans', $row); if (!empty($avatar)) { mysqld_update('alipay_alifans', array('avatar' => $avatar), array('alipay_openid' => $alipay_openid)); } } else { $row = array('nickname' => $nickname, 'follow' => $follow, 'gender' => intval($gender), 'avatar' => ''); mysqld_update('alipay_alifans', $row, array('alipay_openid' => $alipay_openid)); if (!empty($avatar)) { mysqld_update('alipay_alifans', array('avatar' => $avatar), array('alipay_openid' => $alipay_openid)); } } $_SESSION[MOBILE_ALIPAY_OPENID] = $alipay_openid; $sessionAccount = array('openid' => $alipay_openid); $_SESSION[MOBILE_SESSION_ACCOUNT] = $sessionAccount; member_login_alipay($alipay_openid); }
public function do_getaward() { global $_GP; $reply = mysqld_select("SELECT * FROM " . table("bigwheel_reply") . " ORDER BY `id` DESC"); $member = get_member_account(true, intval($reply['needreg']) == 1); $openid = $member['openid']; $from_user = $openid; if ($reply == false) { $this->message(); } if ($reply['isshow'] != 1) { //活动已经暂停,请稍后... $this->message(array("success" => 2, "msg" => '活动暂停,请稍后...'), ""); } if ($reply['starttime'] > time()) { $this->message(array("success" => 2, "msg" => '活动还没有开始呢,请等待...'), ""); } $endtime = $reply['endtime'] + 68399; if ($endtime < time()) { $this->message(array("success" => 2, "msg" => '活动已经结束了,下次再来吧!'), ""); } $fansID = 0; //第一步,判断有没有已经领取奖品了,如果领取了,则不能再领取了 $fans = mysqld_select("SELECT * FROM " . table("bigwheel_fans") . " WHERE from_user='******'"); if ($fans == false) { //不存在false的情况,如果是false,则表明是非法 //$this->message(); $fans = array('fansID' => $fansID, 'from_user' => $openid, 'todaynum' => 0, 'totalnum' => 0, 'awardnum' => 0, 'createtime' => time()); mysqld_insert("bigwheel_fans", $fans); $fans['id'] = mysqld_insertid(); } //更新当日次数 $nowtime = mktime(0, 0, 0); if ($fans['last_time'] < $nowtime) { $fans['todaynum'] = 0; } //判断总次数超过限制,一般情况不会到这里的,考虑特殊情况,回复提示文字msg,便于测试 if ($fans['totalnum'] >= $reply['number_times'] && $reply['number_times'] > 0) { // $this->message('', '超过抽奖总限制次数'); $this->message(array("success" => 2, "msg" => '您超过抽奖总次数了,不能抽奖了!'), ""); } //判断当日是否超过限制,一般情况不会到这里的,考虑特殊情况,回复提示文字msg,便于测试 if ($fans['todaynum'] >= $reply['most_num_times'] && $reply['most_num_times'] > 0) { //$this->message('', '超过当日限制次数'); $this->message(array("success" => 2, "msg" => '您超过当日抽奖次数了,不能抽奖了!'), ""); } $last_time = strtotime(date("Y-m-d", mktime(0, 0, 0))); //当天抽奖次数 mysqld_update('bigwheel_fans', array('todaynum' => $fans['todaynum'] + 1, 'last_time' => $last_time), array('id' => $fans['id'])); //总抽奖次数 mysqld_update('bigwheel_fans', array('totalnum' => $fans['totalnum'] + 1), array('id' => $fans['id'])); $gifts = array("one" => array("name" => $reply['c_name_one'], "type" => $reply['c_type_one'], "probalilty" => $reply['c_rate_one'], "total" => $reply['c_num_one'], "draw" => $reply['c_draw_one']), "two" => array("name" => $reply['c_name_two'], "type" => $reply['c_type_two'], "probalilty" => $reply['c_rate_two'], "total" => $reply['c_num_two'], "draw" => $reply['c_draw_two']), "three" => array("name" => $reply['c_name_three'], "type" => $reply['c_type_three'], "probalilty" => $reply['c_rate_three'], "total" => $reply['c_num_three'], "draw" => $reply['c_draw_three']), "four" => array("name" => $reply['c_name_four'], "type" => $reply['c_type_four'], "probalilty" => $reply['c_rate_four'], "total" => $reply['c_num_four'], "draw" => $reply['c_draw_four']), "five" => array("name" => $reply['c_name_five'], "type" => $reply['c_type_five'], "probalilty" => $reply['c_rate_five'], "total" => $reply['c_num_five'], "draw" => $reply['c_draw_five']), "six" => array("name" => $reply['c_name_six'], "type" => $reply['c_type_six'], "probalilty" => $reply['c_rate_six'], "total" => $reply['c_num_six'], "draw" => $reply['c_draw_six'])); //计算每个礼物的概率 $probability = 0; $rate = 1; $award = array(); $awards = array(); //奖品名字 (同时可中多个奖品,然后随机派奖) foreach ($gifts as $name => $gift) { if ($gift['total'] - $gift['draw'] <= 0) { continue; } if (empty($gift['probalilty'])) { continue; } $probability = $gift['probalilty']; if ($probability < 1) { $temp = explode('.', $probability); $temp = pow(10, strlen($temp[1])); $rate = $temp < $rate ? $rate : $temp; $probability = $probability * $rate; } $award[] = array('prizetype' => $name, 'name' => $gift['name'], 'probalilty' => $probability, 'total' => $gift['total']); } $all = 100 * $rate; mt_srand((double) microtime() * 1000000); $rand = mt_rand(1, $all); foreach ($award as $gift) { if ($rand > 0 && $rand <= $gift['probalilty'] && $gift['total'] > 0) { $awards[] = $gift['prizetype']; } } $prizetype = ""; $awardtype = ""; $awardname = ""; if (count($awards) > 0) { mt_srand((double) microtime() * 1000000); $randid = mt_rand(0, count($awards) - 1); $prizetype = $awards[$randid]; $awardtype = $gifts[$prizetype]['type']; $awardname = $gifts[$prizetype]['name']; } if (!empty($prizetype) && (!empty($reply['award_times']) && $fans['awardnum'] < $reply['award_times']) || empty($reply['award_times'])) { //中奖 $sn = random(16); mysqld_update('bigwheel_reply', array('c_draw_' . $prizetype => $reply['c_draw_' . $prizetype] + 1), array('id' => $reply['id'])); //保存sn到award中 $insert = array('fansID' => $fansID, 'from_user' => $from_user, 'name' => $awardtype, 'description' => $awardname, 'prizetype' => $prizetype, 'award_sn' => $sn, 'createtime' => time(), 'status' => 1); $temp = mysqld_insert('bigwheel_award', $insert); //保存中奖人信息到fans中 mysqld_update('bigwheel_fans', array('awardnum' => $fans['awardnum'] + 1), array('id' => $fans['id'])); $k = 0; if ($prizetype == 'one') { $k = 1; } else { if ($prizetype == 'two') { $k = 2; } } if ($prizetype == 'three') { $k = 3; } if ($prizetype == 'four') { $k = 4; } if ($prizetype == 'five') { $k = 5; } if ($prizetype == 'six') { $k = 6; } $data = array('name' => $reply['c_type_' . $prizetype], 'award' => $reply['c_name_' . $prizetype], 'sn' => $sn, 'success' => 1, 'prizetype' => $k); $this->message($data); } $this->message(); }
$returnurl = urldecode($_GP['returnurl']); $operation = $_GP['op']; if ($operation == 'post') { $id = intval($_GP['id']); $data = array('openid' => $openid, 'realname' => $_GP['realname'], 'mobile' => $_GP['mobile'], 'province' => $_GP['province'], 'city' => $_GP['city'], 'area' => $_GP['area'], 'address' => $_GP['address']); if (empty($_GP['realname']) || empty($_GP['mobile']) || empty($_GP['address'])) { message('请输完善您的资料!'); } if (!empty($id)) { unset($data['openid']); mysqld_update('shop_address', $data, array('id' => $id)); message($id, '', 'ajax'); } else { mysqld_update('shop_address', array('isdefault' => 0), array('openid' => $openid)); $data['isdefault'] = 1; mysqld_insert('shop_address', $data); $id = mysqld_insertid(); if (!empty($id)) { message($id, '', 'ajax'); } else { message(0, '', 'ajax'); } } } elseif ($operation == 'default') { $id = intval($_GP['id']); mysqld_update('shop_address', array('isdefault' => 0), array('openid' => $openid)); mysqld_update('shop_address', array('isdefault' => 1), array('id' => $id)); message(1, '', 'ajax'); } elseif ($operation == 'detail') { $id = intval($_GP['id']); $row = mysqld_select("SELECT id, realname, mobile, province, city, area, address FROM " . table('shop_address') . " WHERE id = :id", array(':id' => $id));
if (checksubmit()) { if (empty($_GP['id'])) { $count = mysqld_selectcolumn('SELECT count(id) FROM ' . table('alipay_rule') . " WHERE keywords = :keywords", array(':keywords' => $_GP['keywords'])); if ($count > 0) { message('触发关键字' . $_GP['keywords'] . "已存在!"); } if (!empty($_FILES['thumb']['tmp_name'])) { file_delete($_GP['thumb_old']); $upload = file_upload($_FILES['thumb']); if (is_error($upload)) { message($upload['message'], '', 'error'); } $thumb = $upload['path']; } $data = array('title' => $_GP['title'], 'ruletype' => $_GP['ruletype'], 'keywords' => $_GP['keywords'], 'thumb' => $thumb, 'description' => $_GP['description'], 'url' => $_GP['url']); mysqld_insert('alipay_rule', $data); message('保存成功!', 'refresh', 'success'); } else { if ($rule['keywords'] != $_GP['keywords']) { $count = mysqld_selectcolumn('SELECT count(id) FROM ' . table('alipay_rule') . " WHERE keywords = :keywords", array(':keywords' => $_GP['keywords'])); if ($count > 0) { message('触发关键字' . $_GP['keywords'] . "已存在!"); } } if (!empty($_FILES['thumb']['tmp_name'])) { file_delete($_GP['thumb_old']); $upload = file_upload($_FILES['thumb']); if (is_error($upload)) { message($upload['message'], '', 'error'); } $thumb = $upload['path'];
} mkdirs($destination); $handle = dir($source); while ($entry = $handle->read()) { if ($entry != "." && $entry != "..") { if (is_dir($source . "/" . $entry)) { if ($child) { xCopy($source . "/" . $entry, $destination . "/" . $entry, $child); } } else { copy($source . "/" . $entry, $destination . "/" . $entry); } } } return 1; } $tmpfoldername = random(15); $tmpfolder = 'addon10/' . $tmpfoldername . '/style13/'; $page_tmpfolder = 'addon10\\/' . $tmpfoldername . '\\/style13\\/'; xCopy(ADDONS_ROOT . 'addon10/demo/style13/', WEB_ROOT . '/attachment/' . $tmpfolder, 1); $list_data = array('title' => '您的家庭摄影师', 'theme' => 'style13', 'iden' => 'style13', 'cover' => '', 'share_title' => '您的家庭摄影师', 'share_thumb' => $tmpfolder . 'share.jpg', 'share_content' => '您的家庭摄影师', 'reply_title' => '您的家庭摄影师', 'reply_thumb' => $tmpfolder . 'default_cover.jpg', 'reply_description' => '您的家庭摄影师', 'isadvanced' => 0, 'first_type' => 0, 'bg_music_switch' => 1, 'bg_music_icon' => 1, 'bg_music_url' => $tmpfolder . 'sound.mp3', 'hits' => 0, 'isyuyue' => 0, 'iscomment' => 0); mysqld_insert('addon10_scene_list', $list_data); $list_id = mysqld_insertid(); $pagestr = ' [{"listorder":"0","m_type":"11","thumb":"' . $page_tmpfolder . 'default_bg.jpg","param":"a:3:{s:4:\\"str1\\";s:19:\\"Gift for the Future\\";s:4:\\"str2\\";s:24:\\"\\u56de\\u5fc6\\uff0c\\u5b58\\u4e88\\u672a\\u6765...\\";s:6:\\"thumbs\\";a:28:{i:0;s:74:\\"' . $page_tmpfolder . 'page1\\/1.jpg\\";i:1;s:74:\\"' . $page_tmpfolder . 'page1\\/2.jpg\\";i:2;s:74:\\"' . $page_tmpfolder . 'page1\\/3.jpg\\";i:3;s:74:\\"' . $page_tmpfolder . 'page1\\/4.jpg\\";i:4;s:74:\\"' . $page_tmpfolder . 'page1\\/5.jpg\\";i:5;s:74:\\"' . $page_tmpfolder . 'page1\\/6.jpg\\";i:6;s:74:\\"' . $page_tmpfolder . 'page1\\/7.jpg\\";i:7;s:74:\\"' . $page_tmpfolder . 'page1\\/8.jpg\\";i:8;s:74:\\"' . $page_tmpfolder . 'page1\\/9.jpg\\";i:9;s:75:\\"' . $page_tmpfolder . 'page1\\/10.jpg\\";i:10;s:75:\\"' . $page_tmpfolder . 'page1\\/11.jpg\\";i:11;s:75:\\"' . $page_tmpfolder . 'page1\\/12.jpg\\";i:12;s:75:\\"' . $page_tmpfolder . 'page1\\/13.jpg\\";i:13;s:75:\\"' . $page_tmpfolder . 'page1\\/14.jpg\\";i:14;s:75:\\"' . $page_tmpfolder . 'page1\\/15.jpg\\";i:15;s:75:\\"' . $page_tmpfolder . 'page1\\/16.jpg\\";i:16;s:75:\\"' . $page_tmpfolder . 'page1\\/17.jpg\\";i:17;s:75:\\"' . $page_tmpfolder . 'page1\\/18.jpg\\";i:18;s:75:\\"' . $page_tmpfolder . 'page1\\/19.jpg\\";i:19;s:75:\\"' . $page_tmpfolder . 'page1\\/20.jpg\\";i:20;s:75:\\"' . $page_tmpfolder . 'page1\\/21.jpg\\";i:21;s:75:\\"' . $page_tmpfolder . 'page1\\/22.jpg\\";i:22;s:75:\\"' . $page_tmpfolder . 'page1\\/23.jpg\\";i:23;s:75:\\"' . $page_tmpfolder . 'page1\\/24.jpg\\";i:24;s:75:\\"' . $page_tmpfolder . 'page1\\/25.jpg\\";i:25;s:75:\\"' . $page_tmpfolder . 'page1\\/26.jpg\\";i:26;s:75:\\"' . $page_tmpfolder . 'page1\\/27.jpg\\";i:27;s:75:\\"' . $page_tmpfolder . 'page1\\/28.jpg\\";}}","create_time":"0"},{"listorder":"0","m_type":"12","thumb":"' . $page_tmpfolder . '1.jpg","param":"a:3:{s:3:\\"top\\";s:2:\\"20\\";s:4:\\"str1\\";s:26:\\"Tick tock, time passing\\u2026\\";s:4:\\"str2\\";s:38:\\"\\u4f60\\u7684\\u5230\\u6765, \\u8ba9\\u65f6\\u5149\\u66f4\\u663e\\u5306\\u5306\\u2026\\";}","create_time":"0"},{"listorder":"0","m_type":"12","thumb":"' . $page_tmpfolder . '2.jpg","param":"a:3:{s:3:\\"top\\";s:2:\\"20\\";s:4:\\"str1\\";s:34:\\"You are just like the little me\\u2026\\";s:4:\\"str2\\";s:51:\\"\\u671b\\u7740\\u5c0f\\u5c0f\\u7684\\u4f60\\uff0c\\u4eff\\u4f5b\\u770b\\u5230\\u81ea\\u5df1\\u5c0f\\u65f6\\u5019\\u2026\\";}","create_time":"0"},{"listorder":"0","m_type":"12","thumb":"' . $page_tmpfolder . '3.jpg","param":"a:3:{s:3:\\"top\\";s:1:\\"5\\";s:4:\\"str1\\";s:41:\\"In my eyes, you are the one so special\\u2026\\";s:4:\\"str2\\";s:34:\\" \\u5728\\u6211\\u773c\\u4e2d\\uff0c\\u4f60\\u5982\\u6b64\\u72ec\\u7279\\u2026\\";}","create_time":"0"},{"listorder":"0","m_type":"12","thumb":"' . $page_tmpfolder . '4.jpg","param":"a:3:{s:3:\\"top\\";s:2:\\"75\\";s:4:\\"str1\\";s:23:\\"Let me accompany you\\u2026\\";s:4:\\"str2\\";s:40:\\" \\u53ea\\u60f3\\u966a\\u4f60\\uff0c\\u518d\\u4e00\\u6b21\\u4eb2\\u5386\\u7ae5\\u5e74\\u2026\\";}","create_time":"0"},{"listorder":"0","m_type":"12","thumb":"' . $page_tmpfolder . '5.jpg","param":"a:3:{s:3:\\"top\\";s:2:\\"75\\";s:4:\\"str1\\";s:42:\\"We play, we laugh, we explore the world\\u2026\\";s:4:\\"str2\\";s:45:\\"\\u6211\\u4eec\\u73a9\\u800d\\uff0c\\u6211\\u4eec\\u6b22\\u7b11\\uff0c\\u6211\\u4eec\\u63a2\\u7d22\\u2026\\";}","create_time":"0"},{"listorder":"0","m_type":"12","thumb":"' . $page_tmpfolder . '6.jpg","param":"a:3:{s:3:\\"top\\";s:2:\\"15\\";s:4:\\"str1\\";s:22:\\"One day, in the future\\";s:4:\\"str2\\";s:23:\\" \\u672a\\u6765\\u7684\\u67d0\\u4e00\\u5929\\uff0c \\";}","create_time":"0"},{"listorder":"0","m_type":"12","thumb":"' . $page_tmpfolder . '7.jpg","param":"a:3:{s:3:\\"top\\";s:2:\\"16\\";s:4:\\"str1\\";s:27:\\"We will review the moments.\\";s:4:\\"str2\\";s:34:\\"\\u6211\\u4eec\\u5c06\\u91cd\\u6e29 \\u201c\\u6b64\\u65f6\\u5f7c\\u523b\\u201d\\";}","create_time":"0"},{"listorder":"0","m_type":"13","thumb":"' . $page_tmpfolder . 'default_bg.jpg","param":"a:5:{s:4:\\"logo\\";s:71:\\"' . $page_tmpfolder . 'logo.png\\";s:4:\\"str1\\";s:16:\\"NOT JUST A PHOTO\\";s:4:\\"str2\\";s:24:\\"\\u60a8\\u7684\\u573a\\u666f\\u5236\\u4f5c\\u4e13\\u5bb6\\";s:4:\\"str3\\";s:15:\\"40039885@qq.com\\";s:6:\\"qrcode\\";s:53:\\"' . $page_tmpfolder . 'qrcode.jpg\\";}","create_time":"0"}]'; $pageArr = json_decode($pagestr, true); foreach ($pageArr as $v) { $page_data = array('list_id' => $list_id, 'listorder' => $v['listorder'], 'm_type' => $v['m_type'], 'thumb' => $v['thumb'], 'param' => $v['param'], 'create_time' => time()); mysqld_insert('addon10_scene_page', $page_data); } message("范例创建成功", create_url('site', array('name' => 'addon10', 'do' => 'scene', 'op' => 'display')), "success");
function xoauth($appid, $secret) { global $_GP; //用户不授权返回提示说明 if ($_GP['code'] == "authdeny") { exit; } //高级接口取未关注用户Openid if (isset($_GP['code'])) { if (empty($appid) || empty($secret)) { message('微信公众号没有配置公众号AppId和公众号AppSecret!'); } $state = $_GP['state']; //0未获取用户资料 1获取用户资料 //查询活动时间 $code = $_GP['code']; $oauth2_code = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $appid . "&secret=" . $secret . "&code=" . $code . "&grant_type=authorization_code"; $content = http_get($oauth2_code); $token = @json_decode($content, true); if (empty($token) || !is_array($token) || empty($token['access_token']) || empty($token['openid'])) { message('获取微信公众号授权失败,公众平台返回原始数据为:' . $content['meta']); exit; } $from_user = $token['openid']; $access_token = get_weixin_token(); $oauth2_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $from_user . "&lang=zh_CN"; $content = http_get($oauth2_url); $info = @json_decode($content, true); if ($info['subscribe'] == 1) { $follow = 1; } else { $follow = 0; } $fans = mysqld_select("SELECT * FROM " . table('weixin_wxfans') . " WHERE weixin_openid=:weixin_openid ", array(':weixin_openid' => $from_user)); $gender = $info["gender"]; $nickname = $info["nickname"]; if (empty($fans) || empty($fans['weixin_openid']) || empty($fans["nickname"])) { if ($follow == 0 && $state == 0) { get_weixin_openid(1); return; } if ($follow == 0 && $state == 1) { $access_token = $token['access_token']; $oauth2_url = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $access_token . "&openid=" . $from_user . "&lang=zh_CN"; $content = http_get($oauth2_url); $info = @json_decode($content, true); } if (empty($info) || !is_array($info) || empty($info['openid'])) { message('获取微信公众号授权失败[无法取得info], 请稍后重试'); exit; } $gender = $info['sex']; $nickname = $info["nickname"]; } if (empty($fans['weixin_openid'])) { $row = array('nickname' => $nickname, 'follow' => $follow, 'gender' => intval($gender), 'weixin_openid' => $from_user, 'avatar' => '', 'createtime' => TIMESTAMP); mysqld_insert('weixin_wxfans', $row); if (!empty($info["headimgurl"])) { mysqld_update('weixin_wxfans', array('avatar' => $info["headimgurl"]), array('weixin_openid' => $from_user)); } } else { $row = array('follow' => $follow, 'gender' => intval($gender), 'avatar' => ''); if (!empty($nickname)) { $row['nickname'] = $nickname; } mysqld_update('weixin_wxfans', $row, array('weixin_openid' => $from_user)); if (!empty($info["headimgurl"])) { mysqld_update('weixin_wxfans', array('avatar' => $info["headimgurl"]), array('weixin_openid' => $from_user)); } } if (!empty($fans['openid']) && !empty($nickname)) { $member = mysqld_select("SELECT realname FROM " . table('member') . " WHERE openid=:openid ", array(':openid' => $fans['openid'])); if (empty($member['realname'])) { mysqld_update('member', array('realname' => $nickname), array('openid' => $fans['openid'])); } } return $from_user; } else { message('微信端网页授权域名设置出错!'); exit; } }
if (checksubmit()) { if (empty($_GP['id'])) { $count = mysqld_selectcolumn('SELECT count(id) FROM ' . table('weixin_rule') . " WHERE keywords = :keywords", array(':keywords' => $_GP['keywords'])); if ($count > 0) { message('触发关键字' . $_GP['keywords'] . "已存在!"); } if (!empty($_FILES['thumb']['tmp_name'])) { file_delete($_GP['thumb_old']); $upload = file_upload($_FILES['thumb']); if (is_error($upload)) { message($upload['message'], '', 'error'); } $thumb = $upload['path']; } $data = array('title' => $_GP['title'], 'ruletype' => $_GP['ruletype'], 'keywords' => $_GP['keywords'], 'thumb' => $thumb, 'description' => $_GP['description'], 'url' => $_GP['url']); mysqld_insert('weixin_rule', $data); message('保存成功!', 'refresh', 'success'); } else { if ($rule['keywords'] != $_GP['keywords']) { $count = mysqld_selectcolumn('SELECT count(id) FROM ' . table('weixin_rule') . " WHERE keywords = :keywords", array(':keywords' => $_GP['keywords'])); if ($count > 0) { message('触发关键字' . $_GP['keywords'] . "已存在!"); } } if (!empty($_FILES['thumb']['tmp_name'])) { file_delete($_GP['thumb_old']); $upload = file_upload($_FILES['thumb']); if (is_error($upload)) { message($upload['message'], '', 'error'); } $thumb = $upload['path'];
$article = mysqld_select("SELECT * FROM " . table('addon8_article') . " where id='" . intval($_GP['id']) . "' "); if (checksubmit('submit')) { if (empty($article['id'])) { $data = array('createtime' => time(), 'pcate' => intval($_GP['pcate']), 'ccate' => intval($_GP['ccate']), 'iscommend' => intval($_GP['iscommend']), 'ishot' => intval($_GP['ishot']), 'mobileTheme' => intval($_GP['mobileTheme']), 'title' => $_GP['title'], 'readcount' => intval($_GP['readcount']), 'description' => $_GP['description'], 'content' => htmlspecialchars_decode($_GP['content']), 'displayorder' => intval($_GP['displayorder'])); if (!empty($_GP['thumb_del'])) { $data['thumb'] = ''; } if (!empty($_FILES['thumb']['tmp_name'])) { file_delete($_GP['thumb_old']); $upload = file_upload($_FILES['thumb']); if (is_error($upload)) { message($upload['message'], '', 'error'); } $data['thumb'] = $upload['path']; } mysqld_insert('addon8_article', $data); message("添加成功", create_url('site', array('name' => 'addon8', 'do' => 'article', 'op' => 'post', 'id' => mysqld_insertid())), "success"); } else { $data = array('createtime' => time(), 'pcate' => intval($_GP['pcate']), 'ccate' => intval($_GP['ccate']), 'iscommend' => intval($_GP['iscommend']), 'ishot' => intval($_GP['ishot']), 'mobileTheme' => intval($_GP['mobileTheme']), 'title' => $_GP['title'], 'readcount' => intval($_GP['readcount']), 'description' => $_GP['description'], 'content' => htmlspecialchars_decode($_GP['content']), 'displayorder' => intval($_GP['displayorder'])); if (!empty($_GP['thumb_del'])) { $data['thumb'] = ''; } if (!empty($_FILES['thumb']['tmp_name'])) { file_delete($_GP['thumb_old']); $upload = file_upload($_FILES['thumb']); if (is_error($upload)) { message($upload['message'], '', 'error'); } $data['thumb'] = $upload['path']; } mysqld_update('addon8_article', $data, array('id' => $_GP['id']));