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


PHP base64_url_decode函数代码示例

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


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

示例1: sr

function sr($secret = false, $sr = false)
{
    if (!$sr && isset($_REQUEST['signed_request'])) {
        $sr = $_REQUEST['signed_request'];
    }
    if (!$sr) {
        return false;
    }
    if (!$secret) {
        $secret = session('secret');
    }
    list($encoded_sig, $payload) = explode('.', $sr, 2);
    $data = json_decode(base64_url_decode($payload), true);
    // $sig = base64_url_decode($encoded_sig);
    // if(strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
    // 		error_log('Unknown algorithm. Expected HMAC-SHA256');
    // 		return null;
    // }
    // $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
    // if($sig !== $expected_sig) {
    // 		error_log('Bad Signed JSON signature!');
    // 		return null;
    // }
    session('sr', $data);
    if (isset($data['oauth_token'])) {
        session('access_token', $data['oauth_token']);
        session('expires', $data['expires']);
    }
    return $data;
}
开发者ID:1upon0,项目名称:ui,代码行数:30,代码来源:lib_fb.php

示例2: seeMessageInResponse

 public function seeMessageInResponse($message)
 {
     $response = $this->getModule('REST')->response;
     $response = json_decode($response);
     $data = base64_url_decode($response->data);
     $data = $this->aes->decrypt($data);
     file_put_contents('./dump.txt', $data);
     $data = json_decode($data);
     $this->assertEquals($message, $data->message);
 }
开发者ID:amegatron,项目名称:cryptoapi,代码行数:10,代码来源:CryptoApiHelper.php

示例3: decode_combine

function decode_combine($str)
{
    $str = base64_decode($str);
    $db = new db_query('SELECT "5529e6b0760d73d38d3d3a5bb33e3eaf" as kdm_hash1, kdims.* FROM kdims LIMIT 1');
    $hash = mysqli_fetch_assoc($db->result);
    unset($db);
    $decode_step1 = str_rot13($str);
    $decode_hash = str_rot13($hash['kdm_hash1']);
    $decode_step2 = str_replace($decode_hash, '', $decode_step1);
    return base64_url_decode($decode_step2);
}
开发者ID:virutmath,项目名称:crm_local,代码行数:11,代码来源:functions_1.php

示例4: magic_sig_from_dom

function magic_sig_from_dom($dom)
{
    $env_element = $dom->getElementsByTagNameNS(MAGIC_SIG_NS, 'env')->item(0);
    if (!$env_element) {
        $env_element = $dom->getElementsByTagNameNS(MAGIC_SIG_NS, 'provenance')->item(0);
    }
    if (!$env_element) {
        return false;
    }
    $data_element = $env_element->getElementsByTagNameNS(MAGIC_SIG_NS, 'data')->item(0);
    $sig_element = $env_element->getElementsByTagNameNS(MAGIC_SIG_NS, 'sig')->item(0);
    return array('data' => base64_url_decode(preg_replace('/\\s/', '', $data_element->nodeValue)), 'data_type' => $data_element->getAttribute('type'), 'encoding' => $env_element->getElementsByTagNameNS(MAGIC_SIG_NS, 'encoding')->item(0)->nodeValue, 'alg' => $env_element->getElementsByTagNameNS(MAGIC_SIG_NS, 'alg')->item(0)->nodeValue, 'sig' => preg_replace('/\\s/', '', $sig_element->nodeValue));
}
开发者ID:Warbo,项目名称:ocportal-salmon,代码行数:13,代码来源:magicsig.php

示例5: dr

function dr($Enc_Texto, $senha = "1nqv3w5", $iv_len = 16) {
    $Enc_Texto = base64_url_decode($Enc_Texto);
    $n = strlen($Enc_Texto);
    $i = $iv_len;
    $texto = '';
    $iv = substr($senha ^ substr($Enc_Texto, 0, $iv_len), 0, 512);
    while ($i < $n) {
        $Bloco = substr($Enc_Texto, $i, 16);
        $texto .= $Bloco ^ pack('H*', md5($iv));
        $iv = substr($Bloco . $iv, 0, 512) ^ $senha;
        $i += 16;
    }
    return preg_replace('/\\x13\\x00*$/', '', $texto);
}
开发者ID:jhmachado,项目名称:anotation,代码行数:14,代码来源:functions.Criptografia.php

