Exemplo n.º 1
0
 /**
  * 删除COOKIE
  *
  * @param string $name
  */
 public static function del($name)
 {
     /*$cookie = Yii::app()->request->getCookies();
     
             unset($cookie[$name]);*/
     FCookie::set($name, '', -3600);
 }
Exemplo n.º 2
0
 /**
  * 返回用户是登录状态
  * @return bool
  */
 protected function isLogin()
 {
     global $_F;
     $uid = FCookie::get("uid");
     $sid = FCookie::get("key");
     $table = new FTable("user_main");
     $user = $table->fields(array("sid"))->where(array("uid" => $uid))->find();
     $_F["uid"] = $uid;
     return $user["sid"] == $sid;
 }
Exemplo n.º 3
0
 public function defaultAction()
 {
     global $_F;
     $url = "http://down.mumu123.cn/mumu/MuMu_1617_1000_6_1.005.apk";
     $mumu_auth = FCookie::get('mumu_auth');
     $v = FRequest::getString('v');
     if ($v) {
         FResponse::redirect($url);
     } else {
         if ($mumu_auth) {
             FResponse::redirect($url);
         } else {
             FResponse::redirect('/public/reg');
         }
     }
 }
Exemplo n.º 4
0
 /**
  * 商品列表
  *
  */
 public function listAction()
 {
     $goldcoin = 0;
     $uid = FCookie::get("uid");
     if ($uid && $uid > 0) {
         $table2 = new FTable("user_main");
         $u = $table2->fields(array("goldcoin"))->where(array("uid" => $uid))->find();
         $goldcoin = $u["goldcoin"];
     }
     $table = new FTable("mall");
     $r = $table->fields(array("id", "title", "pic", "price", "gold", "tip"))->where(array("status" => 1))->select();
     $this->assign("goldcoin", $goldcoin);
     $this->assign("goods_list", $r);
     $this->assign("base_url", FConfig::get('global.base_url') . "/mall/info");
     $this->display('mall_list');
 }
Exemplo n.º 5
0
 /**
  * 约会说明
  */
 public function dateAction()
 {
     global $_F;
     //$_F["debug"] = true;
     $uid = FCookie::get("uid");
     $user = Service_Client::getUserByUid($uid);
     if ($user["province"] == "北京" || $user["province"] == "天津" || $user["province"] == "上海" || $user["province"] == "重庆") {
         $user["city"] = $user["province"];
     }
     $table = new FTable("date_place");
     $place_num = $table->where(array("city" => $user["city"]))->count();
     $table = new FTable("date_request", "dr");
     $query_sql = " ( ud.province = '" . $user["city"] . "' or  ud.city = '" . $user["province"] . "' )";
     $date_num = $table->leftJoin("user_detail", "ud", "dr.uid1=ud.uid")->where(array("dr.available" => 1, "str" => $query_sql))->count();
     $this->assign("base_url", FConfig::get('global.base_url'));
     $this->assign("place_num", $place_num);
     $this->assign("user", $user);
     $this->assign("date_num", $date_num);
     $this->display('client_date');
 }
Exemplo n.º 6
0
 public function actionUpdatePwd()
 {
     $response = array();
     $user_phone = $this->request->getParam('user_phone');
     $new_pwd = trim($this->request->getParam('new_pwd'));
     $phone_code = trim($this->request->getParam('phone_code'));
     $verifyCode = FCookie::get(FConfig::item('config.cookie.phone_key'));
     $verifyCode = Fn::crypt($verifyCode, FConfig::item('config.cookie.phone_code'), 'decode');
     if ($phone_code != $verifyCode) {
         $response['status'] = 100001;
         $response['content'] = '短信验证失败!';
     } else {
         $res = $this->user_model->updateAll(array('password' => md5($new_pwd)), 'phone_num=:phone', array(':phone' => $user_phone));
         if ($res) {
             $response['status'] = 100000;
             $response['content'] = '修改密码成功!';
         } else {
             $response['status'] = 100002;
             $response['content'] = '修改密码失败!';
         }
     }
     Yii::app()->end(FHelper::json($response['content'], $response['status']));
 }
