本文整理汇总了PHP中base64_decode函数的典型用法代码示例。如果您正苦于以下问题:PHP base64_decode函数的具体用法?PHP base64_decode怎么用?PHP base64_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了base64_decode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decode
public function decode($encrypted)
{
$decrypted = '';
// $encrypted = $_POST['merchantReciept'];
$privateKey = <<<EOD
-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJuIUgSzNuWm3US8
0brZr/5cMSPue9f0IwUrEhka1gLlC4uQon6QjQem4TWQ8anoMKYwfYgRnCGQsbrT
KwOApwTA4Bt6dg9jKXlIE6rXqqO6g2C/uD+G2p+W4k0ZI1isuqqjjkup5ZPkNaeW
R9/961Qx3CyrWDk6n0OkzDJ6UNzLAgMBAAECgYEAh+/dv73jfVUaj7l4lZct+2MY
kA8grt7yvNGoP8j0xBLsxE7ltzkgClARBoBot9f4rUg0b3j0vWF59ZAbSDRpxJ2U
BfWEtlXWvN1V051KnKaOqE8TOkGK0PVWcc6P0JhPrbmOu9hhAN3dMu+jd7ABFKgC
4b8EIlHA8bl8po8gwAECQQDliMBTAzzyhB55FMW/pVGq9TBo2oXQsyNOjEO+rZNJ
zIwJzFrFhvuvFj7/7FekDAKmWgqpuOIk0NSYfHCR54FLAkEArXc7pdPgn386ikOc
Nn3Eils1WuP5+evoZw01he4NSZ1uXNkoNTAk8OmPJPz3PrtB6l3DUh1U/DEZjIiI
7z5igQJAFXvFNH/bFn/TMlYFZDie+jdUvpulZrE9nr52IMSyQngIq2obHN3TdMHK
R73hPhN5tAQ9d0E8uWFqZJNRHfbjHQJASY7pNV3Ov/QE0ALxqE3W3VDmJD/OjkOS
jriUPNIAwnnHBgp0OXHMCHkSYX4AHpLr1cWjARw9IKB1lBmF7+YFgQJAFqUgYj11
ioyuSf/CSotPIC7YyNEnr+TK2Ym0N/EWzqNXoOCDxDTgoWLQxM3Nfr65tWtV2097
BjCbFfbui/IyUw==
-----END PRIVATE KEY-----
EOD;
$encrypted = base64_decode($encrypted);
// decode the encrypted query string
if (!openssl_private_decrypt($encrypted, $decrypted, $privateKey)) {
die('Failed to decrypt data');
}
// echo "Decrypted value: ". $decrypted;
return $decrypted;
// $arr = explode('|', $decrypted);
// return $arr;
}
示例2: getScriptingLogAction
public function getScriptingLogAction()
{
$this->request->restrictAccess(Acl::RESOURCE_LOGS_SCRIPTING_LOGS);
$this->request->defineParams(['executionId' => ['type' => 'string']]);
$info = $this->db->GetRow("SELECT * FROM scripting_log WHERE execution_id = ? LIMIT 1", [$this->getParam('executionId')]);
if (!$info) {
throw new Exception('Script execution log not found');
}
try {
$dbServer = DBServer::LoadByID($info['server_id']);
if (!in_array($dbServer->status, [SERVER_STATUS::INIT, SERVER_STATUS::RUNNING])) {
throw new Exception();
}
} catch (Exception $e) {
throw new Exception('This server has been terminated and its logs are no longer available');
}
//Note! We should not check not-owned-farms permission here. It's approved by Igor.
if ($dbServer->envId != $this->environment->id) {
throw new \Scalr_Exception_InsufficientPermissions();
}
$logs = $dbServer->scalarizr->system->getScriptLogs($this->getParam('executionId'));
$msg = sprintf("STDERR:\n%s \n\n STDOUT:\n%s", base64_decode($logs->stderr), base64_decode($logs->stdout));
$msg = nl2br(htmlspecialchars($msg));
$this->response->data(['message' => $msg]);
}
示例3: __construct
public function __construct()
{
parent::__construct();
$this->_objectId = 'id';
$this->_blockGroup = 'massimporterpro';
$this->_controller = 'adminhtml_priceupdater';
$this->removeButton('back');
$helper = Mage::helper('massimporterpro');
$isValid = $helper->isValid();
$isActive = $helper->isActive();
$message = '';
if (!$isActive) {
$message = base64_decode('RXh0ZW5zaW9uIGhhcyBiZWVuIGRpc2FibGVkLiBQbGVhc2UgZW5hYmxlIGl0IGZyb20gTWFzcyBJbXBvcnRlciBQcm8gJnJhcXVvOyBNYW5hZ2UgU2V0dGluZ3M=');
} else {
if ($isActive && !$isValid) {
$message = base64_decode('UGxlYXNlIGVudGVyIGEgdmFsaWQgbGljZW5zZSBrZXkgaW4gb3JkZXIgdG8gcnVuIHRoZSBleHRlbnNpb24=');
}
}
if (!$isActive || $isActive && !$isValid) {
$this->removeButton('save');
$this->_addButton('dsave', array('label' => Mage::helper('massimporterpro')->__('Run Import'), 'onclick' => 'alert(\'' . $message . '.\')', 'class' => 'disabled'), -100);
} else {
$this->_updateButton('save', 'label', Mage::helper('massimporterpro')->__('Run Import'));
}
$this->_formScripts[] = "\n function addUploadFile(){\n\t\t\t\tvar importFile = \$('import_file_upload').value;\n\t\t\t\tif(importFile == ''){\n\t\t\t\t\talert('Please select some import file.');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar ext = importFile.substring(importFile.lastIndexOf('.') + 1);\n\t\t\t\tif(ext.toLowerCase() != 'csv'){\n\t\t\t\t\talert('Please select valid import file (CSV).');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t//tweak for required feilds: import file section, delimiter, enclosed\n\t\t\t\t\$('import_file').removeClassName('required-entry');\n\t\t\t\t\$('delimiter').removeClassName('required-entry');\n\t\t\t\t\$('enclosure').removeClassName('required-entry');\n editForm.submit('" . Mage::helper('adminhtml')->getUrl('massimporterpro/adminhtml_priceupdater/uploadCsv') . "');\n }\n ";
}
示例4: inflate
private function inflate()
{
$this->name = $this->raw['activityTaskScheduledEventAttributes']['activityType']['name'];
$this->version = $this->raw['activityTaskScheduledEventAttributes']['activityType']['version'];
$this->control = $this->raw['activityTaskScheduledEventAttributes']['control'];
$this->inputs = json_decode(base64_decode($this->raw['activityTaskScheduledEventAttributes']['input']), true);
}
示例5: list_ressource
function list_ressource($automount)
{
$sock = new sockets();
$datas = $sock->getFrameWork("cmd.php?B64-dirdir=" . base64_encode("/automounts/{$automount}"));
$files = unserialize(base64_decode(trim($datas)));
if (!is_array($files)) {
$_GET["cyrus-brows-comp"] = "/automounts/{$automount}";
list_ressources2();
return;
}
$html = "<table style='width:80%'>";
if (is_array($files)) {
while (list($num, $ligne) = each($files)) {
if (!preg_match("#backup\\.[0-9\\-]+#", $ligne)) {
continue;
}
$md5 = md5($num);
$ligne = str_replace("backup.", "", $ligne);
$js = "SelectMountRestoreLevel2('{$md5}','{$num}')";
$html = $html . "\n\t\t\t<tr " . CellRollOver($js, "{select_this_container}") . ">\n\t\t\t\t<td with=1%><img src='img/folder-32-sh\tare.png'>\n\t\t\t\t<td width=99%><span style='font-size:14px'>{$ligne}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan=2><div id='{$md5}'><hr></div></td>\n\t\t\t</tR>\n\t\t\t\t\t\n\t\t\t";
}
}
$html = $html . "</table>";
return $html;
}
示例6: finish
/**
* Returns the ezcMailText part corresponding to the parsed message.
*
* @return ezcMailText
*/
public function finish()
{
$charset = "us-ascii";
// RFC 2822 default
if (isset($this->headers['Content-Type'])) {
preg_match('/\\s*charset\\s?=\\s?"?([^;"\\s]*);?/', $this->headers['Content-Type'], $parameters);
if (count($parameters) > 0) {
$charset = strtolower(trim($parameters[1], '"'));
}
}
$encoding = strtolower($this->headers['Content-Transfer-Encoding']);
if ($encoding == ezcMail::QUOTED_PRINTABLE) {
$this->text = quoted_printable_decode($this->text);
} else {
if ($encoding == ezcMail::BASE64) {
$this->text = base64_decode($this->text);
}
}
$this->text = ezcMailCharsetConverter::convertToUTF8($this->text, $charset);
$part = new ezcMailText($this->text, 'utf-8', ezcMail::EIGHT_BIT, $charset);
$part->subType = $this->subType;
$part->setHeaders($this->headers->getCaseSensitiveArray());
ezcMailPartParser::parsePartHeaders($this->headers, $part);
$part->size = strlen($this->text);
return $part;
}
示例7: cry
/**
* 位加密或解密
* @param $string 加密或解密内容
* @param $type 类型:1加密 2解密
* @param $key
* @return mixed|string
*/
private static function cry($string, $type, $key)
{
self::createKey($key);
$string = $type == 2 ? base64_decode($string) : substr(md5(self::$auth_key . $string), 0, 8) . $string;
$str_len = strlen($string);
$data = array();
$auth_key_length = strlen(self::$auth_key);
for ($i = 0; $i <= 256; $i++) {
$data[$i] = ord(self::$auth_key[$i % $auth_key_length]);
}
$tmp = '';
for ($i = $j = 1; $i < 256; $i++) {
$j = $data[($i + $data[$i]) % 256];
$tmp = $data[$i];
$data[$i] = ord($data[$j]);
$data[$j] = $tmp;
}
$code = '';
$s = '';
for ($n = $i = $j = 0; $i < $str_len; $i++) {
$tmp = ($i + $i % 256) % 256;
$j = $data[$tmp] % 256;
$n = ($tmp + $j) % 256;
$code = $data[($data[$j] + $data[$n]) % 256];
$s .= chr(ord($string[$i]) ^ $code);
}
if ($type == 1) {
return str_replace("=", "", base64_encode($s));
} else {
if (substr(md5(self::$auth_key . substr($s, 8)), 0, 8) == substr($s, 0, 8)) {
return substr($s, 8);
}
return '';
}
}
示例8: parse
public static function parse($signature, $payload)
{
self::_validateSignature($signature, $payload);
$xml = base64_decode($payload);
$attributes = Braintree_Xml::buildArrayFromXml($xml);
return self::factory($attributes['notification']);
}
示例9: testVector
public function testVector()
{
$input = 'hello world';
$pass = 'password';
$vector = base64_decode('vusXragCy83KQFo');
$this->assertEquals($input, Otp::crypt($vector, $pass));
}
示例10: getAccessToken
private function getAccessToken($code)
{
$curlWrapper = new CurlWrapper();
$post_data = array("grant_type" => "authorization_code", "code" => $code, "redirect_uri" => $this->url_callback, "client_id" => $this->client_id, "client_secret" => $this->secret_id);
$curlWrapper->setPostDataUrlEncode($post_data);
$token_url = $this->getURLforService("token");
$result = $curlWrapper->get($token_url);
if ($curlWrapper->getHTTPCode() != 200) {
if (!$result) {
throw new Exception($curlWrapper->getLastError());
}
$result_array = json_decode($result, true);
throw new Exception($result_array['error']);
}
$result_array = json_decode($result, true);
$id_token = $result_array['id_token'];
$all_part = explode(".", $id_token);
$header = json_decode(base64_decode($all_part[0]), true);
$payload = json_decode(base64_decode($all_part[1]), true);
if ($payload['nonce'] != $_SESSION[self::OPENID_SESSION_NONCE]) {
throw new Exception("La nonce ne correspond pas");
}
require_once __DIR__ . "/../ext/Akita_JOSE/JWS.php";
$jws = Akita_JOSE_JWS::load($id_token, true);
$verify = $jws->verify($this->secret_id);
if (!$verify) {
throw new Exception("Vérification du token : Echec");
}
unset($_SESSION[self::OPENID_SESSION_NONCE]);
return $result_array['access_token'];
}
示例11: readCallback
public static function readCallback($payload)
{
$crypt = new Encrypter(base64_decode(Config::get('services.etupay.key')), 'AES-256-CBC');
$payload = json_decode($crypt->decrypt($payload));
if ($payload && is_numeric($payload->service_data)) {
$paymentId = $payload->service_data;
$payment = Payment::findOrFail($paymentId);
switch ($payload->step) {
case 'INITIALISED':
$payment->state = 'returned';
break;
case 'PAID':
case 'AUTHORISATION':
$payment->state = 'paid';
break;
case 'REFUSED':
case 'CANCELED':
$payment->state = 'refused';
break;
case 'REFUNDED':
$payment->state = 'refunded';
break;
}
$payment->informations = ['transaction_id' => $payload->transaction_id];
$payment->save();
if ($payment->newcomer) {
$payment->newcomer->updateWei();
} elseif ($payment->student) {
$payment->student->updateWei();
}
return $payment;
}
return null;
}
示例12: processAutoLoginCookie
/**
* {@inheritdoc}
*/
protected function processAutoLoginCookie(array $cookieParts, Request $request)
{
if (count($cookieParts) !== 4) {
throw new AuthenticationException('The cookie is invalid.');
}
list($class, $username, $expires, $hash) = $cookieParts;
if (false === ($username = base64_decode($username, true))) {
throw new AuthenticationException('$username contains a character from outside the base64 alphabet.');
}
try {
$user = $this->getUserProvider($class)->loadUserByUsername($username);
} catch (\Exception $ex) {
if (!$ex instanceof AuthenticationException) {
$ex = new AuthenticationException($ex->getMessage(), $ex->getCode(), $ex);
}
throw $ex;
}
if (!$user instanceof UserInterface) {
throw new \RuntimeException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', get_class($user)));
}
if (true !== $this->compareHashes($hash, $this->generateCookieHash($class, $username, $expires, $user->getPassword()))) {
throw new AuthenticationException('The cookie\'s hash is invalid.');
}
if ($expires < time()) {
throw new AuthenticationException('The cookie has expired.');
}
return $user;
}
示例13: extractSalt
/**
* Extracts salt from provided hash.
*
* @param string $hash salted hash previously returned from a call to ssha::get()
* @return string salt of provided hash
*/
public static function extractSalt($hash)
{
if (substr($hash, 0, 6) === '{SSHA}') {
return substr(base64_decode(substr($hash, 6)), 20);
}
return substr($hash, 20);
}
示例14: save
function save()
{
$sock = new sockets();
if ($_POST["ID"] == 0) {
$ligne = unserialize(base64_decode($sock->GET_INFO("DansGuardianDefaultMainRule")));
$ligne["bypass"] = $_POST["bypass"];
$ligne["BypassSecretKey"] = $_POST["BypassSecretKey"];
writelogs("Default rule, saving DansGuardianDefaultMainRule", __FUNCTION__, __FILE__, __LINE__);
$sock->SaveConfigFile(base64_encode(serialize($ligne)), "DansGuardianDefaultMainRule");
writelogs("Ask to compile rule...", __FUNCTION__, __FILE__, __LINE__);
$sock->getFrameWork("webfilter.php?compile-rules=yes");
return;
}
$q = new mysql_squid_builder();
$sql = "UPDATE webfilter_rules SET bypass='{$_POST["bypass"]}',BypassSecretKey='{$_POST["bypass"]}' WHERE ID='{$_POST["ID"]}'";
$q->QUERY_SQL($sql);
if (!$q->ok) {
if (strpos($q->mysql_error, "Unknown column") > 0) {
$q->CheckTables();
$q->QUERY_SQL($sql);
}
}
if (!$q->ok) {
echo $q->mysql_error;
return;
}
$sock->getFrameWork("webfilter.php?compile-rules=yes");
}
示例15: createToken
public function createToken($username, $encryptedPass)
{
$nonce = $this->createNonce();
$ts = date('c');
$digest = base64_encode(sha1(base64_decode($nonce) . $ts . $this->apiSecret, true));
return sprintf('AuthToken ApiKey="%s", TokenDigest="%s", Nonce="%s", Created="%s", Username="%s", Password="%s"', $this->apiKey, $digest, $nonce, $ts, $username, base64_encode($encryptedPass));
}