當前位置: 首頁>>代碼示例>>PHP>>正文


PHP think_decrypt函數代碼示例

本文整理匯總了PHP中think_decrypt函數的典型用法代碼示例。如果您正苦於以下問題:PHP think_decrypt函數的具體用法?PHP think_decrypt怎麽用?PHP think_decrypt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了think_decrypt函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update

 public function update($id)
 {
     /* 獲取下載數據 */
     //TODO: 根據不同用戶獲取允許更改或添加的字段
     $data = $this->field('download', true)->create();
     if (!$data) {
         return false;
     }
     $file = json_decode(think_decrypt(I('post.file')), true);
     if (!empty($file)) {
         $data['file_id'] = $file['id'];
         $data['size'] = $file['size'];
     } else {
         $this->error = '獲取上傳文件信息失敗!';
         return false;
     }
     /* 添加或更新數據 */
     if (empty($data['id'])) {
         //新增數據
         $data['id'] = $id;
         $id = $this->add($data);
         if (!$id) {
             $this->error = '新增詳細內容失敗!';
             return false;
         }
     } else {
         //更新數據
         $status = $this->save($data);
         if (false === $status) {
             $this->error = '更新詳細內容失敗!';
             return false;
         }
     }
     return true;
 }
開發者ID:terrydeng,項目名稱:beimeibang1205,代碼行數:35,代碼來源:DownloadLogic.class.php

示例2: repwd

 /**
  * 用戶郵箱驗證
  * @return void
  */
 public function repwd()
 {
     $repwd = I('post.repwd');
     $code = I('get.code');
     $email = think_decrypt($code);
     //解密(此處未考慮加密時隨機性,發送郵件鏈接會一致)
     $Model = M('root_admin');
     if (!empty($email)) {
         $emailTime = $Model->field('this_time')->where("admin_email='{$email}'")->find();
         $eTime = $emailTime['this_time'];
         $nowTime = time();
         $timed = $nowTime - $eTime;
         //郵件是否過期
         if ($timed > 86400 && empty($repwd)) {
             $this->error('驗證郵件已過期', U('Admin/index'));
         }
         $this->display('Admin:repwd');
     } else {
         //執行修改密碼操作
         $re = I('post.pwd');
         $pw = I('post.repwd');
         $rname = I('post.rootname');
         if ($re != $pw) {
             $this->error('兩次輸入密碼不一致');
             exit;
         }
         //自定義加密函數
         $p = mypwd($repwd);
         $result = $Model->where("name='{$rname}'")->setField('pwd', $p);
         if ($result) {
             $this->success('找回密碼成功,請登陸', U('Admin/index'), 3);
         }
     }
 }
開發者ID:php-wechat,項目名稱:wechat,代碼行數:38,代碼來源:SendemailController.class.php

示例3: documentSaveComplete

 /**
  * 文檔保存成功後執行行為
  * @param  array  $data     文檔數據
  * @param  array  $catecory 分類數據
  */
 public function documentSaveComplete($param)
 {
     if (MODULE_NAME == 'Home') {
         list($data, $category) = $param;
         /* 附件默認配置項 */
         $default = C('ATTACHMENT_DEFAULT');
         /* 合並當前配置 */
         $config = $category['extend']['attachment'];
         $config = empty($config) ? $default : array_merge($default, $config);
         $attach = I('post.attachment');
         /* 該分類不允許上傳附件 */
         if (!$config['is_upload'] || !in_array($attach['type'], str2arr($config['allow_type']))) {
             return;
         }
         switch ($attach['type']) {
             case 1:
                 //外鏈
                 # code...
                 break;
             case 2:
                 //文件
                 $info = json_decode(think_decrypt($attach['info']), true);
                 if (!empty($info)) {
                     $Attachment = D('Addons://Attachment/Attachment');
                     $Attachment->saveFile($info['name'], $info, $data['id']);
                 } else {
                     return;
                     //TODO:非法附件上傳,可記錄日誌
                 }
                 break;
         }
     }
 }
