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

PHP Encrypt类代码示例

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

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



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

示例1: __get

 /**
  * Decrypt the data when taking it out of the database
  * @Developer brandon
  * @Date May 18, 2010
  */
 public function __get($key)
 {
     $value = parent::__get($key);
     if (in_array($key, array('content', 'title'))) {
         if ($value) {
             $encrypt = new Encrypt();
             $value = $encrypt->decode($value);
         }
     }
     return $value;
 }
开发者ID:ready4god2513,项目名称:Journal,代码行数:16,代码来源:journal.php


示例2: send

 public function send()
 {
     $c = new Encrypt();
     $message = $c->encode(json_encode($this->attributes));
     $q = MessageQueue::Get($account);
     try {
         $q->send($this->queue, $message);
         return TRUE;
     } catch (AWSException $ex) {
         return FALSE;
     }
 }
开发者ID:jawngee,项目名称:HeavyMetal,代码行数:12,代码来源:message.php


示例3: __construct

 public function __construct()
 {
     $this->cookie_name = Lemon::config('session.name') . '_data';
     if (Lemon::config('session.encryption')) {
         $this->encrypt = Encrypt::instance();
     }
 }
开发者ID:BGCX261,项目名称:zr4u-svn-to-git,代码行数:7,代码来源:Cookie.php


示例4: __construct

	public function __construct()
	{
		// Load configuration
		$config = Kohana::config('session');

		if ( ! empty($config['encryption']))
		{
			// Load encryption
			$this->encrypt = Encrypt::instance();
		}

		if (is_array($config['storage']))
		{
			if ( ! empty($config['storage']['group']))
			{
				// Set the group name
				$this->db = $config['storage']['group'];
			}

			if ( ! empty($config['storage']['table']))
			{
				// Set the table name
				$this->table = $config['storage']['table'];
			}
		}

		// Load database
		$this->db = Database::instance($this->db);

		Kohana::log('debug', 'Session Database Driver Initialized');
	}
开发者ID:HelixiR,项目名称:gallery3,代码行数:31,代码来源:Database.php


示例5: registerAction

 /**
  * 确认注册【设定密码】
  * @method registerAction
  * @return [type]         [description]
  * @author NewFuture
  */
 public function registerAction()
 {
     $msg = '信息注册失败!';
     if ($regInfo = Session::get('reg')) {
         Session::del('reg');
         if (Input::post('password', $password, 'trim') === false) {
             /*密码未md5*/
             $this->error('密码错误', '/');
         } elseif (!$password) {
             /*未设置密码*/
             $password = $regInfo['password'];
         }
         $regInfo['password'] = Encrypt::encryptPwd($password, $regInfo['number']);
         if ($id = UserModel::insert($regInfo)) {
             /*注册成功*/
             $regInfo['id'] = $id;
             $token = Auth::token($regInfo);
             Cookie::set('token', [$id => $token]);
             unset($regInfo['password']);
             Session::set('user', $regInfo);
             $msg = '信息注册成功!';
         }
     }
     $this->jump('/', $msg);
 }
开发者ID:derek-chow,项目名称:YunYinService,代码行数:31,代码来源:Api.php


