本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
示例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;
}
示例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" => "你的连接地址无效,无法进行账户激活,请核实你的连接地址无误。"));
}
}
示例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;
}
示例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>
示例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();
}
示例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);
}
示例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>';
示例15: restore
public static function restore($v)
{
$data = null;
empty($_COOKIE[$v]) === false ? $data = Crypt::decode($_COOKIE[$v]) : ($data = null);
return $data;
}