예제 #1
0
 function _initialize()
 {
     parent::_initialize();
     $site_options = get_site_options();
     $this->assign($site_options);
     $ucenter_syn = C("UCENTER_ENABLED");
     if ($ucenter_syn) {
         if (!isset($_SESSION["user"])) {
             if (!empty($_COOKIE['thinkcmf_auth']) && $_COOKIE['thinkcmf_auth'] != "logout") {
                 $thinkcmf_auth = sp_authcode($_COOKIE['thinkcmf_auth'], "DECODE");
                 $thinkcmf_auth = explode("\t", $thinkcmf_auth);
                 $auth_username = $thinkcmf_auth[1];
                 $users_model = M('Users');
                 $where['user_login'] = $auth_username;
                 $user = $users_model->where($where)->find();
                 if (!empty($user)) {
                     $is_login = true;
                     $_SESSION["user"] = $user;
                 }
             }
         } else {
         }
     }
     if (sp_is_user_login()) {
         $this->assign("user", sp_get_current_user());
     }
 }
예제 #2
0
 function is_login()
 {
     if (sp_is_user_login()) {
         $this->ajaxReturn(array("status" => 1, "user" => sp_get_current_user()));
     } else {
         $this->ajaxReturn(array("status" => 0, "info" => "此用户未登录!"));
     }
 }
 function _initialize()
 {
     parent::_initialize();
     $site_options = get_site_options();
     $this->assign($site_options);
     $ucenter_syn = C("UCENTER_ENABLED");
     if ($ucenter_syn) {
         if (!isset($_SESSION["user"])) {
             if (!empty($_COOKIE['thinkcmf_auth']) && $_COOKIE['thinkcmf_auth'] != "logout") {
                 $thinkcmf_auth = sp_authcode($_COOKIE['thinkcmf_auth'], "DECODE");
                 $thinkcmf_auth = explode("\t", $thinkcmf_auth);
                 $auth_username = $thinkcmf_auth[1];
                 $users_model = M('Member');
                 $where['user_login'] = $auth_username;
                 $user = $users_model->where($where)->find();
                 if (!empty($user)) {
                     $is_login = true;
                     $_SESSION["user"] = $user;
                 }
             }
         } else {
         }
     }
     if (sp_is_user_login()) {
         $this->assign("user", sp_get_current_user());
     } else {
         if (isset($_COOKIE['user_login'])) {
             $users_model = M('Member');
             $where['user_login'] = $_COOKIE['user_login'];
             $user = $users_model->where($where)->find();
             //echo $_COOKIE['user_auth'];echo '<br>';echo md5($result['user_pass'].'iloveyouhmvpoint');die;
             if (md5($user['user_pass'] . 'iloveyouhmvpoint') == $_COOKIE['user_auth']) {
                 $_SESSION['user'] = $user;
             }
         }
     }
     // 热搜
     $top_hot_search = M('Ad')->where('ad_content="top_hot_search"')->limit(7)->select();
     $this->assign('top_hot_search', $top_hot_search);
     $cart = A('Order/Cart')->cart();
     $this->assign('cartNum', count($cart['cart']));
 }
예제 #4
0
 public function pay()
 {
     $payId = intval(I("get.id"));
     if (!$payId) {
         $this->error('数据传入失败!');
     }
     if (!sp_is_user_login()) {
         $_SESSION['login_http_referer'] = U("Server/Index/pay", array("id" => $payId));
         $this->error('请先登录!', U("user/login/index"));
     }
     $payInfo = $this->order_model->where(array("id" => $payId))->find();
     if (!$payInfo) {
         $this->error('订单不存在!', U("/"));
     }
     $current_user = sp_get_current_user();
     if ($payInfo['user_id'] != $current_user['id']) {
         $this->error('只能支付自己的订单', U("Server/Order/index"));
     }
     $server = $this->servers_model->where(array('id' => $payInfo['server_id'], 'status' => 1, "isdel" => 0))->find();
     if (!$server) {
         $this->error("服务器不存在或已停运,不可购买!", U("Server/Order/index"));
     }
     if ($payInfo["status"] == 0) {
         $this->error('订单已经被删除!', U("/"));
     } else {
         if ($payInfo["status"] == 2) {
             $this->error('订单已经支付!', U("/"));
         }
     }
     $server_sell = $this->serversell_model->where('id=' . $payInfo['month'])->find();
     $this->assign('payMethod', $this->order_model->payMethod);
     ////后期需要扩展支付接口地方
     $this->assign("server", $server);
     $this->assign("User", $current_user);
     $this->assign('server_sell', $server_sell);
     $this->assign($payInfo);
     $this->display();
 }