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


PHP think_encrypt函数代码示例

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


在下文中一共展示了think_encrypt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 麦当苗儿 <zuojiazi@vip.qq.com>
  */
 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 ='zyajf1314@163.com';
     		$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 <banhuajie@163.com>
  */
 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 <lussen@xingluxin.cn>
  */
 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 麦当苗儿 <zuojiazi@vip.qq.com>
 */
function array_encode($data, $key = '', $expire = 0)
{
    $data = json_encode($data);
    return think_encrypt($data, $key, $expire);
}
开发者ID:licaikai,项目名称:baby,代码行数:13,代码来源:function.php


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