本文整理汇总了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;
}
}