示例6: verify

 /**
  * Verify the Facebook credentials.
  *
  * @throws	Kohana_Exception
  * @param	string	the service name
  * @return	boolean
  */
 public function verify($service = MMI_API::SERVICE_FACEBOOK)
 {
     $access_token = NULL;
     if (!array_key_exists('fragment', $_GET)) {
         $this->_convert_fragment_to_parameter();
     } else {
         $fragment = urldecode(Security::xss_clean($_GET['fragment']));
         parse_str($fragment, $parms);
         $access_token = Arr::get($parms, 'access_token');
         unset($parms);
     }
     // Ensure the access token is set
     if (empty($access_token)) {
         MMI_Log::log_error(__METHOD__, __LINE__, 'Access token parameter missing');
         throw new Kohana_Exception('Access token parameter missing in :method.', array(':method' => __METHOD__));
     }
     // Load existing data from the database
     $auth_config = $this->_auth_config;
     $username = Arr::get($auth_config, 'username');
     $model;
     if (!empty($username)) {
         $model = Model_MMI_API_Tokens::select_by_service_and_username($service, $username, FALSE);
     } else {
         $consumer_key = Arr::get($auth_config, 'api_key');
         $model = Model_MMI_API_Tokens::select_by_service_and_consumer_key($service, $consumer_key, FALSE);
     }
     $success = FALSE;
     $previously_verified = FALSE;
     if ($model->loaded()) {
         // Check if the credentials were previously verified
         $previously_verified = $model->verified;
         $success = $previously_verified;
     }
     if (!$previously_verified) {
         // Create an access token
         $token = new OAuthToken($access_token, $service . '-' . time());
         // Update the token credentials in the database
         $svc = MMI_API::factory($service);
         if (isset($token) and $svc->is_valid_token($token)) {
             $encrypt = Encrypt::instance();
             $model->service = $service;
             $model->consumer_key = 'consumer-' . $service;
             $model->consumer_secret = $encrypt->encode($service . '-' . time());
             $model->token_key = $token->key;
             $model->token_secret = $encrypt->encode($token->secret);
             unset($encrypt);
             $model->verified = 1;
             $model->verification_code = $service . '-' . time();
             $model->username = $username;
             if (array_key_exists('expires_in', $_GET)) {
                 $model->attributes = array('expires_in' => urldecode(Security::xss_clean($_GET['expires_in'])));
             }
             $success = MMI_Jelly::save($model, $errors);
             if (!$success and $this->_debug) {
                 MMI_Debug::dead($errors);
             }
         }
     }
     return $success;
 }
开发者ID:azuya,项目名称:mmi-api,代码行数:67,代码来源:facebook.php


示例7: encode

 public function encode($data)
 {
     // Set the rand type if it has not already been set
     if (Encrypt::$_rand === NULL) {
         $is_windows = DIRECTORY_SEPARATOR === '\\';
         if ($is_windows) {
             // Windows only supports the system random number generator
             Encrypt::$_rand = MCRYPT_RAND;
         } else {
             if (defined('MCRYPT_DEV_URANDOM')) {
                 // Use /dev/urandom
                 Encrypt::$_rand = MCRYPT_DEV_URANDOM;
             } elseif (defined('MCRYPT_DEV_RANDOM')) {
                 // Use /dev/random
                 Encrypt::$_rand = MCRYPT_DEV_RANDOM;
             } else {
                 // Use the system random number generator
                 Encrypt::$_rand = MCRYPT_RAND;
             }
         }
     }
     if (Encrypt::$_rand === MCRYPT_RAND) {
         // The system random number generator must always be seeded each
         // time it is used, or it will not produce true random results
         mt_srand();
     }
     // Create a random initialization vector of the proper size for the current cipher
     $iv = mcrypt_create_iv($this->_iv_size, Encrypt::$_rand);
     // Encrypt the data using the configured options and generated iv
     $data = mcrypt_encrypt($this->_cipher, $this->_key, $data, $this->_mode, $iv);
     // Use base64 encoding to convert to a string
     return base64_encode($iv . $data);
 }
开发者ID:noikiy,项目名称:kohana,代码行数:33,代码来源:Encrypt.php