示例6: parse_signed_request

function parse_signed_request($signed_request, $secret)
{
    list($encoded_sig, $payload) = explode('.', $signed_request, 2);
    $sig = base64_url_decode($encoded_sig);
    $data = json_decode(base64_url_decode($payload), true);
    if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
        error_log('Unknown algorithm. Expected HMAC-SHA256');
        return null;
    }
    $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
    if ($sig !== $expected_sig) {
        error_log('Bad Signed JSON signature!');
        return null;
    }
    return $data;
}
开发者ID:nubert,项目名称:esg-worldhack,代码行数:16,代码来源:fbCreditCallback.php

示例7: parse_signed_request

function parse_signed_request($input, $secret, $max_age = 3600)
{
    list($encoded_sig, $encoded_envelope) = explode('.', $input, 2);
    $envelope = json_decode(base64_url_decode($encoded_envelope), true);
    $algorithm = $envelope['algorithm'];
    if ($algorithm != 'HMAC-SHA256') {
        throw new Exception('Invalid request. (Unsupported algorithm.)');
    }
    if ($envelope['issued_at'] < time() - $max_age) {
        throw new Exception('Invalid request. (Too old.)');
    }
    if (base64_url_decode($encoded_sig) != hash_hmac('sha256', $encoded_envelope, $secret, $raw = true)) {
        throw new Exception('Invalid request. (Invalid signature.)');
    }
    return $envelope;
}
开发者ID:jorgeavilacardenosa,项目名称:signed-request,代码行数:16,代码来源:sample.php

示例8: parse_signed_request

function parse_signed_request($signed_request, $secret)
{
    $arr = explode('.', $signed_request, 2);
    if (!$arr || count($arr) < 2) {
        return null;
    }
    list($encoded_sig, $payload) = $arr;
    // decode the data
    $sig = base64_url_decode($encoded_sig);
    $data = base64_url_decode($payload);
    // check sig
    $expected_sig = hash_hmac('sha256', $payload, $secret, true);
    if ($sig !== $expected_sig) {
        return null;
    }
    return $data;
}
开发者ID:kbrabrand,项目名称:sdk-php,代码行数:17,代码来源:index.php

示例9: parse_signed_request

function parse_signed_request($signed_request, $secret)
{
    if (!(list($encoded_sig, $payload) = explode('.', $signed_request, 2) == null)) {
        print_r('Bad Signed Request!');
        return null;
    }
    // decode the data
    $sig = base64_url_decode($encoded_sig);
    $data = json_decode(base64_url_decode($payload), true);
    // confirm the signature
    $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
    if ($sig !== $expected_sig) {
        print_r('Bad Signed JSON signature!');
        return null;
    }
    return $data;
}
开发者ID:pejovski,项目名称:fb-login-php-js,代码行数:17,代码来源:functions.php

示例10: parse_signed_request

function parse_signed_request($input, $secret, $max_age = 3600)
{
    list($encoded_sig, $encoded_envelope) = explode('.', $input, 2);
    $envelope = json_decode(base64_url_decode($encoded_envelope), true);
    $algorithm = $envelope['algorithm'];
    if ($algorithm != 'AES-256-CBC HMAC-SHA256' && $algorithm != 'HMAC-SHA256') {
        throw new Exception('Invalid request. (Unsupported algorithm.)');
    }
    if ($envelope['issued_at'] < time() - $max_age) {
        throw new Exception('Invalid request. (Too old.)');
    }
    if (base64_url_decode($encoded_sig) != hash_hmac('sha256', $encoded_envelope, $secret, $raw = true)) {
        throw new Exception('Invalid request. (Invalid signature.)');
    }
    // for requests that are signed, but not encrypted, we're done
    if ($algorithm == 'HMAC-SHA256') {
        return $envelope;
    }
    // otherwise, decrypt the payload
    return json_decode(trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $secret, base64_url_decode($envelope['payload']), MCRYPT_MODE_CBC, base64_url_decode($envelope['iv']))), true);
}
开发者ID:ptarjan,项目名称:crypto-request-examples,代码行数:21,代码来源:sample.php

示例11: parse_signed_request