Exemplo n.º 7
0
 public function actionSendMsgPhone()
 {
     $sendMessage = new SendMessage();
     $response = array();
     $code = FHelper::generate_code();
     $content = FConfig::item('siteMessage.register.first') . $code . FConfig::item('siteMessage.register.end');
     $user = FConfig::item('config.ws_mobile.userName');
     $pass = FConfig::item('config.ws_mobile.passWord');
     $today = date('Y-m-d 0:0:0', time());
     $condition = array('condition' => "mobile_no = '{$this->user['phone_num']}' and send_time >= '{$today}'");
     $messageCount = $sendMessage->count($condition);
     if ($messageCount < 5) {
         Yii::import('ext.wsMobile.ws.*');
         require_once 'ws-demo.php';
         $engine = WS_SDK::getInstance($user, $pass);
         $res = $engine->sendSmsAsNormal($this->user['phone_num'], $content, '', 0);
         if (intval($res) === 0) {
             $cryRes = Fn::crypt($code, FConfig::item('config.cookie.phone_code'));
             FCookie::set(FConfig::item('config.cookie.phone_key'), $cryRes);
             $response['status'] = 100000;
             $response['content'] = '短信发送成功';
             $telArr = array('mobile_no' => $this->user['phone_num'], 'mess_code' => $code, 'send_time' => FF_DATE_TIME);
             $sendMessage->attributes = $telArr;
             $sendMessage->save();
         } else {
             $response['status'] = 100001;
             $response['content'] = '短信发送失败,请重试';
         }
     } else {
         $response['status'] = 100002;
         $response['content'] = '该手机号码今天发送验证码过多';
     }
     Yii::app()->end(FHelper::json($response['content'], $response['status']));
 }
Exemplo n.º 8
0
 protected function beforeAction($action)
 {
     $this->_controller = $action->getController()->getId();
     $this->_action = $action->getId();
     $this->returnurl = Fn::url_login_current();
     $token = FCookie::get("auth");
     $now = time();
     list($uid, $email, $timeout) = explode("\t", FHelper::auth_code($token, 'DECODE', FF_SALT));
     if ($uid) {
         $userInfo = $this->getUserinfo($uid);
         if ($userInfo['user']['id']) {
             if ($token == $userInfo['user']['token']) {
                 if ($now < $timeout) {
                     $this->userInfo = $userInfo['info'];
                     $this->user = $userInfo['user'];
                     if ($timeout - $now < 60 * 2) {
                         $timeout = time() + 60 * 15;
                         $token = FHelper::auth_code("{$uid}\t{$email}\t{$timeout}", 'ENCODE', FF_SALT);
                         FCookie::set('auth', $token, 60 * 15);
                         $attr = array('token' => $token);
                         $user_model = new User();
                         $user_model->updateByPk($uid, $attr);
                     }
                     //                        $timeout =  time()+60 *15;
                     //                        $token = FHelper::auth_code("$uid\t$email\t$timeout", 'ENCODE', FF_SALT);
                     //                        FCookie::set('auth', $token);
                 }
             }
         }
     }
     return true;
 }
Exemplo n.º 9
0
<!-- 登录页面 -->
<div id="pg-login" class="f-bg-gray f-pdb35">
    <div class="login-form m-form f-fr">
        <h3 class="login-form-title">欢迎回来</h3>
        <form id="login-form">
            <div class="err-alert" style="display: none">

            </div>
            <div class="form-item">
                <em class="icon login-email-icon"></em>
                <div class="ipt">
                    <input type="text"
                           value="<?php 
$userName = FCookie::get('user_name');
if ($userName) {
    echo $userName;
}
?>
"
                           class="u-ipt u-ipt-pl30" id="userName" placeholder="电子邮箱或手机号码" />
                </div>
            </div>
            <div class="form-item">
                <em class="icon password-icon"></em>
                <div class="ipt">
                    <input type="password" class="u-ipt u-ipt-pl30" id="password" autocomplete="off" placeholder="请输入登录密码" value=""/>
                </div>
            </div>
            <div class="f-mgb05">
                <input type="hidden" id="ru" value="<?php 
echo $returnurl;