示例8: verify

 /**
  * Verify the Flickr credentials.
  *
  * @throws	Kohana_Exception
  * @return	boolean
  */
 public function verify()
 {
     // Set the service
     $service = $this->_service;
     if (empty($service)) {
         MMI_Log::log_error(__METHOD__, __LINE__, 'Service not set');
         throw new Kohana_Exception('Service not set in :method.', array(':method' => __METHOD__));
     }
     // Ensure the frob is set
     $frob = NULL;
     if (array_key_exists('frob', $_GET)) {
         $frob = urldecode(Security::xss_clean($_GET['frob']));
     }
     if (empty($frob)) {
         MMI_Log::log_error(__METHOD__, __LINE__, 'Frob parameter missing');
         throw new Kohana_Exception('Frob parameter missing in :method.', array(':method' => __METHOD__));
     }
     // Load existing data from the database
     $auth_config = $this->_auth_config;
     $username = Arr::get($auth_config, 'username');
     $model;
     if (!empty($username)) {
         $model = Model_MMI_API_Tokens::select_by_service_and_username($service, $username, FALSE);
     } else {
         $model = Jelly::factory('MMI_API_Tokens');
     }
     $success = FALSE;
     if ($model->loaded()) {
         // Check if the credentials were previously verified
         $previously_verified = $model->verified;
         if ($previously_verified) {
             $success = TRUE;
         } else {
             // Create a dummy verification code
             $verification_code = $service . '-' . time();
         }
         // Do database update
         if (!$previously_verified) {
             // Get an access token
             $svc = MMI_API::factory($service);
             $token = $svc->get_access_token($verification_code, array('token_key' => $frob, 'token_secret' => $service . '-' . time()));
             // Update the token credentials in the database
             if (isset($token) and $svc->is_valid_token($token)) {
                 $model->token_key = $token->key;
                 $model->token_secret = Encrypt::instance()->encode($token->secret);
                 $model->verified = 1;
                 $model->verification_code = $verification_code;
                 if (!empty($token->attributes)) {
                     $model->attributes = $token->attributes;
                 }
                 $success = MMI_Jelly::save($model, $errors);
                 if (!$success and $this->_debug) {
                     MMI_Debug::dead($errors);
                 }
             }
         }
     }
     return $success;
 }
开发者ID:azuya,项目名称:mmi-api,代码行数:65,代码来源:flickr.php


