Esempio n. 1
0
 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 ='******'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 ='******'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 ='******'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 ='******'from_user'] . "'");
     }
     $set = pdo_fetch("select * from" . tablename('bj_tgame_reply') . "where rid =" . $rid);
     include $this->template('index');
 }
Esempio n. 2
0
 public function doMobileLottery()
 {
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     $title = '茶叶蛋';
     $from_user = $_W['fans']['from_user'];
     if (!empty($from_user)) {
         //message('非法访问,请重新发送消息进入抽奖页面!');
         fans_require($from_user, array('realname', 'mobile', 'qq'), '需要完善资料后才能砸蛋.');
     }
     //		$realname = pdo_fetchcolumn("SELECT realname FROM". tablename('fans'). "WHERE from_user ='******'");
     // if(empty($realname)){
     // include $this->template('register');
     // return;
     // }
     include $this->template('lottery');
 }
Esempio n. 3
0
 public function doMobileIndex()
 {
     global $_GPC, $_W;
     $useragent = addslashes($_SERVER['HTTP_USER_AGENT']);
     if (strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false) {
         //echo " 404,亲,那里来回那里去哦!";
         //exit;
     }
     $id = intval($_GPC['id']);
     $title = pdo_fetchcolumn("SELECT name FROM " . tablename('rule') . " WHERE id = :rid LIMIT 1", array(':rid' => $id));
     $fromuser = $_W['fans']['from_user'];
     $hlqixi = pdo_fetch("SELECT * FROM " . tablename('hlqixi_reply') . " WHERE rid = '{$id}' LIMIT 1");
     if (empty($hlqixi)) {
         message('非法访问,请重新发送消息进入抽奖页面!');
     }
     if (!empty($fromuser)) {
         $profile = fans_require($fromuser, array('realname', 'mobile'), '需要完善资料后才能抽奖.');
     }
     $iserror = 0;
     include $this->template('index');
 }
