本文整理汇总了PHP中Acl::generateSalt方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::generateSalt方法的具体用法?PHP Acl::generateSalt怎么用?PHP Acl::generateSalt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::generateSalt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store()
{
if ($this->restrictCall("post")) {
$pass = true;
$user = $this->model('User');
$id = Post::_get('id');
$email = Post::_get('email');
$sql = "UPDATE `" . $user->table . "` SET `email`='" . $email . "' WHERE `id`='" . $id . "'";
$user->update($sql);
// Kijk of wachtwoord ook is ingevult.
$password1 = Post::_get('password1');
$password2 = Post::_get('password2');
// Passwords wijzigen als dit is ingevult
if (isset($password1) && isset($password2)) {
$result = Validator::password($password1, $password2);
if ($result != true) {
return $this->view('admin/users/edit', ['user' => $user->get($id), 'error' => $result]);
} else {
$salt = Acl::generateSalt();
$password = Acl::doHash($password1, $salt);
$sql = "UPDATE `" . $user->table . "` SET `wachtwoord`='" . $password . "', `salt`='" . $salt . "' WHERE `id`='" . $id . "'";
$user->update($sql);
}
}
//Rollen updaten
$rollen = $this->super->getCore()->getDatabase()->getAll("SELECT * FROM `rollen`");
$post_rollen = Post::_get('rollen');
$this->super->getCore()->getDatabase()->raw("DELETE FROM `gebruiker_rollen` WHERE gebruiker_id=" . $id);
foreach ($rollen as $rol) {
if (in_array($rol['id'], $post_rollen)) {
$this->super->getCore()->getDatabase()->raw("INSERT INTO `gebruiker_rollen` (rol_id, gebruiker_id)VALUES(" . $rol['id'] . "," . $id . ")");
}
}
// Redirect maar admin homepagina
return Helpers::redirectWithMessage('/harmstercms/admin', 'Gebruiker is geupdate');
} else {
return $this->view('error/error', ['error_message' => 'Page is post restricted']);
}
}
示例2: csrfTokenGenerate
static function csrfTokenGenerate()
{
$token = Acl::generateSalt();
Session::set('csrftoken', $token);
return $token;
}