Ive got a few basic questions about login scripts...
I have looked at a few login scripts where a login page is displayed to the user if they are not logged in, then once submited the logincheck function evaluates weather the user and pass is valid and logs them in.
Questions:
This question is about $_SESSION variables and variable poisoning. MY question is, why register the username and password as session variables, I read this is to prevent poisoning but when I think about it, to poision it the atacker would need a valide username and password so what difernce does it make if he retyped the variable in the GET request he would still need a corect password.
If they would need to have a corect usrrname and password in the first place why do I care if they entered it into a GET later in the day?
if (isset($_GET['passwprd'])){
unset($GET['password']);
return false;
}
if (isset($_SESSION['password'])){
return true; //is logged in
} else {
session_start();
$_SESSION['username'] = $_POST['uname'];
$_SESSION['password'] = $_POST['passwd'];
$return = validateUser($_SESSION['username']);
if ($return == true)
$return = validatePass($_SESSION['password']);
return $return
}