本文整理汇总了PHP中checkauth函数的典型用法代码示例。如果您正苦于以下问题:PHP checkauth函数的具体用法?PHP checkauth怎么用?PHP checkauth使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkauth函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doMobilePay
public function doMobilePay()
{
global $_W, $_GPC;
if (empty($_W['member']['uid'])) {
checkauth();
}
$username = $_W['member']['email'] ? $_W['member']['email'] : $_W['member']['mobile'];
if (empty($username)) {
message('您的用户信息不完整,请完善用户信息后再充值', '', 'error');
}
if (checksubmit('submit', true) || !empty($_GPC['ajax'])) {
$fee = floatval($_GPC['money']);
if ($fee <= 0) {
message('支付错误, 金额小于0');
}
$chargerecord = pdo_fetch("SELECT * FROM " . tablename('mc_credits_recharge') . " WHERE uniacid = :uniacid AND uid = :uid AND fee = :fee AND status = '0'", array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':fee' => $fee));
if (empty($chargerecord)) {
$chargerecord = array('uid' => $_W['member']['uid'], 'uniacid' => $_W['uniacid'], 'tid' => date('YmdHi') . random(10, 1), 'fee' => $fee, 'status' => 0, 'createtime' => TIMESTAMP);
if (!pdo_insert('mc_credits_recharge', $chargerecord)) {
message('创建充值订单失败,请重试!', url('entry', array('m' => 'recharge', 'do' => 'pay')), 'error');
}
}
$params = array('tid' => $chargerecord['tid'], 'ordersn' => $chargerecord['tid'], 'title' => '系统充值余额', 'fee' => $chargerecord['fee'], 'user' => $_W['member']['uid']);
$this->pay($params);
} else {
include $this->template('recharge');
}
}
示例2: doMobileDetail
public function doMobileDetail()
{
global $_W, $_GPC;
checkauth();
$rid = intval($_GPC['rid']);
$reply = pdo_fetch("SELECT * FROM " . tablename('shake_reply') . " WHERE rid = :rid", array(':rid' => $rid));
if (empty($reply)) {
message('抱歉,此活动不存在或是还未开始!', 'refresh', 'error');
}
$member = pdo_fetch("SELECT * FROM " . tablename('shake_member') . " WHERE rid = :rid AND openid = :openid", array(':rid' => $reply['rid'], ':openid' => $_W['member']['uid']));
if (empty($member)) {
$member = array('rid' => $rid, 'openid' => $_W['member']['uid'], 'createtime' => TIMESTAMP, 'shakecount' => 0, 'status' => 0);
$maxjoin = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('shake_member') . " WHERE rid = '{$reply['rid']}' AND status = '1'");
if ($maxjoin < $reply['maxjoin']) {
mt_srand((double) microtime() * 1000000);
$rand = mt_rand(1, 100);
if ($rand <= $reply['joinprobability']) {
$member['status'] = 1;
}
}
pdo_insert('shake_member', $member);
}
if (strexists(strtolower($_SERVER['HTTP_USER_AGENT']), 'android')) {
$reply['speed'] = $reply['speedandroid'];
}
include $this->template('detail');
}
示例3: doMobileLottery
public function doMobileLottery()
{
global $_GPC, $_W;
$id = intval($_GPC['id']);
$sql = 'SELECT * FROM ' . tablename('zzz_reply') . ' WHERE `rid` = :rid';
$params = array(':rid' => $id);
$zzz = pdo_fetch($sql, $params);
if (empty($zzz)) {
message('非法访问,请重新发送消息进入!');
}
checkauth();
load()->model("mc");
$profile = mc_require($_W['member']['uid'], array('nickname', 'mobile'), '需要完善资料后才能继续.');
$startgame = 1;
if ($zzz['start_time'] > TIMESTAMP) {
$startgame = 0;
$str = "活动没开始";
}
if ($zzz['end_time'] < TIMESTAMP) {
$startgame = 0;
$str = "活动已结束";
}
if (empty($_W['fans']['fanid'])) {
$sql = 'SELECT `fanid` FROM ' . tablename('mc_mapping_fans') . ' WHERE `uid` = :uid';
$params = array(':uid' => $_W['member']['uid']);
$fansId = pdo_fetchcolumn($sql, $params);
if (empty($fansId)) {
message('必须关注公众号才可以进入游戏', $this->createMobileUrl('introduce', array('id' => $id)), 'error');
}
$_W['fans']['fanid'] = $fansId;
}
$sql = 'SELECT * FROM ' . tablename('zzz_user') . ' WHERE `rid` = :rid AND `fanid` = :fanid';
$params = array(':rid' => $id, ':fanid' => $_W['fans']['fanid']);
$myuser = pdo_fetch($sql, $params);
// 用户不存在插入一条数据
if (empty($myuser)) {
$zzz_user = array('rid' => $id, 'count' => 0, 'points' => 0, 'fanid' => $_W['fans']['fanid'], 'createtime' => TIMESTAMP);
pdo_insert('zzz_user', $zzz_user);
}
$myph = '';
if (!empty($myuser)) {
$sql = 'SELECT count(*) FROM ' . tablename('zzz_user') . ' WHERE `rid` = :rid AND `points` > :points';
$params = array(':rid' => $id, ':points' => $myuser['points']);
$ph = pdo_fetchcolumn($sql, $params);
$myph = intval($ph) + 1;
}
// 分享增加体力
$shareFid = intval($_GPC['shareuid']);
if (!empty($shareFid)) {
$sql = 'SELECT `id` FROM ' . tablename('zzz_share') . ' WHERE `rid` = :rid AND `fanid` = :fanid AND `sharefid` = :sharefid';
$params = array(':rid' => $id, ':fanid' => $_W['fans']['fanid'], 'sharefid' => $shareFid);
$shareInfo = pdo_fetchcolumn($sql, $params);
if (empty($shareInfo)) {
pdo_insert('zzz_share', array('rid' => $id, 'fanid' => $_W['fans']['fanid'], 'sharefid' => $shareFid));
pdo_update('zzz_user', array('sharevalue' => $myuser['sharevalue'] + $zzz['sharevalue']), array('fanid' => $shareFid, 'rid' => $id));
}
}
$energylimit = ($zzz['maxlottery'] + $zzz['prace_times']) * 10;
include $this->template('gamex');
}
示例4: doMobileIndex
public function doMobileIndex()
{
global $_W, $_GPC;
checkauth();
$fromuser = fans_require($_W['fans']['from_user'], array('nickname', 'mobile'), '需要完善资料后才能玩.');
$rid = $_GPC['rid'];
$follow = fans_search($_W['fans']['from_user'], array('follow'));
if ($follow['follow'] == 1) {
if (intval($_GPC['id'])) {
$score = pdo_fetchcolumn("select score from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='" . $fromuser['from_user'] . "'");
if ($score < $_GPC['score']) {
$update = array('score' => $_GPC['score'], 'realname' => $fromuser['nickname']);
$score = $_GPC['score'];
pdo_update('bj_tgame_user', $update, array('id' => $_GPC['id'], 'weid' => $_W['weid']));
}
message($score, '', 'ajax');
}
$from_user = pdo_fetch("select id from_user, rid from" . tablename('bj_tgame_user') . "where from_user ='" . $fromuser['from_user'] . "'");
if (empty($from_user['from_user'])) {
$insert = array('id' => $_GPC['id'], 'weid' => $_W['weid'], 'rid' => $rid, 'from_user' => $fromuser['from_user'], 'realname' => $fromuser['nickname'], 'score' => 0);
pdo_insert('bj_tgame_user', $insert);
}
//$from_user = pdo_fetch("select id, rid from".tablename('bj_tgame_user')."where from_user ='".$fromuser['from_user']. "'");
if ($from_user['rid'] != $rid) {
$update = array('rid' => $rid);
pdo_update('bj_tgame_user', $update, array('id' => $from_user['id']));
}
$realname = $fromuser['nickname'];
$user = pdo_fetch("select * from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='" . $fromuser['from_user'] . "'");
}
$set = pdo_fetch("select * from" . tablename('bj_tgame_reply') . "where rid =" . $rid);
include $this->template('index');
}
示例5: respond
public function respond()
{
global $_W;
$rid = $this->rule;
$sql = "SELECT * FROM " . tablename($this->table_reply) . " WHERE `rid`=:rid LIMIT 1";
$reply = pdo_fetch($sql, array(':rid' => $rid));
if (empty($reply['id'])) {
return array();
}
checkauth();
$sql = "SELECT * FROM " . tablename($this->table_vote) . " WHERE `id`=:id LIMIT 1";
$vote = pdo_fetch($sql, array(':id' => $reply['vid']));
if (empty($vote['id'])) {
return array();
}
//$member = $this->getMember();
//if (empty($member['nickname']) || empty($member['avatar'])) {
// $message = '发表话题前请<a target="_blank" href="'.$this->buildSiteUrl($this->createMobileUrl('register')).'">登记</a>您的信息。';
$title = $reply['title'] == '' ? '微投票' : $reply['title'];
$description = $reply['description'] == '' ? '微投票活动' : $reply['description'];
$picUrl = $_W['attachurl'] . $reply['picture'];
$url = $this->createMobileUrl('Index', array('id' => $vote['id']));
/**
* 预定义的操作, 构造返回图文消息结构
* @param array $news 回复的图文定义(定义为元素集合, 每个元素结构定义为 title - string: 新闻标题, description - string: 新闻描述, picurl - string: 图片链接, url - string: 原文链接)
* @return array 返回的消息数组结构
*/
return $this->respNews(array('title' => $title, 'description' => $description, 'picUrl' => $picUrl, 'url' => $url));
}
示例6: doMobileMy
public function doMobileMy()
{
global $_W, $_GPC;
checkauth();
$rid = $_GPC['rid'];
$from_user = $_W['fans']['from_user'];
$list = pdo_fetchall("SELECT * FROM " . tablename('weizp_album') . " WHERE rid=:rid AND from_user=:from_user", array('rid' => $rid, 'from_user' => $from_user));
foreach ($list as $k => $v) {
foreach ($v as $sk => $sv) {
if ($sk == 'images') {
$tmp = unserialize($sv);
$images = array();
foreach ($tmp as $ssv) {
$images[]['id'] = $ssv;
$images[]['file'] = pdo_fetchcolumn("SELECT file FROM " . tablename('weizp_images') . "WHERE id='{$ssv}'");
}
$sv = $images;
}
$v[$sk] = $sv;
}
$list[$k] = $v;
}
//var_dump($list);
include $this->template('my');
}
示例7: doMobileEntrance
public function doMobileEntrance()
{
/* global $_W, $_GPC;
$this->checkAuth();
$template_name = 'dish_index'; //默认进入首页
$weid = $_W['weid'];
$title = '微点餐';
$page_from_user = base64_encode(authcode($_W['fans']['from_user'], 'ENCODE'));
$setting = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_setting') . " WHERE weid={$weid} ORDER BY id DESC LIMIT 1");
$store = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_stores') . " WHERE weid={$weid} ORDER BY id DESC LIMIT 1");
$storeid = $store['id'];
$title = $setting['title'];
if (empty($page_from_user) || empty($storeid)) {
message('参数错误!');
}
$nave = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_nave') . " WHERE weid={$weid} AND status=1 ORDER BY displayorder DESC,id DESC");
include $this->template($template_name);*/
global $_GPC, $_W;
//$this->checkAuth();
checkauth();
$weid = $_W['weid'];
$title = '全部菜品';
$page_from_user = base64_encode(authcode($_W['fans']['from_user'], 'ENCODE'));
$setting = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_setting') . " WHERE weid={$weid} ORDER BY id DESC LIMIT 1");
$store = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_stores') . " WHERE weid={$weid} ORDER BY id DESC LIMIT 1");
$storeid = $store['id'];
if (empty($page_from_user) || empty($storeid)) {
message('参数错误!');
}
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$condition = '';
if (!empty($_GPC['ccate'])) {
$cid = intval($_GPC['ccate']);
$condition .= " AND ccate = '{$cid}'";
} elseif (!empty($_GPC['pcate'])) {
$cid = intval($_GPC['pcate']);
$condition .= " AND pcate = '{$cid}'";
}
$children = array();
$category = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_category') . " WHERE weid = '{$weid}' AND storeid={$storeid} ORDER BY displayorder DESC,id DESC");
$cid = intval($category[0]['id']);
$category_in_cart = pdo_fetchall("SELECT goodstype,count(1) as 'goodscount' FROM " . tablename($this->modulename . '_cart') . " GROUP BY weid,storeid,goodstype,from_user having weid = '{$weid}' AND storeid='{$storeid}' AND from_user='{$from_user}'");
$category_arr = array();
foreach ($category_in_cart as $key => $value) {
$category_arr[$value['goodstype']] = $value['goodscount'];
}
$list = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_goods') . " WHERE weid = '{$weid}' AND storeid={$storeid} AND status = '1' AND pcate={$cid} ORDER BY displayorder DESC, subcount DESC, id DESC ");
$dish_arr = $this->getDishCountInCart($page_from_user, $storeid, $weid);
//智能点餐
$intelligents = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_intelligent') . " WHERE weid={$weid} AND storeid={$storeid} GROUP BY name ORDER by name");
include $this->template('dish_list');
}
示例8: respond
public function respond()
{
global $_W;
checkauth();
if ($this->inContext) {
return $this->post();
} else {
return $this->register();
}
}
示例9: respond
public function respond()
{
checkauth();
$sql = "SELECT * FROM " . tablename('basic_reply') . " WHERE `rid` IN ({$this->rule}) ORDER BY RAND() LIMIT 1";
$reply = pdo_fetch($sql);
$reply['content'] = htmlspecialchars_decode($reply['content']);
$reply['content'] = str_replace(array('<br>', ' '), array("\n", ' '), $reply['content']);
$reply['content'] = strip_tags($reply['content'], '<a>');
//替换要替换的内容
$reply['content'] = formot_content($reply['content']);
return $this->respText($reply['content']);
}
示例10: respond
public function respond()
{
global $_W;
checkauth();
if (!$this->inContext) {
$number = pdo_fetchcolumn(" SELECT COUNT(*) FROM " . tablename('mc_mapping_fans') . " WHERE uniacid = '{$_W['uniacid']}' and follow = 1 ");
$list = pdo_fetch("select * from " . tablename('eso_sale_share_history') . " WHERE from_user = '{$_W['openid']}' and uniacid = '{$_W['uniacid']}'");
if (empty($list)) {
$reply = "欢迎关注【" . $_W['account']['name'] . "】\n你是第【" . $number . "】个会员";
// $reply ="欢迎关注【".$_W['account']['name']."】\n你是第【854】个会员";
} else {
$shangji = pdo_fetch("select from_user from " . tablename('eso_sale_member') . " where id = '{$list['sharemid']}' and uniacid = '{$_W['uniacid']}'");
$member = mc_fansinfo($shangji['from_user']);
$reply = "欢迎关注【" . $_W['account']['name'] . "】\n你是由【" . $member['nickname'] . "】推荐的第【" . $number . "】个会员";
}
}
return $this->respText($reply);
}
示例11: doMobileLottery
public function doMobileLottery()
{
global $_GPC, $_W;
$title = '活动';
$id = intval($_GPC['id']);
$zzz = pdo_fetch("SELECT * FROM " . tablename('zzz_reply') . " WHERE rid = '{$id}' LIMIT 1");
if (empty($zzz)) {
message('非法访问,请重新发送消息进入!');
}
$useragent = addslashes($_SERVER['HTTP_USER_AGENT']);
if (strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false) {
header('Location: ' . $zzz['guzhuurl']);
exit;
}
checkauth();
$fromuser = $_W['fans']['from_user'];
$sql = "SELECT * FROM " . tablename('zzz_user') . " WHERE from_user = '{$fromuser}' and rid=" . $id;
$myuser = pdo_fetch($sql);
$startgame = 1;
if ($zzz['start_time'] > TIMESTAMP) {
$startgame = 0;
$str = "活动没开始";
}
if ($zzz['end_time'] < TIMESTAMP) {
$startgame = 0;
$str = "活动已结束";
}
//用户不存在,就插入
if (!$myuser) {
$zzz_user = array('rid' => $id, 'count' => 0, 'points' => 0, 'from_user' => $fromuser, 'createtime' => TIMESTAMP);
pdo_insert('zzz_user', $zzz_user);
}
$profile = fans_require($fromuser, array('nickname', 'mobile'), '需要完善资料后才能继续.');
if ($myuser) {
$sql = "SELECT count(*) FROM " . tablename('zzz_user') . " WHERE rid = " . $id . " and points >" . $myuser['points'];
$ph = pdo_fetchcolumn($sql);
$myph = intval($ph) + 1;
} else {
$myph = '';
}
$energylimit = ($zzz['maxlottery'] + $zzz['prace_times']) * 10;
include $this->template('gamex');
}
示例12: doMobilePostScroe
public function doMobilePostScroe()
{
global $_W, $_GPC;
checkauth();
if (!empty($_GPC['fen'])) {
$user = array('realname' => $_GPC['name'], 'mobile' => $_GPC['tel']);
$registUser = pdo_fetch("select id,score from " . tablename("eudy_ads_user") . " where weid=:weid and fid=:fid ", array(':weid' => $_W['uniacid'], ':fid' => $_W['member']['uid']));
if (empty($registUser)) {
$data = array('weid' => $_W['uniacid'], 'fid' => $_W['member']['uid'], 'uname' => $user['realname'], 'tel' => $user['mobile'], 'score' => $_GPC['fen'], 'createtime' => TIMESTAMP);
pdo_insert('eudy_ads_user', $data);
echo "1";
} else {
$score = intval($_GPC['fen']);
if (intval($registUser['score']) < $score) {
$data = array('uname' => $user['realname'], 'tel' => $user['mobile'], 'score' => $_GPC['fen'], 'createtime' => TIMESTAMP);
pdo_update('eudy_ads_user', $data, array('id' => $registUser['id']));
}
echo "2";
}
die;
}
}
示例13: comment
function comment()
{
global $_SGLOBAL;
checkauth();
//验证登陆
$op = req('op');
$db = MysqliDb::getInstance();
if ($op == 'add') {
$setarr = array('uid' => $_SGLOBAL['uid']);
$setarr['message'] = req('message');
$setarr['zid'] = req('zid', 0);
if ($setarr['message'] && $setarr['zid']) {
$id = $db->insert('comment', $setarr);
//插入数据
if ($id) {
showjson('do_success', 0, array("cid" => $id));
}
showjson('submit_comment_error');
}
showjson('zid_or_message_can_not_empty');
} elseif ($op == 'del') {
$cid = req('cid', 0);
if (empty($cid)) {
showjson('non_normal_operation');
}
$db->where('cid', $cid);
if ($_SGLOBAL['usertype'] == 1) {
//是否管理员
} else {
$db->where('uid', $_SGLOBAL['uid']);
}
$result = $db->delete('comment');
//删除评论
if ($result) {
showjson('do_success', 0);
}
showjson('comment_not_exist');
}
}
示例14: doMobilePay
public function doMobilePay()
{
global $_W, $_GPC;
//验证用户登录状态,此处测试不做验证
checkauth();
$params['tid'] = date('YmdH');
$params['user'] = $_W['member']['uid'];
$params['fee'] = floatval($_GPC['price']);
$params['title'] = '测试支付公众号名称';
$params['ordersn'] = random(5, 1);
$params['virtual'] = false;
if (checksubmit('submit')) {
if ($_GPC['type'] == 'credit') {
$setting = uni_setting($_W['uniacid'], array('creditbehaviors'));
$credtis = mc_credit_fetch($_W['member']['uid']);
//此处需要验证积分数量
if ($credtis[$setting['creditbehaviors']['currency']] < $params['fee']) {
message('抱歉,您帐户的余额不够支付该订单,请充值!', '', 'error');
}
}
} else {
$this->pay($params);
}
}
示例15: doMobileorderlist
public function doMobileorderlist()
{
global $_GPC, $_W;
$weid = $this->_weid;
checkauth();
$this->check_login();
$memberid = $this->_user_info['id'];
if (empty($memberid)) {
$url = $this->createMobileUrl('index');
header("Location: {$url}");
}
$ac = $_GPC['ac'];
if ($ac == "getDate") {
$pindex = max(1, intval($_GPC['page']));
$psize = 10;
$sql = "SELECT o.*, h.title ";
$where = " FROM " . tablename('hotel2_order') . " AS o";
$where .= " LEFT JOIN " . tablename('hotel2') . " AS h ON o.hotelid = h.id";
$where .= " WHERE 1 = 1";
$where .= " AND o.memberid = {$memberid}";
$where .= " AND o.weid = {$weid}";
$count_sql = "SELECT COUNT(o.id) " . $where;
$sql .= $where;
$sql .= " ORDER BY o.id DESC";
if ($pindex > 0) {
// 需要分页
$start = ($pindex - 1) * $psize;
$sql .= " LIMIT {$start},{$psize}";
}
$list = pdo_fetchall($sql);
$total = pdo_fetchcolumn($count_sql);
//print_r($count_sql);die();
$page_array = get_page_array($total, $pindex, $psize);
$data = array();
$data['result'] = 1;
ob_start();
include $this->template('order_crumb');
$data['code'] = ob_get_contents();
ob_clean();
$data['total'] = $total;
$data['isshow'] = $page_array['isshow'];
if ($page_array['isshow'] == 1) {
$data['nindex'] = $page_array['nindex'];
}
die(json_encode($data));
} else {
include $this->template('orderlist');
}
}