sanitized login form
This commit is contained in:
parent
6dbca7cbd4
commit
b92f7c1054
@ -20,7 +20,7 @@ class UserController
|
|||||||
public function loginUser()
|
public function loginUser()
|
||||||
{
|
{
|
||||||
$erg = array();
|
$erg = array();
|
||||||
$erg = $this->userModel->loginUser($_POST["username"], $_POST["password"]);
|
$erg = $this->userModel->loginUser($this->sanitize($_POST["username"]), $this->sanitize($_POST["password"]) );
|
||||||
if ($erg["success"] == true) {
|
if ($erg["success"] == true) {
|
||||||
header("Location: ?controller=Welcome&do=showWelcome");
|
header("Location: ?controller=Welcome&do=showWelcome");
|
||||||
exit();
|
exit();
|
||||||
@ -46,7 +46,7 @@ class UserController
|
|||||||
public function registerUser()
|
public function registerUser()
|
||||||
{
|
{
|
||||||
$erg = array();
|
$erg = array();
|
||||||
$erg = $this->userModel->registerUser($_POST["username"], $_POST["password"]);
|
$erg = $this->userModel->registerUser($this->sanitize($_POST["username"]), $this->sanitize($_POST["password"]) );
|
||||||
if ($erg["success"] == true) {
|
if ($erg["success"] == true) {
|
||||||
header("Location: ?controller=User&do=showUserLoginForm");
|
header("Location: ?controller=User&do=showUserLoginForm");
|
||||||
exit();
|
exit();
|
||||||
@ -54,10 +54,10 @@ class UserController
|
|||||||
else {
|
else {
|
||||||
$this->view->setDoMethodName("showUserRegisterForm");
|
$this->view->setDoMethodName("showUserRegisterForm");
|
||||||
|
|
||||||
$message = $erg['message'];
|
$message = $this->sanitize($erg['message']);
|
||||||
echo "<script type='text/javascript'>alert(\"$message\");</script>";
|
echo "<script type='text/javascript'>alert(\"$message\");</script>";
|
||||||
$this->view->setVars([
|
$this->view->setVars([
|
||||||
"errmsg" => $erg["message"]
|
"errmsg" => $message
|
||||||
]);
|
]);
|
||||||
$this->showUserRegisterForm();
|
$this->showUserRegisterForm();
|
||||||
}
|
}
|
||||||
@ -73,6 +73,7 @@ class UserController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') {
|
||||||
|
return htmlspecialchars((string)$data, $flags, $encoding);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user