本文整理汇总了PHP中tools::createPasswordHash方法的典型用法代码示例。如果您正苦于以下问题:PHP tools::createPasswordHash方法的具体用法?PHP tools::createPasswordHash怎么用?PHP tools::createPasswordHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools
的用法示例。
在下文中一共展示了tools::createPasswordHash方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createConfigKey
public function createConfigKey($newConfig)
{
include \base_config::$baseDir . '/version.php';
$newConfig['sysVersion'] = $afltrVersion;
$newConfig['loginPasswortSalt'] = uniqid(md5($_SERVER['HTTP_HOST']), true);
if (!preg_match("/^.*(?=.{6,})(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).*\$/", $newConfig['loginPasswort'])) {
return false;
}
$newConfig['loginPasswort'] = \tools::createPasswordHash($newConfig['loginPasswort'], $newConfig['loginPasswortSalt']);
$config = new \model\system_config($this->dbconnection);
foreach ($newConfig as $key => $value) {
$value = \contrl\base_contrl::filterRequest($value, array(1, 4, 7));
$config->save($key, $value);
}
return true;
}
示例2: process
public function process()
{
if (!is_null($this->getRequestVar('nologin'))) {
\messages::registerError(\language::returnLanguageConstant('NO_LOGIN'));
}
if (!is_null($this->getRequestVar('nopassreset'))) {
\messages::registerError(\language::returnLanguageConstant('LOGIN_PASSWORD_RESET_FAILED'));
}
if (!is_null($this->getRequestVar('resetpass'))) {
$newPass = uniqid();
$mailData = array('mailTo' => $this->getSysconfig()->getAdminMail(), 'mailSubject' => \language::returnLanguageConstant('LOGIN_PASSWORD_RESET'), 'mailText' => $newPass, 'mailFrom' => 'affiliat_r_no_reply@' . $_SERVER['HTTP_HOST']);
if (\messages::sendEMail($mailData)) {
$this->getSysconfig()->setLoginPasswort($newPass);
$this->getSysconfig()->update();
$this->redirect();
} else {
$this->redirect('', array('nopassreset'));
}
}
$sessionCookieValue = $this->getSessionCookieValue();
if (!is_null($sessionCookieValue)) {
$session = new \model\session($this->getDbconnection(), $sessionCookieValue);
if ($session->exists()) {
$this->redirect('system/dash');
}
}
if (!is_null($this->getRequestVar('passwd', array(1, 4, 7)))) {
$passwort = \tools::createPasswordHash($this->getRequestVar('passwd'), $this->getSysconfig()->getLoginPasswortSalt());
if ($passwort == $this->getSysconfig()->getLoginPasswort()) {
$ip = $_SERVER["REMOTE_ADDR"];
$sessionId = sha1(uniqid($ip, true));
$expire = time() + $this->getSysconfig()->getSessionLength();
$session = new \model\session($this->getDbconnection());
$session->setLogin(time());
$session->setLogout(0);
$session->setSessionId($sessionId);
$session->setIp($ip);
$session->save();
setcookie('afltrsid', $sessionId, $expire, '/', $_SERVER["SERVER_NAME"], false, true);
$this->redirect('system/dash');
}
\messages::registerError(\language::returnLanguageConstant('WRONG_PASSWORD'));
}
$view = new \model\view_acp('login');
$view->assign('defaultPW', '');
$view->render();
}
示例3: setLoginPasswort
/**
*
* @param string $loginPasswort
*/
public function setLoginPasswort($loginPasswort)
{
$this->loginPasswort = \tools::createPasswordHash($loginPasswort, $this->getLoginPasswortSalt());
}