• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP think_encrypt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: enc

 public function enc()
 {
     echo $str = think_encrypt('123fejf', 'fjejf339fd3j', 15);
     $str1 = think_decrypt($str, 'fjejf339fd3j');
     S('t', $str);
     dump(S('t'));
 }
开发者ID:king192,项目名称:mycollects,代码行数:7,代码来源:IndexController.class.php


示例2: save

 /**
  * 批量保存配置
  * @author 麦当苗儿 <[email protected]>
  */
 public function save($config)
 {
     $old['artid'] = M('Config')->where(array('name' => 'WXARTID'))->getField('value');
     if ($config && is_array($config)) {
         $Config = M('Config');
         foreach ($config as $name => $value) {
             $map = array('name' => $name);
             if ($name == 'WXARTID') {
                 if ($old['artid'] != $value) {
                     asyn_sendwx();
                     //$WX->sendwx();
                 }
             }
             if ($name == 'WXPASS') {
                 $value = think_encrypt($value, UC_AUTH_KEY);
             }
             $Config->where($map)->setField('value', $value);
         }
     }
     S('DB_CONFIG_DATA', null);
     $config_file = './App/Home/Conf/theme.php';
     $themename = (include $config_file);
     if ($config['WEB_THEME'] != $themename['DEFAULT_THEME']) {
         //写入配置文件
         $theme['DEFAULT_THEME'] = $config['WEB_THEME'];
         file_put_contents($config_file, "<?php \nreturn " . var_export($theme, true) . ";", LOCK_EX);
         dir_delete(RUNTIME_PATH);
     }
     $this->mtReturn(200, '网站配置保存成功!', '', 'forward', U('group'));
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:34,代码来源:ConfigController.class.php


示例3: upload

 public function upload()
 {
     /* 返回标准数据 */
     $return = array('status' => 1, 'info' => '上传成功', 'data' => '');
     /* 获取当前分类附件配置信息 */
     $default = C('ATTACHMENT_DEFAULT');
     $category = get_category(I('get.category'));
     /* 分类正确性检测 */
     if (empty($category)) {
         $return['status'] = 0;
         $return['info'] = '没有指定分类或分类不正确;';
     } else {
         $config = $category['extend']['attachment'];
         $config = empty($config) ? $default : array_merge($default, $config);
         /* 检测并上传附件 */
         if (in_array('2', str2arr($config['allow_type']))) {
             $setting = C('ATTACHMENT_UPLOAD');
             /* 调用文件上传组件上传文件 */
             $File = M('File');
             $info = $File->upload($_FILES, $setting, $config['driver'], $config['driver_config']);
             /* 记录附件信息 */
             if ($info) {
                 $return['data'] = think_encrypt(json_encode($info['attachment']));
             } else {
                 $return['status'] = 0;
                 $return['info'] = $File->getError();
             }
         } else {
             $return['info'] = '该分类不允许上传文件附件!';
             $return['status'] = 0;
         }
     }
     /* 返回JSON数据 */
     $this->ajaxReturn($return);
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:35,代码来源:AttachmentController.class.php


示例4: artc

 public function artc()
 {
     $id = I('id');
     $info = D('Article')->get_info($id);
     if (!$info) {
         $this->error('非法ID!', U('Index/index'), false, true);
     }
     $info['description'] = stripcslashes($info['description']);
     preg_match_all("/(?<=\\[attach\\])([\\d]*)(?=\\[\\/attach\\])/", $info['description'], $arr);
     preg_match_all("/(?<=\\[qnattach\\])([\\d]*)(?=\\[\\/qnattach\\])/", $info['description'], $qnarr);
     foreach ($arr[0] as $key => $vo) {
         $replace = '<a href="' . U('File/download', array('id' => think_encrypt($vo))) . '" target="_blank" >' . getattachname($vo) . '</a><span class="attachspan">(下载次数:' . getattachdnum($vo) . '次;大小:' . format_bytes(getattachsize($vo)) . ')</span>';
         $info['description'] = str_replace('[attach]' . $vo . '[/attach]', $replace, $info['description']);
     }
     foreach ($qnarr[0] as $key1 => $vo1) {
         $replace1 = '<a href="' . U('File/download', array('qn' => 1, 'id' => think_encrypt($vo1))) . '" target="_blank" >' . getqnattachname($vo1) . '</a><span class="attachspan">(下载次数:' . getqnattachdnum($vo1) . '次;大小:' . format_bytes(getqnattachsize($vo1)) . ')</span>';
         $info['description'] = str_replace('[qnattach]' . $vo1 . '[/qnattach]', $replace1, $info['description']);
     }
     if ($info['status'] != 1 && $info['uid'] != $_SESSION['cs_home']['user_auth']['uid']) {
         $this->error('你无权查看该内容!', '', false, true);
     }
     $focus['rowid'] = $info['id'];
     $focus['type'] = 1;
     if ($sccount = M('focus')->where($focus)->count() != $info['sccount']) {
         D('Article')->where(array('id' => $id))->setField('sccount', $sccount);
     }
     D('Article')->where(array('id' => $id))->setInc('view', 1);
     if (!empty($info['tag'])) {
         $tags = explode(',', $info['tag']);
         $info['linktag'] = '';
         foreach ($tags as $key1 => $vo1) {
             $maptag['title'] = $vo1;
             $maptag['type'] = 1;
             $tagid = M('tags')->where($maptag)->getField('id');
             $url = CSU('/tagart/' . $tagid, 'Index/tagart', array('id' => $tagid));
             $info['linktag'] .= '<a style="margin-left:5px;" href="' . $url . '">[' . $vo1 . ']</a>';
             $info['tagarr'][$key1] = '<a class="tag" href="' . $url . '">' . $vo1 . '</a>';
         }
     }
     $shareurl = 'http://' . $_SERVER['HTTP_HOST'] . CSU('/artc/' . $info['id'], 'Index/artc', array('id' => $info['id']));
     $sharedes = '原文链接:' . $shareurl;
     $sharetitle = $info['title'] . '-' . C('WEB_SITE_TITLE');
     $authorinfo = query_user(array('space_url', 'signature', 'avatar64', 'nickname'), $info['uid']);
     $map['id'] = is_login();
     $map['rowid'] = $info['id'];
     $map['type'] = 1;
     if (M('Focus')->where($map)->count() > 0) {
         $hassc = true;
     }
     $this->assign('shareurl', $shareurl);
     $this->assign('hassc', $hassc);
     $this->assign('sharedes', $sharedes);
     $this->assign('sharetitle', $sharetitle);
     $this->assign('authorinfo', $authorinfo);
     $this->assign('info', $info);
     $this->assign('webdescription', $info['title']);
     $this->assign('webkeyword', $info['title']);
     $this->assign('webtitle', $info['title']);
     $this->display();
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:60,代码来源:IndexController.class.php


示例5: login

 /**
  * 登陆验证
  * @param  [type] $u [用户名]
  * @param  [type] $p [密码]
  * @return [type] sid   [sid]
  * @return [type] uid   [用户ID]
  * @return [type] emp_name   [用户姓名]
  * @return [type] emp_no   [用户名]
  * @return [type] head  [头像]
  * @return [type] dept   [部门]
  * @return [type] position   [职位]
  * @return [type] rank   [职级]
  * @return [type] mobile_tel   [电话]
  * @return [type] email   [邮箱]
  * @return [type] sex   [性别]
  * @return [type] duty   [业务介绍]
  * @return [type] chek_flow [审核公文权限]
  * @return [type] submited_flow [提交公文权限]
  * @return [type] add_meeting [添加会议权限]
  * @return [type] check_meeting [<审核会议权限>]
  */
 function login($u, $p)
 {
     $result = D('User')->apiLogin($u, $p, -1, '1,2');
     // var_dump($result);
     // exit;
     if (is_array($result)) {
         //登陆成功返回accesskey
         $data['sid'] = think_encrypt($result['id'], C('UID_KEY'));
         $data['uid'] = $result['id'];
         $data['emp_name'] = $result['emp_name'];
         //姓名
         $data['emp_no'] = $result['emp_no'];
         //用户名
         $data['head'] = $result['pic'];
         //头像
         $data['dept'] = $result['dept_id'];
         //部门
         $data['position'] = $result['position_id'];
         //职位
         $data['rank'] = $result['rank_id'];
         //职级
         $data['mobile_tel'] = $result['mobile_tel'];
         //电话
         $data['email'] = $result['email'];
         //邮箱
         $data['sex'] = $result['sex'];
         //性别
         $data['duty'] = $result['duty'];
         //业务介绍
         $auth = $this->getAuth($result['id']);
         if ($auth) {
             // $data['add_flow'] = $auth['flow']?$auth['flow']:'';
             $data['add_meeting'] = $auth['meeting'] ? $auth['meeting'] : '';
             $data['check_meeting'] = $auth['meeting_check'] ? $auth['meeting_check'] : '';
             $data['chek_flow'] = $auth['chek_flow'] ? $auth['chek_flow'] : '';
             $data['submited_flow'] = $auth['submited_flow'] ? $auth['submited_flow'] : '';
         }
         // var_dump($data);
         // exit;
         $this->result('1', '登陆成功', $data);
     } else {
         switch ($result) {
             case 0:
                 $msg = '参数错误!';
                 break;
             case -1:
                 $msg = '用户不存在或被禁用!';
                 break;
             case -2:
                 $msg = '密码错误!';
                 break;
             case -3:
                 $msg = '没有登陆权限!';
                 break;
             default:
                 $msg = '未知错误!';
         }
         $this->result(0, $msg, '');
     }
 }
开发者ID:TipTimesPHP,项目名称:tyj_oa,代码行数:81,代码来源:MobilePhoneAction.class.php


示例6: getBackPwd

 public function getBackPwd()
 {
     $where['admin_email'] = $rootemail = I('post.rootemail');
     $where['name'] = $name = I('post.rootname');
     $pattern = '/^[0-9A-Za-z-\\._]+@\\w+(\\.(\\w){1,3}){1,3}$/';
     $subject = $rootemail;
     if (!preg_match($pattern, $subject)) {
         $this->redirect(U('Server/Admin'));
         die;
     } else {
         $tplObj = M('sys_email_templates');
         $tpl_status = $tplObj->field('subject,content,status')->where($where)->find();
         if ($tpl_status['status']) {
             //发邮件
             $to = $rootemail;
             //接收邮件邮箱
             $subject = $tpl_status['subject'];
             $content = $tpl_status['content'];
             //模板中包含标示
             // 自定义邮件发送内容
             $url = 'http://' . I('server.HTTP_HOST') . __APP__ . __CONTROLLER__ . '/repwd/code/' . think_encrypt($to);
             //此处加密未随机待完善
             $username = '您于' . date('Y年m月d分 H时i分s秒') . '申请找回密码<strong style="color:#00acff;">' . $rootemail . '</strong>';
             $sy_webname = C('site_name');
             $url = '<a href="' . $url . '">' . $url . '</a>';
             $sy_webcopyright = C('copyright');
             // 邮件内容正则
             $pattern = array('/{sy_webname}/', '/{sy_webcopyright}/', '/{username}/', '/{url}/');
             $replacement = array($sy_webname, $sy_webcopyright, $username, $url);
             //替换模板中标签成实际内容
             $newSubject = preg_replace($pattern, $replacement, $subject);
             $newContent = preg_replace($pattern, $replacement, $content);
             //dump($newSubject);
             //dump($newContent);exit;
             $email = sendEMail($to, $newSubject, $newContent);
             //发送成功直接修改数据密码
             if ($email) {
                 //修改发送邮件时间,便用于邮件过期处理
                 $Model = M('root_admin');
                 $Model->where("name='{$name}'")->setField('this_time', time());
             } else {
                 $this->success('邮件发送失败,返回重试', U('Server/Admin'), 3);
             }
         } else {
             $this->error('管理员关闭找回密码功能', U('Server/Admin'), 3);
         }
     }
     //考虑调试邮箱登陆接口(未尝试过)
     $this->success('请查收您的邮件', U('Admin/index'), 3);
     /*
     		$to ='[email protected]';
     		$subject = '主题';
     		$content = '内容';
     		$email = sendEMail($to, $subject, $content);*/
     //dump($email);
 }
开发者ID:php-wechat,项目名称:wechat,代码行数:56,代码来源:SendemailController.class.php


示例7: upload

 public function upload()
 {
     $return = array('status' => 1, 'info' => '上传成功', 'data' => '');
     $qiniuconfig = json_decode(M('addons')->where(array('name' => 'Qiniu'))->getField('config'), true);
     if ($qiniuconfig['open'] == 1) {
         $addon = new QiniuAddon();
         $return = $addon->upload($_FILES);
         $exts = explode('.', strrev($_FILES['download']['name']));
         if (in_array(strtolower(strrev($exts[0])), array('jpg', 'gif', 'png', 'jpeg'))) {
             $return['ext'] = 3;
         } else {
             $return['ext'] = 4;
         }
         $this->ajaxReturn($return);
     } else {
         $exts = explode('.', strrev($_FILES['download']['name']));
         if (in_array(strtolower(strrev($exts[0])), array('jpg', 'gif', 'png', 'jpeg'))) {
             $return['ext'] = 1;
             /* 调用文件上传组件上传文件 */
             $Picture = D('Picture');
             $pic_driver = C('PICTURE_UPLOAD_DRIVER');
             $info = $Picture->upload($_FILES, C('PICTURE_UPLOAD'), C('PICTURE_UPLOAD_DRIVER'), C("UPLOAD_{$pic_driver}_CONFIG"));
             //TODO:上传到远程服务器
             /* 记录图片信息 */
             if ($info) {
                 $return['status'] = 1;
                 $info['download']['path'] = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/' . C('WEB_DIR') . $info['download']['path'];
                 // $info['Picture']['path']=$GLOBALS['_root'].$info['Picture']['path'];
                 $return = array_merge($info['download'], $return);
                 $return['info'] = $info[0]['path'];
                 //  $return['info'] =$_FILES['download']['name'];
             } else {
                 $return['status'] = 0;
                 $return['info'] = $Picture->getError();
             }
             $this->ajaxReturn($return);
         } else {
             $return['ext'] = 2;
             /* 调用文件上传组件上传文件 */
             $File = D('File');
             $file_driver = C('DOWNLOAD_UPLOAD_DRIVER');
             $info = $File->upload($_FILES, C('DOWNLOAD_UPLOAD'), C('DOWNLOAD_UPLOAD_DRIVER'), C("UPLOAD_{$file_driver}_CONFIG"));
             /* 记录附件信息 */
             if ($info) {
                 $return['status'] = 1;
                 $return['data'] = U('File/download', array('id' => think_encrypt($info['download']['id'])));
                 $return['info'] = $info['download']['id'];
             } else {
                 $return['status'] = 0;
                 $return['info'] = $File->getError();
             }
             /* 返回JSON数据 */
             $this->ajaxReturn($return, 'JSON');
         }
     }
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:56,代码来源:FileController.class.php


示例8: detail

 /**
  * 获取模型详细信息
  * @param  integer $id 文档ID
  * @return array       当前模型详细信息
  * @author huajie <[email protected]>
  */
 public function detail($id)
 {
     $data = $this->field(true)->find($id);
     if (!$data) {
         $this->error = '获取详细信息出错!';
         return false;
     }
     $file = D('File')->field(true)->find($data['file_id']);
     $data['file'] = think_encrypt(json_encode($file));
     $data['file_id'] = $file;
     return $data;
 }
开发者ID:jayfjso,项目名称:pinsen,代码行数:18,代码来源:DownloadLogic.class.php


示例9: ssoList

 public function ssoList()
 {
     //读取规则列表
     $map = array('status' => array('EGT', 0));
     $model = M('sso_app');
     $appList = $model->where($map)->order('id asc')->select();
     foreach ($appList as &$v) {
         $url = $v['url'] . '/' . $v['path'] . '?code=' . urlencode(think_encrypt('action=test&time=' . time()));
         $arr = $this->check_link($url);
         $v['link_status'] = $v['status'] == 1 ? $arr === 'success' ? '<span style="color:green">连接成功</span>' : '<span style="color:red">连接失败</span>' : '<span style="color:red">连接失败-已被禁用</span>';
     }
     unset($v);
     //显示页面
     $builder = new AdminListBuilder();
     $builder->title('单点登录应用列表')->buttonNew(U('editSsoApp'))->setStatusUrl(U('setSsoAppStatus'))->buttonEnable()->buttonDisable()->buttonDelete()->keyId()->keyTitle()->keyText('url', '网站路径')->keyText('path', 'api目录')->keyStatus()->keyText('link_status', '连接状态')->keyDoActionEdit('editSsoApp?id=###')->data($appList)->display();
 }
开发者ID:fishling,项目名称:chatPro,代码行数:16,代码来源:AuthorizeController.class.php


示例10: creatPay

 /**
  * @param 创建订单
  * @return 加密后的站内订单编号
  * @author lussen <[email protected]>
  */
 public function creatPay()
 {
     $site_order = time_format(time(), 'YmdHis') . rand(100, 999);
     $data['uid'] = is_login();
     $data['pay_money'] = I('post.money');
     $data['pay_item'] = I('post.pay_item');
     $data['site_order'] = $site_order;
     $data['isdone'] = 0;
     $data['create_time'] = time();
     $result = $this->data($data)->add();
     if ($result !== false) {
         return think_encrypt($site_order);
     } else {
         return false;
     }
 }
开发者ID:xingluxin,项目名称:jianshen,代码行数:21,代码来源:PayModel.class.php


示例11: ssoList

 public function ssoList()
 {
     //读取规则列表
     $map = array('status' => array('EGT', 0));
     $model = D('sso_app');
     $appList = $model->where($map)->order('id asc')->select();
     foreach ($appList as &$v) {
         $url = $v['url'] . '/' . $v['path'] . '?code=' . urlencode(think_encrypt('action=test&time=' . time()));
         $arr = $this->check_link($url);
         $v['link_status'] = $v['status'] == 1 ? $arr === 'success' ? '<span style="color:green">' . L('_SUCCESS__LINK_') . '</span>' : '<span style="color:red">' . L('_FAIL__LINK_') . '</span>' : '<span style="color:red">' . L('_FAIL__LINK_LIMITED_') . '</span>';
     }
     unset($v);
     //显示页面
     $builder = new AdminListBuilder();
     $builder->title(L('_SINGLE_POINT_LOGIN_APPLICATION_LIST_'))->buttonNew(U('editSsoApp'))->setStatusUrl(U('setSsoAppStatus'))->buttonEnable()->buttonDisable()->buttonDelete()->keyId()->keyTitle()->keyText('url', L('_WEBSITE_PATH_'))->keyText('path', L('_CATEGORY_API_'))->keyStatus()->keyText('link_status', L('_CONNECTED_STATE_'))->keyDoActionEdit('editSsoApp?id=###')->data($appList)->display();
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:16,代码来源:AuthorizeController.class.php


示例12: upload

 public function upload()
 {
     $return = array('status' => 1, 'info' => '上传成功', 'data' => '');
     /* 调用文件上传组件上传文件 */
     $File = D('File');
     $file_driver = C('DOWNLOAD_UPLOAD_DRIVER');
     $info = $File->upload($_FILES, C('DOWNLOAD_UPLOAD'), C('DOWNLOAD_UPLOAD_DRIVER'), C("UPLOAD_{$file_driver}_CONFIG"));
     /* 记录附件信息 */
     if ($info) {
         $return['data'] = think_encrypt(json_encode($info['download']));
     } else {
         $return['status'] = 0;
         $return['info'] = $File->getError();
     }
     /* 返回JSON数据 */
     $this->ajaxReturn($return);
 }
开发者ID:kevins1022,项目名称:tpshop,代码行数:17,代码来源:FileController.class.php


示例13: upload

 public function upload()
 {
     //TODO: 用户登录检测
     /* 返回标准数据 */
     $return = array('status' => 1, 'info' => '上传成功', 'data' => '');
     /* 调用文件上传组件上传文件 */
     $File = D('File');
     $info = $File->upload($_FILES, C('DOWNLOAD_UPLOAD'));
     //TODO:上传到远程服务器
     /* 记录附件信息 */
     if ($info) {
         $return['data'] = think_encrypt(json_encode($info['download']));
     } else {
         $return['status'] = 0;
         $return['info'] = $File->getError();
     }
     /* 返回JSON数据 */
     $this->ajaxReturn($return);
 }
开发者ID:commiunty,项目名称:Mytest,代码行数:19,代码来源:FileController.class.php


示例14: addMoney

 public function addMoney($moeny, $uid)
 {
     echo $uid;
     $map['uid'] = $uid;
     $row = $this->where($map)->find();
     if (empty($row['id'])) {
         $data['uid'] = $uid;
         $data['money'] = think_encrypt($money);
         $result = $this->data($data)->add();
     } else {
         $map['uid'] = $uid;
         $data['money'] = think_encrypt(think_decrypt($row['money']) + $moeny);
         $result = $this->data($data)->where($map)->save();
         if ($result !== false) {
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:xingluxin,项目名称:jianshen,代码行数:20,代码来源:WalletModel.class.php


示例15: array_encode

/**
 * 数组加密方法
 * @param string $data 要加密的字符串
 * @param string $key  加密密钥
 * @param int $expire  过期时间 单位 秒
 * @return string
 * @author 麦当苗儿 <[email protected]>
 */
function array_encode($data, $key = '', $expire = 0)
{
    $data = json_encode($data);
    return think_encrypt($data, $key, $expire);
}
开发者ID:licaikai,项目名称:baby,代码行数:13,代码来源:function.php


示例16: loginBangding

 /**
  * 登录绑定
  */
 public function loginBangding()
 {
     $uid = is_login();
     if ($uid > 0) {
         //无论用户原来有没有绑定,自动绑定新的微信
         redirect(U('Mobile/Public/bangding'));
         //如果会员已经登录则自动跳转到会员中心
     }
     $code = I('get.code');
     //线上
     if (empty($code)) {
         $url = SITE_URL . loginBangdingUrl();
         $this->getToken($url);
         //线上
         return;
     }
     $userOpenid = $this->getOpenid();
     //线上
     cookie(md5('userOpenid'), think_encrypt($userOpenid));
     $data = array();
     $data['title'] = "袋袋金-绑定";
     $this->assign($data);
     $this->display("loginBangding");
     //action 有大写,需要明确指定模板文件
 }
开发者ID:simpboy,项目名称:api_weixin_out,代码行数:28,代码来源:PublicController.class.php


示例17: url_encode

/**
 * url加密
 * @param $num
 * @return string
 */
function url_encode($num)
{
    return think_encrypt($num, C('URL_KEY'));
}
开发者ID:TipTimesPHP,项目名称:tyj_oa,代码行数:9,代码来源:common.php


示例18: loginBangding

 /**
  * 登录绑定,未被使用
  */
 public function loginBangding()
 {
     $uid = is_login();
     if ($uid > 0) {
         //无论用户原来有没有绑定,自动绑定新的微信
         redirect(U('Home/User/showUser'));
         //如果会员已经登录则自动跳转到会员中心
     }
     if (IS_POST) {
         $postData = I("post.");
         $where = array();
         if (preg_match('/^1\\d{10}$/', $postData['username'])) {
             $where['mobile'] = $postData['username'];
         } else {
             $where['username'] = $postData['username'];
         }
         $where['password'] = encrypt_password($postData['password']);
         $userInfo = M('user')->where($where)->find();
         if (!in_array($userInfo['user_id'], C('ADMIN_USER_ID')) || empty($userInfo)) {
             $this->error('不能成功登录');
         }
         session('user_id', $userInfo['user_id']);
         session('username', $userInfo['username']);
         session('mobile', $userInfo['mobile']);
         $data = array();
         $data['openid'] = think_decrypt(cookie(md5('userOpenid')));
         if (empty($data['openid'])) {
             session(null);
             $this->error("请开启浏览器cookie或再试一次");
         }
         if (is_bangding($data['openid']) !== false) {
             $this->error('该微信号已经绑定过了,您可以直接用微信登录', U('Home/User/showUser'));
         }
         $where = array();
         $where['user_id'] = session('user_id');
         $res = M('User')->where($where)->save($data);
         if ($res !== false) {
             $this->success('登录绑定成功!', U('Home/User/showUser'));
         } else {
             session(null);
             $this->error('登录绑定失败!', U('Home/User/loginBangding'));
         }
         exit;
     }
     $code = I('get.code');
     //线上
     if (empty($code)) {
         $url = SITE_URL . U('Home/User/loginBangding');
         $this->getToken($url);
         //线上
         return;
     }
     $userOpenid = $this->getOpenid();
     //线上
     cookie(md5('userOpenid'), think_encrypt($userOpenid));
     $data = array();
     $data['title'] = "登录绑定";
     $this->assign($data);
     $this->display("loginBangding");
     //action 有大写,需要明确指定模板文件
 }
开发者ID:simpboy,项目名称:api_weixin_out,代码行数:64,代码来源:UserController.class.php


示例19: think_encrypt

								</script><?php 
                                    break;
                                    ?>
                            <?php 
                                case "file":
                                    ?>
<div class="controls">
									<input type="file" id="upload_file_<?php 
                                    echo $field["name"];
                                    ?>
">
									<input type="hidden" name="<?php 
                                    echo $field["name"];
                                    ?>
" value="<?php 
                                    echo think_encrypt(json_encode(get_table_field($data[$field['name']], 'id', '', 'File')));
                                    ?>
"/>
									<div class="upload-img-box">
										<?php 
                                    if (isset($data[$field['name']])) {
                                        ?>
<div class="upload-pre-file"><span class="upload_icon_all"></span><?php 
                                        echo get_table_field($data[$field['name']], 'id', 'name', 'File');
                                        ?>
</div><?php 
                                    }
                                    ?>
									</div>
								</div>
								<script type="text/javascript">
开发者ID:kevins1022,项目名称:tpshop,代码行数:31,代码来源:608b0c961c661bd6d45820311b4b75a7.php


示例20: jiamiFile

    function jiamiFile()
    {
        // 取当前用户的网站信息
        $map['uid'] = $this->mid;
        $info = M('web_info')->where($map)->find();
        // 第一步:取文件内容
        $file = SITE_PATH . '/test.php';
        $get = trim(wp_file_get_contents($file));
        if ('<?php' == strtolower(substr($get, 0, 5))) {
            $get = substr($get, 5);
        } else {
            $get = substr($get, 2);
        }
        if ('?>' == substr($get, -2)) {
            $get = substr($get, 0, -2);
        }
        // 第二步:取加密的KEY
        $key = substr($info['web_key'], 0, 5);
        $license = substr($info['web_key'], 5);
        // 代码里插入判断授权的代码段
        $pre_code = <<<str
\t\t\$ip = gethostbyname ( SITE_DOMAIN );
\t\t\$fip = strtok ( \$ip, '.' );
\t\t\$is_free = \$fip == '10' || \$fip == '127' || \$fip == '168' || \$fip == '192';
\t\tif (! \$is_free) {
\t\t\t\$license = C ( 'WEIPHP_STORE_LICENSE' );
\t\t\t\$key = substr ( \$license, 0, 5 );
\t\t\t\$license = substr ( \$license, 5 );\t\t\t
\t\t\t
\t\t\t\$domain_str = md5 ( think_encrypt ( SITE_DOMAIN, \$key ) );
\t\t\t\$ip_str = md5 ( think_encrypt ( \$ip, \$key ) );
\t\t\tif (\$license != \$domain_str && \$license != \$ip_str) {
\t\t\t\theader("Content-Type: text/html;charset=utf-8"); 
\t\t\t\techo '禁止访问未授权的应用';
\t\t\t\texit ();
\t\t\t}
\t\t}
str;
        $content = strip_whitespace($pre_code . $get);
        $content = think_encrypt($content, $key);
        $content = "<?php eval(code_decode('{$content}'));";
        dump($content);
        file_put_contents(SITE_PATH . '/test2.php', $content);
    }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:44,代码来源:TestController.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP think_ucenter_md5函数代码示例发布时间:2022-05-23
下一篇:
PHP think_decrypt函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap