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


PHP Crypt::decode方法代码示例

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


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

示例1: restore

 public static function restore($var)
 {
     $data = $_SESSION[$var];
     if (is_object($data) === true) {
         $data = $_SESSION[$var];
     } else {
         isset($_SESSION[$var]) === true ? $data = Crypt::decode($_SESSION[$var]) : ($data = null);
     }
     return $data;
 }
开发者ID:cupcakephp,项目名称:cupcakephp,代码行数:10,代码来源:Sessions.php

示例2: clearVal

function clearVal($string = '')
{
    $result = '';
    $splOpen = explode('{{', $string);
    for ($iOp = 1; $iOp < count($splOpen); $iOp++) {
        $splEnd = explode('}}', $splOpen[$iOp]);
        $result .= Crypt::decode($splEnd[0]) . $splEnd[1];
    }
    return $result;
}
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:10,代码来源:db.php

示例3: _get_user

 /**
  * Check if the user is logged in and fetches their information
  * if not then assign the guest info and pass it to the views.
  */
 private function _get_user()
 {
     if (Cookie::get('_sess') and $user = Model_User::find('first', array('where' => array('login_hash' => Crypt::decode(Cookie::get('_sess')))))) {
         $this->current_user = $user;
         $this->current_user->_set_logged_in(true);
     } else {
         $this->current_user = Model_User::forge(array('username' => 'Guest', 'group_id' => 5));
         $this->current_user->_set_logged_in(false);
     }
     $this->template->set_global('current_user', $this->current_user);
 }
开发者ID:nirix-old,项目名称:litepress,代码行数:15,代码来源:litepress.php

示例4: test_encode_decode_large_data

 public function test_encode_decode_large_data()
 {
     $bigstr = str_repeat("this is a crypto test of 200k or so of data", 5000);
     $bigstrhash = '391828747971d26de68550d935abaffa25f043795359417199ca39c09095dd11';
     $this->assertEquals($bigstrhash, hash('sha256', $bigstr));
     // Encrypt it without a key
     $test = \Crypt::encode($bigstr);
     $testhash = '26c14e2093adb93798bb1eabcae1c5bb0d1e3dca800bf7c546d1e79317979996';
     $this->assertEquals($testhash, hash('sha256', $test));
     // Decode it
     $output = \Crypt::decode($test);
     $this->assertEquals($bigstr, $output);
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:13,代码来源:crypt.php

示例5: __construct

 /**
  * Class constructor.
  * 
  * @param Model_Gateway  $model    The gateway model to use for the driver.
  * @param Model_Customer $customer The customer model to use for the driver.
  *
  * @return void
  */
 public function __construct(Model_Gateway $model, Model_Customer $customer = null)
 {
     parent::__construct($model, $customer);
     if (!$model->meta('api_login_id')) {
         throw new GatewayException('Missing Gateway Meta: api_login_id');
     } elseif (!$model->meta('transaction_key')) {
         throw new GatewayException('Missing Gateway Meta: transaction_key');
     }
     $enc_key = Config::get('security.db_enc_key');
     $api_login_id = Crypt::decode($model->meta('api_login_id')->value, $enc_key);
     $transaction_key = Crypt::decode($model->meta('transaction_key')->value, $enc_key);
     $sandbox = $model->meta('sandbox') ? Crypt::decode($model->meta('sandbox')->value, $enc_key) : false;
     define('AUTHORIZENET_API_LOGIN_ID', $api_login_id);
     define('AUTHORIZENET_TRANSACTION_KEY', $transaction_key);
     define('AUTHORIZENET_SANDBOX', $sandbox);
 }
开发者ID:mehulsbhatt,项目名称:volcano,代码行数:24,代码来源:driver.php

示例6: get

 function get($key)
 {
     if ($this->mem) {
         if (MEMCACHE_CRYPT) {
             $cache_key = md5(DB_PASSWORD . DB_NAME . $key);
         } else {
             $cache_key = $key;
         }
         if (!($arr = $this->mem->get($cache_key))) {
             return false;
         }
         if (MEMCACHE_CRYPT) {
             $arr = unserialize(Crypt::decode($arr, DB_SERVER . DB_USER . DB_PASSWORD));
         }
         return $arr;
     }
     return false;
 }
开发者ID:kostarev,项目名称:test,代码行数:18,代码来源:Cache.php

示例7: get

 /**
  * 取得cookie值
  * 
  * @access public
  * @param mixed $name
  * @return mixed
  */
 public static function get($name)
 {
     if (self::checkSafe() == 1) {
         if (isset($_COOKIE[self::$per . $name])) {
             $cryptCookie = $_COOKIE[self::$per . $name];
             $cookie = Crypt::decode($cryptCookie, self::getSafeCode());
             $tem = substr($cookie, 0, 10);
             if (preg_match('/^[Oa]:\\d+:.*/', $tem)) {
                 $cookie = unserialize($cookie);
             }
             return $cookie;
         }
         return null;
     }
     if (self::checkSafe() == 0) {
         self::clear($name);
     } else {
         return null;
     }
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:27,代码来源:cookie_class.php

示例8: get_headers

 /**
  * Add the array of Bit API Hub headers for the call
  * 
  * @param array $headers The array of existing headers
  * @return array $headers with the Bit API Hub headers added on
  */
 public static function get_headers(array $headers)
 {
     $api = \V1\Model\APIs::get_api();
     $account = \V1\Model\Account::get_account();
     $forwarded_for = \Input::real_ip('0.0.0.0', true);
     if ($internal_call = \Utility::is_internal_call()) {
         $forwarded_for = \Config::get('engine.call_test_ip');
     }
     $headers = array_replace($headers, array('User-Agent' => 'API Optimization Engine/V1', 'X-Forwarded-For' => $forwarded_for));
     if (\Config::get('engine.send_engine_auth', false) === true) {
         // If the API hasn't yet received a secret identity, generate one.
         if (empty($api['secret'])) {
             $secret = \V1\Model\APIs::set_api_secret($api['id']);
         } else {
             $secret = \Crypt::decode($api['secret']);
         }
         $headers = array_replace($headers, array('X-AOE-Secret' => $secret, 'X-AOE-Account' => $account['id'], 'X-AOE-Version' => 'V1'));
     }
     return $headers;
 }
开发者ID:bitapihub,项目名称:api-optimization-engine,代码行数:26,代码来源:runcall.php

示例9: activation_user

 public function activation_user()
 {
     $code = Filter::text(Req::args('code'));
     $email_code = substr($code, 32);
     $valid_code = substr($code, 0, 32);
     $email = Crypt::decode($email_code);
     $model = new Model('user');
     $user = $model->where("email='" . $email . "'")->find();
     if ($user && $user['status'] == 0 && md5($user['validcode']) == $valid_code) {
         $model->data(array('status' => 1))->where('id=' . $user['id'])->update();
         $this->redirect("/index/msg", false, array('type' => "success", "msg" => '账户激活成功', "content" => "账户通过邮件成功激活。", "redirect" => "/simple/login"));
     } else {
         $this->redirect("/index/msg", false, array('type' => "fail", "msg" => '账户激活失败', "content" => "你的连接地址无效,无法进行账户激活,请核实你的连接地址无误。"));
     }
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:15,代码来源:simple.php

示例10: _get_cookie

 /**
  * read a cookie
  *
  * @access	private
  * @return  void
  */
 protected function _get_cookie()
 {
     // was the cookie posted?
     $cookie = \Input::get_post($this->config['post_cookie_name'], false);
     // if not found, fetch the regular cookie
     if ($cookie === false) {
         $cookie = \Cookie::get($this->config['cookie_name'], false);
     }
     if ($cookie !== false) {
         // fetch the payload
         $cookie = $this->_unserialize(\Crypt::decode($cookie));
         // validate the cookie
         if (!isset($cookie[0])) {
             // not a valid cookie payload
         } elseif ($cookie[0]['updated'] + $this->config['expiration_time'] <= $this->time->get_timestamp()) {
             // session has expired
         } elseif ($this->config['match_ip'] && $cookie[0]['ip_hash'] !== md5(\Input::ip() . \Input::real_ip())) {
             // IP address doesn't match
         } elseif ($this->config['match_ua'] && $cookie[0]['user_agent'] !== \Input::user_agent()) {
             // user agent doesn't match
         } else {
             // session is valid, retrieve the session keys
             if (isset($cookie[0])) {
                 $this->keys = $cookie[0];
             }
             // and return the cookie payload
             array_shift($cookie);
             return $cookie;
         }
     }
     // no payload
     return false;
 }
开发者ID:469306621,项目名称:Languages,代码行数:39,代码来源:driver.php

示例11: foreach

    echo $errors['processor'];
}
?>
		</div>
	</div>
	
	<?php 
foreach ($gateway->meta() as $meta) {
    ?>
		<div class="control-group">
			<?php 
    echo Form::label(Inflector::titleize($meta->name), $meta->name, array('class' => 'control-label'));
    ?>
			<div class="controls">
				<?php 
    echo Form::input("meta[{$meta->name}]", Input::post("meta.{$meta->name}", Crypt::decode($meta->value, $enc_key)));
    ?>
			</div>
		</div>
	<?php 
}
?>
	
	<div class="form-actions">
		<?php 
echo Html::anchor('settings/gateways', __('form.cancel.label'), array('class' => 'btn'));
?>
		<?php 
echo Form::button('submit', __('form.submit.label'), array('class' => 'btn btn-primary'));
?>
	</div>
开发者ID:mehulsbhatt,项目名称:volcano,代码行数:31,代码来源:edit.php

示例12: decode_credentials

 /**
  * Decode the credentials from the DB data array
  * 
  * @param array $array The array of data from the DB for the account or API to find the credentials for
  * @return array The array of decoded credentials, or an empty array if none exist
  */
 protected static function decode_credentials(array $array)
 {
     if (isset($array['credentials']) && is_array($credentials = json_decode(\Crypt::decode($array['credentials']), true))) {
         if (\V1\APIRequest::is_static()) {
             // Bit API Hub credentials for the API
             return $credentials;
         } else {
             // Get the credentials for the specific API
             if (!empty($credentials[\V1\APIRequest::get('api')])) {
                 return $credentials[\V1\APIRequest::get('api')];
             }
         }
     }
     // No credentials
     return array();
 }
开发者ID:bitapihub,项目名称:api-optimization-engine,代码行数:22,代码来源:keyring.php

示例13: switch

<?php

/**
*Encriptar cadenas 
*/
if (isset($_REQUEST['mode'])) {
    switch ($_REQUEST['mode']) {
        case 'encode':
            return Crypt::encode($_REQUEST['string']);
            break;
        case 'decode':
            return Crypt::decode($_REQUEST['string']);
            break;
        default:
            return false;
            break;
    }
}
class Crypt
{
    function __construct()
    {
    }
    function encode($string)
    {
        $string = base64_encode($string);
        $toAscii = false;
        $strOfuscated = 'asd!·asd$asd%asd&asd/asd(as)ds=asd?asd¿sa/sd*-gf+ertert,.ert-';
        for ($iw = 0; $iw < strlen($string); $iw++) {
            $toAscii .= substr($strOfuscated, rand(0, strlen($strOfuscated) - 1), 1) . hexdec(ord(substr($string, $iw, 1))) . substr($strOfuscated, rand(0, strlen($strOfuscated) - 1), 1);
        }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:31,代码来源:crypt.php

示例14: chr

            $box[$i] = $box[$j];
            $box[$j] = $tmp;
        }
        for ($a = $j = $i = 0; $i < $string_length; $i++) {
            $a = ($a + 1) % 256;
            $j = ($j + $box[$a]) % 256;
            $tmp = $box[$a];
            $box[$a] = $box[$j];
            $box[$j] = $tmp;
            $result .= chr(ord($string[$i]) ^ $box[($box[$a] + $box[$j]) % 256]);
        }
        if ($operation == 'DECODE') {
            if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) {
                return substr($result, 26);
            } else {
                return '';
            }
        } else {
            return $keyc . base64_encode($result);
        }
    }
}
header("Content-Type:text/html;charset=UTF-8");
$s = '2@RdcWWP';
echo '<p style="font:12px Verdana">';
echo '加密前: ' . $s;
echo '<br /><br />';
echo '加密后: ' . ($s1 = Crypt::encode($s, 'aaa'));
echo '<br /><br />';
echo '解密后: ' . ($s2 = Crypt::decode($s1, 'aaa'));
echo '</p>';
开发者ID:timy-life,项目名称:segments,代码行数:31,代码来源:Crypt.php

示例15: restore

 public static function restore($v)
 {
     $data = null;
     empty($_COOKIE[$v]) === false ? $data = Crypt::decode($_COOKIE[$v]) : ($data = null);
     return $data;
 }
开发者ID:cupcakephp,项目名称:cupcakephp,代码行数:6,代码来源:Cookies.php


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