開發者ID:kissthink,項目名稱:Hackme,代碼行數:38,代碼來源:AttachmentAddon.class.php

示例4: sendwx

 public function sendwx()
 {
     $cpass = think_decrypt(C('WXPASS'), UC_AUTH_KEY);
     $wtoptions = array('account' => C('WXUSER'), 'password' => $cpass, 'datapath' => '../Data/cookie_', 'debug' => true, 'logcallback' => 'logdebug');
     $wt = new Wechatext($wtoptions);
     $userlist = $wt->getUserList(0, 10);
     foreach ($userlist as $key => $uvo) {
         $wt->send($uvo['id'], '每日推薦更新了,快去看看吧。輸入推薦或者點擊下方的每日精選!');
     }
 }
開發者ID:Willshon,項目名稱:OLCS,代碼行數:10,代碼來源:WeixinController.class.php

示例5: getInfo

 /**
  * 根據站內訂單號獲取單條支付信息
  * @param  $site_order 站內訂單號
  * @param  $isEncrypt 傳入的站內訂單號是否是已加密的,默認加密
  * @return 指定訂單數組
  * @author lussen <lussen@xingluxin.cn>
  */
 public function getInfo($site_order = 0, $isEncrypt = true)
 {
     if ($isEncrypt) {
         $map['site_order'] = think_decrypt($site_order);
     } else {
         $map['site_order'] = $site_order;
     }
     $row = $this->where($map)->find();
     return $row;
 }
開發者ID:xingluxin,項目名稱:jianshen,代碼行數:17,代碼來源:PayModel.class.php

示例6: login

 public function login()
 {
     if (IS_POST) {
         $_POST = I('post.');
         $res = D('Member')->check_account($_POST);
         if (!$res['status']) {
             if (IS_AJAX) {
                 $this->ajaxReturn(array('status' => 0, 'error' => $res['error']));
             } else {
                 $this->error($res['error']);
             }
         } else {
             if (!check_verify($_POST['verify'])) {
                 if (IS_AJAX) {
                     $this->ajaxReturn(array('status' => 0, 'error' => '驗證碼錯誤!'));
                 } else {
                     $this->error('驗證碼錯誤!');
                 }
             }
             D('Member')->sign_account(array('id' => $res['data']['id'], 'user' => $res['data']['user']));
             //記錄登錄時間
             D('Member')->save_item(array('id' => $res['data']['id'], 'last_login_time' => NOW_TIME));
             //記錄賬號cookie
             if ($_POST['remember']) {
                 cookie('user', $_POST['user']);
             } else {
                 cookie('user', null);
             }
             if ($_POST['back_url']) {
                 if (IS_AJAX) {
                     $this->ajaxReturn(array('status' => 1, 'back_url' => think_decrypt($_POST['back_url'])));
                 } else {
                     $this->redirect(think_decrypt($_POST['back_url']));
                 }
                 redirect(think_decrypt($_POST['back_url']), 1, '登錄成功!');
             } else {
                 if (IS_AJAX) {
                     $this->ajaxReturn(array('status' => 1, 'back_url' => U('Member/Index/index')));
                 } else {
                     $this->success('登錄成功!', 'Index/index');
                 }
             }
         }
     } else {
         //驗證是否登錄
         if ($id = D('Member')->is_login()) {
             $this->redirect('Index/index');
         }
         $this->display();
     }
 }
開發者ID:licaikai,項目名稱:baby,代碼行數:51,代碼來源:PublicController.class.php

示例7: loginBangding

 /**
  * 登錄綁定
  * @author wangxianlei
  */
 public function loginBangding()
 {
     $this->loginAction('', '', false);
     $uid = is_login();
     $uid <= 0 && $this->error("登錄失敗,未能綁定", SITE_URL . loginBangdingUrl());
     $map = array();
     $map['id'] = $uid;
     $data['openid'] = think_decrypt(cookie(md5('userOpenid')));
     empty($data['openid']) && $this->error("請開啟瀏覽器cookie或再試一次");
     is_bangding($data['openid']) !== false && $this->error('該微信號已經綁定過袋袋金帳號了');
     $res = M('UcenterMember')->where($map)->save($data);
     if ($res !== false) {
         $data['shareTitle'] = "放心理財,縱向生活—袋袋金";
         $data['title'] = "袋袋金";
         $this->assign($data);
         $this->display("loginBangdingSuccess");
     } else {
         $this->display("loginBangdingFail");
     }
 }
開發者ID:simpboy,項目名稱:api_weixin_out,代碼行數:24,代碼來源:PassportController.class.php

示例8: update

 /**
  * 新增或更新一個文檔
  * @param array  $data 手動傳入的數據
  * @return boolean fasle 失敗 , int  成功 返回完整的數據
  * @author huajie <banhuajie@163.com>
  */
 public function update($data = null)
 {
     /* 獲取數據對象 */
     $data = $this->token(false)->create($data);
     $data['file_id'] = think_decrypt($data['file_id']);
     //推薦位
     if (is_array($data['position'])) {
         $data['position'] = arr2str($data['position']);
     }
     //組圖
     if (is_array($data['pics_id'])) {
         $data['pics_id'] = arr2str($data['pics_id']);
     }
     //附件
     $data['file_id'] = think_decrypt($data['file_id']);
     if (empty($data)) {
         return false;
     }
     /* 添加或新增基礎內容 */
     if (empty($data['id'])) {
         //新增數據
         $id = $this->data($data)->add();
         //添加基礎內容
         if (!$id) {
             $this->error = '新增基礎內容出錯!';
             return false;
         }
     } else {
         //更新數據
         $status = $this->data($data)->save();
         //更新基礎內容
         if (false === $status) {
             $this->error = '更新基礎內容出錯!';
             return false;
         }
     }
     //內容添加或更新完成
     return $data;
 }
開發者ID:xingluxin,項目名稱:jianshen,代碼行數:45,代碼來源:DocumentModel.class.php

示例9: yzmail

 public function yzmail()
 {
     $uid = is_login();
     $mailuid = think_decrypt(I('uid'));
     if ($uid != $mailuid) {
         $this->error('非法驗證操作或驗證已超時', U('Index/index'));
     } else {
         $map['id'] = $mailuid;
         $res = M('userexp')->where($map)->find();
         if ($res != '') {
             $data['id'] = $mailuid;
             $data['email'] = think_decrypt(I('mail'));
             M('userexp')->save($data);
         } else {
             $data['id'] = $mailuid;
             $data['email'] = think_decrypt(I('mail'));
             M('userexp')->add($data);
         }
         M('ucenter_member')->where($map)->setField('email', think_decrypt(I('mail')));
         $this->success('郵箱驗證通過', U('Ucenter/index'));
     }
 }
開發者ID:Willshon,項目名稱:OLCS,代碼行數:22,代碼來源:UserbaseController.class.php

示例10: download

 public function download($id = null)
 {
     $id = think_decrypt($id);
     if (empty($id) || !is_numeric($id)) {
         $this->error('參數錯誤!');
     }
     //
     if (I('qn') == 1) {
         $qiniuconfig = json_decode(M('addons')->where(array('name' => 'Qiniu'))->getField('config'), true);
         $addon = new QiniuAddon();
         $qn = M('Qiniu')->where(array('id' => $id))->find();
         M('Qiniu')->where(array('id' => $id))->setInc('download');
         /* 執行下載 */
         //TODO: 大文件斷點續傳
         // $filename=$fileurl;
         header("Content-Description: File Transfer");
         header('Content-type: ' . $qn['mime']);
         header('Content-Length:' . $qn['size']);
         if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) {
             //for IE
             header('Content-Disposition: attachment; filename="' . rawurlencode($qn['name']) . '"');
         } else {
             header('Content-Disposition: attachment; filename="' . $qn['name'] . '"');
         }
         if ($qiniuconfig['global'] == 1) {
             $size = readfile($qn['url']);
         } else {
             $url = $addon->Qiniu_Sign($qn['url']);
             $size = readfile($url);
         }
         exit;
         //return $url;
         //	exit;
     } else {
         if (!D('File')->download(C('DOWNLOAD_UPLOAD.rootPath'), $id)) {
             $this->error(D('File')->getError());
         }
     }
 }
