Login fields now only allow alphanumeric characters

This commit is contained in:
WilliamMiceli
2019-12-04 17:19:32 -05:00
parent 68e4bf54ad
commit 5967ee13e0

View File

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