Hi. I'm trying to make a simple login page. here's the code for the php, I won't show the form stuff because that's working:
$thelogins = "logins.txt";
$fp = fopen($thelogins , "r");
$buffer = fread($fp , filesize($thelogins));
fclose($fp);
$line = explode("--" , $buffer);
$i = 0;
$thecheck =0;
while($i < sizeof($line))
{
$datapair = explode(":" , $line[$i]);
if(($datapair[0] == $_POST["login"] and $datapair[1] == $_POST["passw"]))
{
$thecheck = 1;
break;
}
else
{
$thecheck = 0;
}
$i++;
}
if($thecheck == "1")
{
print ("you're cool");
}
else
{
print ("try again");
}
?>
It only works if the user entered the first login/passwd combination in the text file. I've checked the code by printing the value of $datapair inside the while to see if it goes thru and it does but for some reason it's not working
thanx for any help
thanx