本文整理匯總了PHP中StringHelper::decrypt方法的典型用法代碼示例。如果您正苦於以下問題:PHP StringHelper::decrypt方法的具體用法?PHP StringHelper::decrypt怎麽用?PHP StringHelper::decrypt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類StringHelper
的用法示例。
在下文中一共展示了StringHelper::decrypt方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
public function init()
{
parent::init();
if (!in_array($this->_request->getActionName(), array('login', 'logout'))) {
$authString = $this->_getParam(Model_Employee::COOKIE_NAME, '');
$data = StringHelper::decrypt($authString);
if (is_array($data)) {
$id = $data['id'];
$password = $data['password'];
$employee = new Model_Employee($id);
if ($employee->exists() && $employee->get('password') == $password) {
$this->view->employee = $this->employee = $employee;
$this->_request->setUserParam('EMPLOYEE_ID', $employee->get('id'));
}
}
$this->checkAuth();
}
}
示例2: init
public function init()
{
parent::init();
$loggedIn = false;
if (!in_array($this->_request->getActionName(), array('index', 'logout'))) {
$authString = $this->_getParam(self::AUTH_COOKIE_NAME, '');
$data = StringHelper::decrypt($authString);
if (is_array($data)) {
$name = $data['name'];
$password = $data['password'];
if (array_key_exists($name, $this->admins) && $password == $this->admins[$name]) {
$loggedIn = true;
}
}
if (!$loggedIn) {
setcookie(self::AUTH_COOKIE_NAME, '', null, '/');
$this->error('Authentication failed. <a href="/private-car-management/">Login</a>');
}
}
}
示例3: init
public function init()
{
parent::init();
if (!in_array($this->_request->getActionName(), array('signUp', 'signIn', 'signOut'))) {
$authString = $this->_getParam(self::AUTH_COOKIE_NAME, '');
$data = StringHelper::decrypt($authString);
if (is_array($data)) {
$email = $data['email'];
$password = $data['password'];
$user = new Model_User($email);
if ($user->exists() && $user->get('password') == $password) {
$this->view->user = $this->user = $user;
$this->_request->setUserParam('EMAIL', $user->get('email'));
}
}
if ($this->_request->getActionName() != 'index' && empty($this->user)) {
setcookie(self::AUTH_COOKIE_NAME, '', null, '/');
$this->error('Authentication failed. Please <a href="/private-car/">sign in</a>');
}
}
}
示例4: findAndDecrypt
public static function findAndDecrypt($id)
{
$account = CloudAccount::where('user_id', Auth::id())->findOrFail($id);
$account->credentials = StringHelper::decrypt($account->credentials, md5(Auth::user()->username));
return $account;
}
示例5: getDownloadKey
public function getDownloadKey($id)
{
$this->check(true);
$instanceID = Input::get('instanceID');
$deployment = Deployment::where('user_id', Auth::id())->find($id);
$account = CloudAccount::where('user_id', Auth::id())->findOrFail($deployment->cloudAccountId);
$arr = $this->executeAction('downloadKey', $account, $deployment, $instanceID);
if ($arr['status'] == 'OK') {
$key = StringHelper::decrypt($arr['key'], md5(Auth::user()->username));
header('Content-Description: File Transfer');
header('Content-Type: ' . 'application/x-pem-file');
header('Content-Disposition: attachment; filename=' . $arr['keyName'] . '.pem');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . strlen($key));
print $key;
}
}