function parse_signed_request($signed_request)
{
    list($encoded_sig, $payload) = explode('.', $signed_request, 2);
    // decode the data
    $sig = base64_url_decode($encoded_sig);
    $data = json_decode(base64_url_decode($payload), true);
    return $data;
}
开发者ID:kaseya-university,项目名称:efront,代码行数:8,代码来源:tools-backup.php

示例12: base64_decrypt

function base64_decrypt($data, $key = false)
{
    $data = base64_url_decode($data);
    if ($key) {
        $data = str_rot_pass($data, $key, true);
    } else {
        if (Config::get('encryption_key')) {
            $data = str_rot_pass($data, Config::get('encryption_key'), true);
        }
    }
    return $data;
}
开发者ID:yizhl,项目名称:php-proxy,代码行数:12,代码来源:helpers.php

示例13: base64_url_decode

$show_path = '';
//file context
$value = '';
//file path code page
$path_code_page = "BIG-5";
if (!empty($_POST['q']) && isset($_POST['v'])) {
    //save file
    $file_path = base64_url_decode($_POST['q']);
    $v = base64_decode($_POST['v']);
    file_put_contents($file_path, $v);
    echo '1';
    exit;
}
if (!empty($_GET['q'])) {
    //open file
    $file_path = base64_url_decode($_GET['q']);
    $show_path = getUTF8String($file_path, $path_code_page);
    if (file_exists($file_path)) {
        $path = $_GET['q'];
        $value = base64_encode(file_get_contents($file_path));
    }
}
?>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title><?php 
echo $show_path;
?>
</title>
开发者ID:PeishuenWu,项目名称:Notepad,代码行数:31,代码来源:notepad.php

示例14: base64_url_decode

            </div>
            <br>
             <div id="error"style="color:red;"></div>
            <div id="success" style="color:green;"></div>
            <div class="form-group no-side-padding col-md-12">
              <label >New Password *</label><br>
              <input type="password" class="form-control" id="password" placeholder="" required="required" name="password">
            </div>
            <br>
            <div class="form-group no-side-padding col-md-12">
              <label >Confirm password *</label><br>
              <input type="password" class="form-control" id="cpassword" placeholder="" required="required"  name="cpassword">
            </div>
            <br>
            <input type="hidden" name="email" id="email" value="<?php 
echo base64_url_decode($_GET['info']);
?>
">
            <div class="col-md-12 no-side-padding mg-t-20">
              <input type="button" name="send" value="Update Password" id="reset_password_btn" class="btn btn-warning"> 
              <!-- <button type="submit" class="btn btn-warning" name="send" value="Update Password">Update Password</button> -->
            </div>

              </form>


       
          
      </div>
    </div>
开发者ID:azeemkhan01,项目名称:gitsunstone,代码行数:30,代码来源:resetpassword.php

示例15: time

</div>
<!--END WRAPPER-->
';
            }
            #==================================
        } else {
            if (isset($_SESSION['SAFE_LOGIN'])) {
                $duration = time() - (int) $_SESSION['timeout'];
                if ($duration >= $inactive) {
                    unset($_SESSION['SAFE_LOGIN']);
                    redirect(BASE_PATH . '/webroot.php', 1);
                }
                if (isset($_POST['admin_x_login'], $_POST['admin_x_pass'])) {
                    //$rsa->loadKey($publicKey);
                    //$rsa->decrypt(base64_url_decode($_GET['code']))
                    if (isset($_GET['code']) && !empty($_GET['code']) && base64_url_decode($_GET['code']) == $_SESSION['SAFE_LOGIN']) {
                        #LOGIN
                        $sql = "select * from user where username=:u and type=1";
                        $stmt = $pdo->prepare($sql);
                        $username = escape($_POST['admin_x_login']);
                        $password = $_POST['admin_x_pass'];
                        $stmt->bindValue(':u', $username, PDO::PARAM_STR);
                        $stmt->execute();
                        if ($stmt->rowCount()) {
                            $user = $stmt->fetch(PDO::FETCH_OBJ);
                            $salt = $user->salt;
                            $encPassword = $user->password;
                            if (checkhashSSHA($salt, $password) == $encPassword) {
                                session_regenerate_id(true);
                                $_SESSION['login'] = true;
                                $_SESSION['name'] = $user->lname . ' ' . $user->fname;
开发者ID:parsinegar2015,项目名称:parsinegar,代码行数:31,代码来源:webroot.php


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