當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。