示例9: __construct

 public function __construct()
 {
     $this->cookie_name = Eight::config('session.name') . '_data';
     if (Eight::config('session.encryption')) {
         $this->encrypt = Encrypt::instance();
     }
     Eight::log('debug', 'Session Cookie Driver Initialized');
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:8,代码来源:cookie.php


示例10: __construct

 public function __construct()
 {
     $this->cookie_name = Kohana::config('session.name') . '_data';
     if (Kohana::config('session.encryption')) {
         $this->encrypt = Encrypt::instance();
     }
     Kohana_Log::add('debug', 'Session Cookie Driver Initialized');
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:8,代码来源:Cookie.php


示例11: __get

 /**
  * Necessary override to enable per-column encryption.
  * @param  String $column 
  * @return mixed
  */
 public function __get($column)
 {
     if (in_array($column, $this->_encrypted_compressed_columns)) {
         return gzuncompress(Encrypt::instance()->decode(parent::__get($column)));
     }
     if (in_array($column, $this->_encrypted_columns)) {
         return Encrypt::instance()->decode(parent::__get($column));
     }
     return parent::__get($column);
 }
开发者ID:rrsc,项目名称:beansbooks,代码行数:15,代码来源:ormencrypted.php


示例12: cookie

 /**
  * Get or set our $_COOKIE var via . sperated array access
  *
  * @param key string A period seperated string of array keys and values
  * @param value string The value to be set
  *
  * @return string
  */
 static function cookie($key, $value = null)
 {
     $key = ID . '_' . $key;
     if (!is_null($value)) {
         //set the cookie expirey to 24 hours time
         setcookie($key, Encrypt::encrypt($value), time() + 3600 * 24);
         return;
     }
     return Encrypt::decrypt($_COOKIE[$key]);
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:18,代码来源:input.php


示例13: GET_emailAction

 /**
  * 获取用户真实手机
  * GET /user/1/email
  * @method GET_infoAction
  * @param  integer        $id [description]
  * @author NewFuture
  */
 public function GET_emailAction($id = 0)
 {
     $pid = $this->authPrinter();
     if (TaskModel::where('use_id', $id)->where('pri_id', $pid)->get('id')) {
         $email = UserModel::where('id', '=', $id)->get('email');
         $email = $email ? Encrypt::decryptEmail($email) : null;
         $this->response(1, $email);
     } else {
         $this->response(0, '此同学未在此打印过');
     }
 }
开发者ID:derek-chow,项目名称:YunYinService,代码行数:18,代码来源:User.php


示例14: get

 public function get($name, $dec = true, $encKey = '')
 {
     $enValue = isset($_COOKIE[$name]) ? $_COOKIE[$name] : false;
     if (!$enValue) {
         return false;
     }
     if ($dec) {
         $encKey = $encKey ?: $this->encCode;
         $deValue = Encrypt::auth($enValue, $encKey, 'DECODE');
     } else {
         $deValue = $value;
     }
     return $deValue ?: false;
 }
开发者ID:nicklos17,项目名称:ucenter,代码行数:14,代码来源:Cookie.php


示例15: action_company

 public function action_company()
 {
     $visitor_data = Arr::get($_POST, 'data') ? unserialize(Encrypt::instance('statistics')->decode($_POST['data'])) : NULL;
     $company = ORM::factory('service', $this->request->param('id'));
     if (!$company->loaded() or !$visitor_data) {
         return FALSE;
     }
     $request = Request::factory(Route::get('company_info')->uri(array('id' => $company->id, 'company_type' => Model_Service::$type_urls[$company->type])));
     // Если URI не совпадает или истекло время
     if ($request->uri() != $visitor_data['uri'] or strtotime(Date::formatted_time()) - $visitor_data['time_created'] > 60) {
         return FALSE;
     }
     $visit_data = array('date' => Date::formatted_time(), 'uri' => $request->uri(), 'directory' => $request->directory(), 'controller' => $request->controller(), 'action' => $request->action(), 'params' => json_encode($request->get_params()), 'client_ip' => $visitor_data['client_ip'], 'referrer' => $visitor_data['referrer']);
     ORM::factory('visit')->save_visit($visit_data);
 }
开发者ID:Alexander711,项目名称:naav1,代码行数:15,代码来源:statistics.php


示例16: isTokenIllegal

 /**
  * [isTokenIllegal description]
  * @param  Request $Request [description]
  * @return boolean          [description]
  */
 public function isTokenIllegal(Request $Request)
 {
     $data = array();
     $token = "";
     $Request->exportForAccessibilityCheck($data);
     $token = $Request->getToken();
     ksort($data);
     $str = "";
     foreach ($data as $key => $value) {
         $str .= $value;
     }
     $str .= $this->_public_key;
     if (!Encrypt::match($str, $token)) {
         return true;
     }
     return false;
 }
开发者ID:karminski,项目名称:salt-fish-raw-php,代码行数:22,代码来源:AccessibilityCheck.php


示例17: _getUser

 public function _getUser()
 {
     // 解密cas server传来的原始数据
     $encKey = $this->cfg['encKey'];
     if ($encVal = Encrypt::auth(phpCAS::getUser(), $encKey, 'DECODE')) {
         $encVal = json_decode($encVal, true);
         if ($this->isAdmin) {
             // 获取redis权限
             $redis = new \Redis();
             $redis->connect($this->cfg['redis']['host'], $this->cfg['redis']['port']);
             $redis->select($this->cfg['redis']['dbname']);
             $res = unserialize($redis->get('group' . $encVal['ugroup'] . '_' . $this->cfg['siteid']));
             $encVal['permMenu'] = unserialize($redis->get('group' . $encVal['ugroup'] . '_' . $this->cfg['siteid']));
         }
     }
     return $encVal ?: false;
 }
开发者ID:nicklos17,项目名称:littlemall,代码行数:17,代码来源:CasClient.php


示例18: ChangeSSPwd

 public function ChangeSSPwd()
 {
     $result = array('error' => 1, 'message' => '修改失败');
     $uid = trim($_GET['uid']);
     $user_cookie = explode('\\t', Encrypt::decode(base64_decode($_COOKIE['auth']), COOKIE_KEY));
     $sspwd = trim($_GET['sspwd']);
     if ('' == $sspwd || null == $sspwd) {
         $sspwd = Util::GetRandomPwd();
     }
     if ($uid == $user_cookie[0]) {
         $user = UserModel::GetUserByUserId($uid);
         $user->sspwd = $sspwd;
         $user->updateUser();
         $result = array('error' => 1, 'message' => '修改SS连接密码成功');
     }
     echo json_encode($result);
     exit;
 }
开发者ID:gclove,项目名称:shadowsocks-panel,代码行数:18,代码来源:Form.php


示例19: identifyUser

 public function identifyUser()
 {
     $whereQuery = array();
     $i = 0;
     foreach ($this->auth->userCredentials as $key => $value) {
         if ($i === 0) {
             $whereQuery[$key . ' ='] = $value;
             $this->username = $value;
         }
         if ($i == 2 || $key == 'status') {
             $whereQuery["{$key} ="] = $value;
         }
         $i++;
     }
     try {
         $userCredentials = $this->auth->where($whereQuery)->findAll();
     } catch (\Exception $ex) {
         throw new \Exception($ex->getMessage());
     }
     if (($this->auth->rowCount() && count($userCredentials)) > 0) {
         if (Encrypt::instance()->decode($userCredentials[0]->password) == $this->auth->userCredentials['password']) {
             $credentials['isLoggedIn'] = true;
             $credentials['flashMsg'] = ucfirst($this->username) . ' ' . $this->msg;
             $this->sessionDetails = $this->auth->getSessionConfig();
             foreach ($this->sessionDetails['value'] as $key => $val) {
                 $credentials[$val] = $userCredentials[0]->{$val};
                 unset($userCredentials[0]->{$val});
             }
             $isSessionExists = Session::instance()->save($this->sessionDetails['key'], $credentials);
             //show($isSessionExists);
             $this->setUserDetails($credentials);
             return $isSessionExists == true ? true : false;
         } else {
             return false;
         }
         // password validation end
     } else {
         return false;
     }
     // row count end
 }
开发者ID:serele,项目名称:wallscript,代码行数:41,代码来源:Authentication.php


示例20: add

		function add($loginId, $password, $name, $email) {
			global $database, $db, $event;
			if (empty($loginId) || empty($password) || empty($name) || empty($email)) {
				return false;
			}

			$loginId = $db->escape($loginId);
			$mpassword = $db->escape(Encrypt::hmac($loginId, md5(md5($password))));
			$name = $db->escape($name);
			$email = $db->escape($email);
			$is_accepted = (Settings::get('restrictJoin') == 'y') ? 'n' : 'y';

			$input = array('loginid'=>$loginId, 'password'=>$password, 'name'=>$name, 'email'=>$email, 'is_accepted'=>Validator::getBool($is_accepted));
			if ($event->on('User.add', $input) === false)
				return false;
			if (!$db->execute('INSERT INTO '.$database['prefix'].'Users (loginid, name, password, email, created, is_accepted) VALUES ("'.$loginId.'","'.$name.'","'.$mpassword.'","'.$email.'",UNIX_TIMESTAMP(),"'.$is_accepted.'")')) {
				$event->on('User.add.rollback');
				return false;
			}
			return true;
		}
开发者ID:ncloud,项目名称:bloglounge,代码行数:21,代码来源:Bloglounge.Model.Users.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Encryption类代码示例发布时间:2022-05-23
下一篇:
PHP Encriptador类代码示例发布时间: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