本文整理汇总了PHP中Encrypt::encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Encrypt::encrypt方法的具体用法?PHP Encrypt::encrypt怎么用?PHP Encrypt::encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encrypt
的用法示例。
在下文中一共展示了Encrypt::encrypt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cookie
/**
* Get or set our $_COOKIE var via . sperated array access
*
* @param key string A period seperated string of array keys and values
* @param value string The value to be set
*
* @return string
*/
static function cookie($key, $value = null)
{
$key = ID . '_' . $key;
if (!is_null($value)) {
//set the cookie expirey to 24 hours time
setcookie($key, Encrypt::encrypt($value), time() + 3600 * 24);
return;
}
return Encrypt::decrypt($_COOKIE[$key]);
}
示例2: Header
$username = 'yourname@youremail.com';
$password = 'yourpassword';
// Enter your Network Name
$network = 'yournetworkname';
// Enter the API endpoint. This should be "https://sandbox.crowdvalley.com/v1"
// unless you have a paid account with Crowd Valley and you are using the live API
$apiURL = "https://sandbox.crowdvalley.com/v1";
//
//
// No need to touch anything below this line
//
//
// if API is under Basic Authentication, enter BasicAuth username and password
$apiBasicUsername = '';
$apiBasicPassword = '';
$header = new Header($apiKey, $apiSecret);
$encrypt = new Encrypt();
$encryptedPass = $encrypt->encrypt($apiSecret, $password, 16);
$token = $header->createToken($username, $encryptedPass);
echo $token . "\n\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $apiBasicUsername . ":" . $apiBasicPassword);
$headers = array();
$headers[] = 'cv-auth: ' . $token;
$headers[] = 'network: ' . $network;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec($ch);
curl_close($ch);
print $server_output . "\n";
示例3: encrypt_obj
protected function encrypt_obj()
{
foreach ($this->_encrypted as $e) {
if (isset($this->{$e}) && !empty($this->{$e})) {
if (!isset($td)) {
$td = new Encrypt($_SESSION['user']->getKey());
}
$this->{$e} = $td->encrypt($this->{$e});
}
}
}
示例4: Repo
}
}
$repo = new Repo();
$row = $repo->getArraySingle($repo->buildSql(array('table' => 'individual', 'index' => 'email', 'value' => $email, 'columns' => array('email'))));
if (count($row)) {
$message[] = 'Email address is already taken.';
$validation_errors[] = 'email';
}
if (!empty($validation_errors)) {
http_response_code(400);
header("Content-Type: application/json");
echo json_encode(array('success' => false, 'validation_errors' => $validation_errors, 'message' => "<div class='notice bad'><p>" . implode("<br/>", $message) . "</p></div>"));
exit;
}
$individual = new Individual('');
$success = $individual->create(array('name_first' => $name_first, 'name_last' => $name_last, 'email' => $email, 'hash' => $encrypt->encrypt($secret)));
if ($success == true) {
$action = 'show_success';
}
} elseif ($ax == 'update_secret') {
if ($secret == $secret_validation) {
$store_hash_success = $encrypt->storeHash($encrypt->encrypt($secret), $individual_id);
}
} elseif ($ax == 'submit-login') {
if ($email == '') {
$validation_errors[] = 'email';
$message[] = 'Please enter your email address.';
}
if ($secret == '') {
$validation_errors[] = 'secret';
$message[] = 'Please enter your password.';
示例5: setPassword
public function setPassword($value, $key = NULL)
{
if (is_null($value)) {
$this->password = NULL;
} else {
if (!$this->username) {
// Without username you can't set the password
$this->tempPass = $this->password = $value;
} else {
$newPass = Encrypt::hashPassword($value);
$this->password = NULL;
$this->get('password');
if ($this->password != $newPass) {
// Only fiddle with the key if it's a change in password (prevents multiple passes)
$this->password = $newPass;
if (!$key) {
// Allow a key to be sent with the setPassword
$key = $this->getKey();
}
if ($key) {
$td = new Encrypt($value);
$this->dbkey = $td->encrypt($key);
}
}
unset($this->tempPass);
}
}
}
示例6: Header
$username = 'yourname@youremail.com';
$password = 'yourpassword';
// Enter your Network Name
$network = 'yournetworkname';
// Enter the API endpoint. This should be "https://sandbox.crowdvalley.com/v1"
// unless you have a paid account with Crowd Valley and you are using the live API
$apiURL = "https://sandbox.crowdvalley.com/v1";
//
//
// No need to touch anything below this line
//
//
// if API is under Basic Authentication, enter BasicAuth username and password
$apiBasicUsername = '';
$apiBasicPassword = '';
$header = new Header($apiKey, $apiSecret);
$encrypt = new Encrypt();
$encryptedPass = $encrypt->encrypt($password, $apiSecret);
$token = $header->createToken($username, $encryptedPass);
echo $token . "\n\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $apiBasicUsername . ":" . $apiBasicPassword);
$headers = array();
$headers[] = 'cv-auth: ' . $token;
$headers[] = 'network: ' . $network;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec($ch);
curl_close($ch);
print $server_output . "\n";