I'm learning PHP now, and I'm trying to find out whether or not the following code structure has any faults:
$loggedIn = false;
if (isset($_GET["userpass"])){
if (strcmp($_GET["userpass"], $correctPassword) == 0) {
$loggedIn = true;
}
}
To me, it seems pretty bullet-proof. If the password isn't set, then the code doesn't execute. And if it is, then the user actually has to supply the correct password. Anything obvious I'm missing?
Note:
$correctPassword
is defined in an external file, not accesible to the public
Update:
Can the user of this website explit the script so that he can log in to any arbitrary account? As in, this piece of code always sets $loggedIn = true;