Login fields now only allow alphanumeric characters
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
try{
|
try{
|
||||||
if($_POST['login_username'] != '' && $_POST['login_password'] != ''){
|
if($_POST['login_username'] != '' && $_POST['login_password'] != ''){
|
||||||
|
if(ctype_alnum($_POST['login_username']) && ctype_alnum($_POST['login_password'])){
|
||||||
unset($_SESSION['loggedInUser']);
|
unset($_SESSION['loggedInUser']);
|
||||||
$db_statement = $db_connection->prepare("SELECT COUNT(*) FROM login WHERE username = '".$_POST["login_username"]."' and pword = '".$_POST["login_password"]."'");
|
$db_statement = $db_connection->prepare("SELECT COUNT(*) FROM login WHERE username = '".$_POST["login_username"]."' and pword = '".$_POST["login_password"]."'");
|
||||||
$db_statement->execute();
|
$db_statement->execute();
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
// No matching users found, send user an error message
|
// No matching users found, send user an error message
|
||||||
$_SESSION['loginError'] = 'Invalid Username or Password';
|
$_SESSION['loginError'] = 'Invalid Username or Password';
|
||||||
}
|
}
|
||||||
|
}else{$_SESSION["loginError"] = "Invalid characters found, please try again";}
|
||||||
}else{
|
}else{
|
||||||
// If user submitted login form wihout actually filling it out completely, send user an error message
|
// If user submitted login form wihout actually filling it out completely, send user an error message
|
||||||
if(!empty($_POST)){
|
if(!empty($_POST)){
|
||||||
|
|||||||
Reference in New Issue
Block a user