開發者ID:Willshon,項目名稱:OLCS,代碼行數:39,代碼來源:FileController.class.php

示例11: checkSign

 /**
  * 檢測請求合法性
  */
 protected function checkSign()
 {
     if (isset($_REQUEST['_hash'])) {
         //數據簽名
         $time = $_REQUEST['_time'];
         //請求時間戳
         $hash = $_REQUEST['_hash'];
         //數據簽名
         $this->unsetGetPost('_hash');
         if ($hash == api_auth_sign($_REQUEST, C('API_PRIVATE_KEY'))) {
             //簽名認證
             $this->unsetGetPost('_time');
             //                if((NOW_TIME - $time)  > C('API_OUT_TIME')){ //檢測請求是否失效
             //                    $this->error("請求已經失效!");
             //                }
             $access_key = isset($_REQUEST['_sid']) ? $_REQUEST['_sid'] : 0;
             if ($access_key !== 0) {
                 //是否攜帶用戶登陸key,用於手機客戶端訪問
                 define('UID', think_decrypt($access_key, C('UID_KEY')));
             } else {
                 //檢測是否存儲在session中,主要用於api方式的web應用
                 $user = session('user_auth');
                 //是否存在session中
                 if (!$user) {
                     define('UID', 0);
                 } else {
                     define('UID', session('user_auth_sign') == data_auth_sign($user) ? $user['uid'] : 0);
                 }
             }
             $this->unsetGetPost('_sid');
         } else {
             $this->error("數據簽名有誤!錯誤代碼:105");
         }
     } else {
         $this->error("未進行數據簽名!錯誤代碼:104");
     }
 }
開發者ID:TipTimesPHP,項目名稱:tyj_oa_cp,代碼行數:40,代碼來源:BaseMobileAction.class.php

示例12: autoSave

 /**
  * 保存為草稿
  * @return true 成功, false 保存出錯
  * @author huajie <banhuajie@163.com>
  */
 public function autoSave($id = 0)
 {
     $this->_validate = array();
     /* 獲取文章數據 */
     $data = $this->create();
     if (!$data) {
         return false;
     }
     $file = json_decode(think_decrypt(I('post.file_id')), true);
     if (!empty($file)) {
         $data['file_id'] = $file['id'];
         $data['size'] = $file['size'];
     }
     /* 添加或更新數據 */
     if (empty($data['id'])) {
         //新增數據
         $data['id'] = $id;
         $id = $this->add($data);
         if (!$id) {
             $this->error = '新增詳細內容失敗!';
             return false;
         }
     } else {
         //更新數據
         $status = $this->save($data);
         if (false === $status) {
             $this->error = '更新詳細內容失敗!';
             return false;
         }
     }
     return true;
 }
開發者ID:terrydeng,項目名稱:beimeibang1205,代碼行數:37,代碼來源:DownloadLogic.class.php

示例13: doDownload

 public function doDownload($data)
 {
     foreach ($data['download'] as $k => $v) {
         $v = json_decode(think_decrypt($v), true);
         $download[$k] = $v['id'] ? $v['id'] : 0;
     }
     return $download;
 }
開發者ID:tiger2soft,項目名稱:thinkphp-zcms,代碼行數:8,代碼來源:ProductLogic.class.php

示例14: url_decode

/**
 * url揭秘
 * @param $num
 * @return string
 */
function url_decode($num)
{
    return think_decrypt($num, C('URL_KEY'));
}
開發者ID:TipTimesPHP,項目名稱:tyj_oa,代碼行數:9,代碼來源:common.php

示例15: 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


注:本文中的think_decrypt函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。