Esempio n. 4
0
 public function doMobileLottery()
 {
     global $_GPC, $_W;
     $title = '刮刮卡';
     if (empty($_W['fans']['from_user'])) {
         message('非法访问,请重新发送消息进入抽奖页面!');
     }
     $fromuser = $_W['fans']['from_user'];
     $profile = fans_require($fromuser, array('realname', 'mobile', 'qq'), '需要完善资料后才能抽奖.');
     $id = intval($_GPC['id']);
     $scratchcard = pdo_fetch("SELECT id, periodlottery, maxlottery, rule, hitcredit, misscredit, background FROM " . tablename('scratchcard_reply') . " WHERE rid = '{$id}' LIMIT 1");
     if (empty($scratchcard)) {
         message('非法访问,请重新发送消息进入抽奖页面!');
     }
     $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('scratchcard_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '******' AND status <> 3 AND award <> ''");
     $member = fans_search($fromuser);
     $myaward = pdo_fetchall("SELECT w.id, w.award, w.description, w.status,a.inkind FROM " . tablename('scratchcard_winner') . " w left join " . tablename('scratchcard_award') . " a on w.aid = a.id  WHERE w.from_user = '******' AND w.aid != '0' AND w.award <> '' AND w.rid = '{$id}' ORDER BY w.createtime DESC");
     $mycredit = pdo_fetchcolumn("SELECT SUM(description) FROM " . tablename('scratchcard_winner') . " WHERE from_user = '******' AND aid = '0' AND award <> '' AND rid = '{$id}'");
     $mycredit = !empty($mycredit) ? $mycredit : '0';
     $allaward = pdo_fetchall("SELECT id, title, probalilty, description, inkind FROM " . tablename('scratchcard_award') . " WHERE rid = '{$id}' ORDER BY id ASC");
     //过期
     if (!empty($scratchcard['periodlottery'])) {
         $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('scratchcard_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '******' AND status <> 3");
         $lastdate = pdo_fetchcolumn("SELECT createtime FROM " . tablename('scratchcard_winner') . " WHERE from_user = '******' AND status <> 3 ORDER BY createtime DESC");
         if ($total >= intval($scratchcard['maxlottery']) && strtotime(date('Y-m-d')) < strtotime(date('Y-m-d', $lastdate)) + $scratchcard['periodlottery'] * 86400) {
             $message = '您还未到达可以再次抽奖的时间<br>下次可抽奖时间为:' . date('Y-m-d', strtotime(date('Y-m-d', $lastdate)) + $scratchcard['periodlottery'] * 86400);
         }
     } else {
         $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('scratchcard_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '******' AND status <> 3");
         if (!empty($scratchcard['maxlottery']) && $total >= $scratchcard['maxlottery']) {
             $message = $scratchcard['periodlottery'] ? '您已经超过当日抽奖次数' : '您已经超过最大抽奖次数';
         }
     }
     include $this->template('lottery');
 }
<?php

global $_GPC, $_W;
$title = '摇骰子抽奖';
$id = intval($_GPC['id']);
$fromuser = $_W['fans']['from_user'];
$sql = "SELECT COUNT(*) FROM " . tablename('mgamblemoon_user') . " WHERE  from_user = '******' and rid=" . $id;
$isuser = pdo_fetchcolumn($sql);
//用户不存在,就插入
if (!$isuser) {
    $mgamblemoon_user = array('rid' => $id, 'count' => 0, 'points' => 0, 'from_user' => $fromuser, 'createtime' => TIMESTAMP);
    pdo_insert('mgamblemoon_user', $mgamblemoon_user);
}
$profile = fans_require($fromuser, array('nickname', 'mobile'), '需要完善资料后才能摇骰子.');
$mgamblemoon = pdo_fetch("SELECT * FROM " . tablename('mgamblemoon_reply') . " WHERE rid = '{$id}' LIMIT 1");
$mgamblemoon['descriptions'] = str_replace("\r", "", $mgamblemoon['description']);
$mgamblemoon['descriptions'] = str_replace("\n", "", $mgamblemoon['descriptions']);
if (empty($mgamblemoon)) {
    message('非法访问,请重新发送消息进入摇骰子页面!');
}
$mgamblemoon['description'] = str_replace("\n", "", $mgamblemoon['description']);
$mgamblemoon['description'] = str_replace("\r", "", $mgamblemoon['description']);
$sql = "SELECT COUNT(*) FROM " . tablename('mgamblemoon_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '******' and rid=" . $id;
$totals = pdo_fetchcolumn($sql);
$myuser = pdo_fetch("SELECT id,points,count FROM " . tablename('mgamblemoon_user') . " WHERE  from_user = '******' AND rid=" . $id);
$arr_times = $this->get_today_times($totals, $mgamblemoon['maxlottery'], $mgamblemoon['prace_times'], $myuser['count']);
include $this->template('info');
Esempio n. 6
0
 public function doMobileYyyonline()
 {
     $useragent = addslashes($_SERVER['HTTP_USER_AGENT']);
     if (strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false) {
         echo "404";
         exit;
     }
     global $_GPC, $_W;
     $title = '摇一摇抽奖';
     checkauth();
     //0.51 用下面
     /*
     if (empty($_W['fans']['from_user'])) {
     	message('非法访问,请重新发送消息进入摇一摇页面!');
     }
     */
     $fromuser = $_W['fans']['from_user'];
     $profile = fans_require($fromuser, array('nickname', 'mobile'), '需要完善资料后才能摇一摇.');
     $id = intval($_GPC['id']);
     $yyyonline = pdo_fetch("SELECT * FROM " . tablename('yyyonline_reply') . " WHERE rid = '{$id}' LIMIT 1");
     if (empty($yyyonline)) {
         message('非法访问,请重新发送消息进入摇一摇页面!');
     }
     if ($yyyonline['starttime'] > time()) {
         $yyyonline['lefttime'] = $yyyonline['starttime'] - time();
     } else {
         $yyyonline['lefttime'] = 3;
     }
     $totay = strtotime(date('y-m-d', time()));
     $sql = "SELECT count FROM " . tablename('yyyonline_winner') . " WHERE  from_user = '******'  AND rid = '{$id}' AND  createtime >{$totay} AND status=2 ";
     $isaward = pdo_fetchcolumn($sql);
     if (intval($isaward)) {
         $this->doMobileEnd();
         exit;
     }
     $sql = "SELECT * FROM " . tablename('yyyonline_winner') . " WHERE  from_user = '******' AND rid = '{$id}' ";
     $winner = pdo_fetch($sql);
     $total = intval($winner['count']);
     if ($yyyonline['shaketimes'] == $total) {
         $this->doMobileEnd();
         exit;
     }
     if ($yyyonline['endtime'] < TIMESTAMP) {
         $this->doMobileEnd();
         exit;
     }
     //$member = fans_search($fromuser);
     $ruletype = intval($yyyonline['ruletype']);
     include $this->template('yyys');
 }
Esempio n. 7
0
 public function doMobileMyPaper()
 {
     global $_W, $_GPC;
     $this->checkAuth();
     // 用户必须输入个人信息后方可继续
     $profile = fans_require($_W['fans']['from_user'], array('realname', 'mobile'));
     $mypaper_list = pdo_fetchall("SELECT * FROM " . tablename('quickexam2_score_record') . " WHERE weid=:weid AND from_user=:from_user ORDER BY createtime DESC", array(":weid" => $_W['weid'], ":from_user" => $_W['fans']['from_user']));
     $paper_ids = array();
     foreach ($mypaper_list as $p) {
         $paper_ids[] = $p['paper_id'];
     }
     $paper_list = array();
     if (count($paper_ids) > 0) {
         $paper_list = pdo_fetchall("SELECT * FROM " . tablename('quickexam2_paper') . " WHERE weid={$_W['weid']} AND paper_id in (" . join(',', $paper_ids) . ")", array(), 'paper_id');
         foreach ($paper_list as $key => &$item) {
             $item['explain'] = $this->deleteSpace(strip_tags(htmlspecialchars_decode($item['explain'])));
             $item['logo'] = $this->getPicUrl($item['logo']);
         }
     }
     include $this->template('my_paper');
 }
Esempio n. 8
0
 public function doMobileRegister()
 {
     global $_GPC, $_W;
     $title = '信息登记';
     $id = $_GPC['id'];
     //$profile = pdo_fetch("SELECT realname,nickname,avatar,mobile FROM " . tablename('fans') . " WHERE from_user = '******'fans']['from_user']}' AND weid=" . $_W['uniacid'] . "  LIMIT 1");
     load()->model('mc');
     $profile = mc_fetch($_W['member']['uid'], array('realname', 'nickname', 'avatar', 'mobile'));
     $member = fans_require($_W['fans']['from_user'], array('realname', 'mobile', 'nickname'));
     if (!empty($_GPC['submit'])) {
         $data = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile'], 'nickname' => $_GPC['nickname']);
         if (empty($data['realname'])) {
             die('<script>alert("请填写您的真实姓名!");location.reload();</script>');
         }
         if (empty($data['mobile'])) {
             die('<script>alert("请填写您的手机号码!");location.reload();</script>');
         }
         fans_update($_W['fans']['from_user'], $data);
         die('<script>alert("登记成功!");location.href = "' . $this->createMobileUrl('index', array('id' => $_GPC['id'])) . '";</script>');
     }
     load()->func('tpl');
     include $this->template('register');
 }
Esempio n. 9
0
 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 = '******' 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');
 }
Esempio n. 10
0
 public function doMobileLottery()
 {
     global $_GPC, $_W;
     $title = '砸蛋抽奖';
     if (empty($_W['fans']['from_user'])) {
         message('非法访问,请重新发送消息进入砸蛋页面!');
     }
     $fromuser = $_W['fans']['from_user'];
     $profile = fans_require($fromuser, array('realname', 'mobile', 'qq'), '需要完善资料后才能砸蛋.');
     $id = intval($_GPC['id']);
     $egg = pdo_fetch("SELECT id, maxlottery, default_tips, rule FROM " . tablename('egg_reply') . " WHERE rid = '{$id}' LIMIT 1");
     if (empty($egg)) {
         message('非法访问,请重新发送消息进入砸蛋页面!');
     }
     $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('egg_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '******' AND status <> 3 AND award <> ''");
     $member = fans_search($fromuser);
     $myaward = pdo_fetchall("SELECT award, description FROM " . tablename('egg_winner') . " WHERE from_user = '******' AND award <> '' AND rid = '{$id}' ORDER BY createtime DESC");
     $sql = "SELECT a.award, b.realname FROM " . tablename('egg_winner') . " AS a\n\t\t\t\tLEFT JOIN " . tablename('fans') . " AS b ON a.from_user = b.from_user WHERE b.mobile <> '' AND b.realname <> '' AND a.award <> '' AND a.rid = '{$id}' ORDER BY a.createtime DESC LIMIT 20";
     $otheraward = pdo_fetchall($sql);
     include $this->template('lottery');
 }
Esempio n. 11
0
 public function doMobileInfo()
 {
     global $_GPC, $_W;
     $title = '摇骰子抽奖';
     $id = intval($_GPC['id']);
     $fromuser = $_W['fans']['from_user'];
     $sql = "SELECT COUNT(*) FROM " . tablename('bbb_user') . " WHERE  from_user = '******' and rid=" . $id;
     $isuser = pdo_fetchcolumn($sql);
     //用户不存在,就插入
     if (!$isuser) {
         $bbb_user = array('rid' => $id, 'count' => 0, 'points' => 0, 'from_user' => $fromuser, 'createtime' => TIMESTAMP);
         pdo_insert('bbb_user', $bbb_user);
     }
     $profile = fans_require($fromuser, array('nickname', 'mobile'), '需要完善资料后才能摇骰子.');
     $bbb = pdo_fetch("SELECT * FROM " . tablename('bbb_reply') . " WHERE rid = '{$id}' LIMIT 1");
     $bbb['descriptions'] = str_replace("\r", "", $bbb['description']);
     $bbb['descriptions'] = str_replace("\n", "", $bbb['descriptions']);
     if (empty($bbb)) {
         message('非法访问,请重新发送消息进入摇骰子页面!');
     }
     $bbb['description'] = str_replace("\n", "", $bbb['description']);
     $bbb['description'] = str_replace("\r", "", $bbb['description']);
     $sql = "SELECT COUNT(*) FROM " . tablename('bbb_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '******' and rid=" . $id;
     $totals = pdo_fetchcolumn($sql);
     $myuser = pdo_fetch("SELECT id,points,count FROM " . tablename('bbb_user') . " WHERE  from_user = '******' AND rid=" . $id);
     $arr_times = $this->get_today_times($totals, $bbb['maxlottery'], $bbb['prace_times'], $myuser['count']);
     include $this->template('info');
 }