This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
require_once(BASEPATH . '../application/libraries/PayPal-PHP-SDK/autoload.php'); | |
use PayPal\Rest\ApiContext; | |
use PayPal\Auth\OAuthTokenCredential; | |
use PayPal\Api\Capture; | |
use PayPal\Api\Authorization; | |
use PayPal\Api\Amount; | |
use PayPal\Exception\PayPalConnectionException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function crypto_rand_secure($min, $max) | |
{ | |
$range = $max - $min; | |
if ($range < 1) return $min; // not so random... | |
$log = ceil(log($range, 2)); | |
$bytes = (int) ($log / 8) + 1; // length in bytes | |
$bits = (int) $log + 1; // length in bits | |
$filter = (int) (1 << $bits) - 1; // set all lower bits to 1 | |
do { | |
$rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes))); |