Ok, I don't have access to an SQL server and i really don't want to because of my needs are so small. So I wrote a login script without using a database, but using a text file for the 'database'. It seems no matter what I do it just wont work, constantly having probs. I havn't worked with PHP all that much 5 days, but I know the basics. Well heres the code.
<?
$filename = "passwordfile.php";
$passwords = fopen ($filename, "r");
$username = $session_username;
$password = $session_password;
function CheckUser($session_username,$session_password,$passwords) {
if ($passwords == "$session_username:$session_password")
return "allowed";
else if ($passwords != "$session_username:$session_password")
return "denied";
}
if (CheckUser() == "allowed") {
header ("Location: main.php");
}
else if (CheckUser() == "denied") {
echo("<h1>Error!</h1>");
echo("<br><h3>Your username and password are incorrect</h3>");
echo("<br><h3><a href=password_enter.html>Please click here to try again.</a></h3>");
}
?>
I have a HTML form sending the variables $username and $password to this. And the problem im getting is taht it can't find the variables in the function CheckUser().
Please help.