当前位置: 首页>>代码示例>>PHP>>正文


PHP sp_authcode函数代码示例

本文整理汇总了PHP中sp_authcode函数的典型用法代码示例。如果您正苦于以下问题:PHP sp_authcode函数的具体用法?PHP sp_authcode怎么用?PHP sp_authcode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sp_authcode函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _initialize

 function _initialize()
 {
     parent::_initialize();
     $site_options = get_site_options();
     $this->assign($site_options);
     $ucenter_syn = C("UCENTER_ENABLED");
     if ($ucenter_syn) {
         if (!isset($_SESSION["MEMBER_id"])) {
             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];
                 $members_obj = M('Members');
                 $where['user_login_name'] = $auth_username;
                 $member = $members_obj->where($where)->find();
                 if (!empty($member)) {
                     $is_login = true;
                     $_SESSION["MEMBER_type"] = 'local';
                     $_SESSION["MEMBER_id"] = $member['ID'];
                     $_SESSION['MEMBER_name'] = $auth_username;
                     $_SESSION['MEMBER_status'] = $member['user_status'];
                 }
             }
         } else {
         }
     }
 }
开发者ID:Nightchen0521,项目名称:cmf,代码行数:27,代码来源:HomeBaseAction.class.php

示例2: _initialize

 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());
     }
 }
开发者ID:noikiy,项目名称:luokeke2,代码行数:27,代码来源:HomeBaseController.class.php

示例3: post

 function post()
 {
     if ($_SESSION['_verify_']['verify'] != I("post.verify")) {
         $this->error("验证码错误!");
     }
     if (IS_POST) {
         $_POST['post_table'] = sp_authcode($_POST['post_table']);
         if ($this->comments_model->create()) {
             if (isset($_SESSION["MEMBER_type"]) && $_SESSION["MEMBER_type"] == 'local') {
                 //用户已登陆,且是本站会员
                 $uid = $_SESSION["MEMBER_id"];
                 $_POST['uid'] = $uid;
                 $members_model = M('Members');
                 $member = $members_model->field("user_login_name,user_email")->where("ID={$uid}")->find();
                 $username = $member['user_login_name'];
                 $email = $member['user_email'];
                 $_POST['full_name'] = $username;
                 $_POST['email'] = $email;
             }
             $result = $this->comments_model->add();
             if ($result !== false) {
                 $this->success("评论成功!");
             } else {
                 $this->error("评论失败!");
             }
         } else {
             $this->error($this->comments_model->getError());
         }
     }
 }
开发者ID:Nightchen0521,项目名称:cmf,代码行数:30,代码来源:CommentAction.class.php

示例4: post

 function post()
 {
     /* if($_SESSION['_verify_']['verify']!=I("post.verify")){
     			$this->error("验证码错误!");
     		} */
     if (IS_POST) {
         $post_table = sp_authcode($_POST['post_table']);
         $_POST['post_table'] = $post_table;
         $url = parse_url(urldecode($_POST['url']));
         $query = empty($url['query']) ? "" : "?{$url['query']}";
         $url = "{$url['scheme']}://{$url['host']}{$url['path']}{$query}";
         $_POST['url'] = sp_get_relative_url($url);
         if (isset($_SESSION["user"])) {
             //用户已登陆,且是本站会员
             $uid = $_SESSION["user"]['id'];
             $_POST['uid'] = $uid;
             $users_model = M('Users');
             $user = $users_model->field("user_login,user_email,user_nicename")->where("id={$uid}")->find();
             $username = $user['user_login'];
             $user_nicename = $user['user_nicename'];
             $email = $user['user_email'];
             $_POST['full_name'] = empty($user_nicename) ? $username : $user_nicename;
             $_POST['email'] = $email;
         }
         if (C("COMMENT_NEED_CHECK")) {
             $_POST['status'] = 0;
             //评论审核功能开启
         } else {
             $_POST['status'] = 1;
         }
         if ($this->comments_model->create()) {
             $this->check_last_action(intval(C("COMMENT_TIME_INTERVAL")));
             $result = $this->comments_model->add();
             if ($result !== false) {
                 //评论计数
                 $post_table = ucwords(str_replace("_", " ", $post_table));
                 $post_table = str_replace(" ", "", $post_table);
                 $post_table_model = M($post_table);
                 $pk = $post_table_model->getPk();
                 $post_table_model->create(array("comment_count" => array("exp", "comment_count+1")));
                 $post_table_model->where(array($pk => intval($_POST['post_id'])))->save();
                 $post_table_model->create(array("last_comment" => time()));
                 $post_table_model->where(array($pk => intval($_POST['post_id'])))->save();
                 $this->ajaxReturn(sp_ajax_return(array("id" => $result), "评论成功!", 1));
             } else {
                 $this->error("评论失败!");
             }
         } else {
             $this->error($this->comments_model->getError());
         }
     }
 }
开发者ID:elinxer,项目名称:hualilibrary,代码行数:52,代码来源:CommentController.class.php

示例5: _initialize

 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']));
 }
开发者ID:kmlzh1983,项目名称:diamond,代码行数:42,代码来源:HomeBaseController.class.php

示例6: do_favorite

 function do_favorite()
 {
     $key = sp_authcode($_POST['key']);
     if ($key) {
         $authkey = C("AUTHCODE");
         $key = explode(" ", $key);
         $authcode = $key[0];
         if ($authcode == C("AUTHCODE")) {
             $table = $key[1];
             $object_id = $key[2];
             $post = I("post.");
             unset($post['key']);
             $post['table'] = $table;
             $post['object_id'] = $object_id;
             $uid = sp_get_current_userid();
             $post['uid'] = $uid;
             $user_favorites_model = M("UserFavorites");
             $find_favorite = $user_favorites_model->where(array('table' => $table, 'object_id' => $object_id, 'uid' => $uid))->find();
             if ($find_favorite) {
                 $this->error("亲,您已收藏过啦!");
             } else {
                 $post['createtime'] = time();
                 $result = $user_favorites_model->add($post);
                 if ($result) {
                     $this->success("收藏成功!");
                 } else {
                     $this->error("收藏失败!");
                 }
             }
         } else {
             $this->error("非法操作,无合法密钥!");
         }
     } else {
         $this->error("非法操作,无密钥!");
     }
     $this->error(sp_authcode($_POST['key']));
 }
开发者ID:elinxer,项目名称:hualilibrary,代码行数:37,代码来源:FavoriteController.class.php

示例7: sp_authencode

function sp_authencode($string)
{
    return sp_authcode($string, "ENCODE");
}
开发者ID:noikiy,项目名称:luokeke2,代码行数:4,代码来源:function.php


注:本文中的sp_authcode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。