I’ve got the following code…
<?
$run = "0";
$userfil = file("members/0.txt");
while (list($radnrus, $radus) = each($userfil))
{
if ($radus == $user)
{
$usertest = $user;
$run = $run + 1;
}
}
$memberfil = file("members/$usertest.txt");
while (list($radnrme, $radmem) = each($memberfil))
{
if ($radnrme == 5)
{
if ($radmem == $password)
{
$run = $run + 1;
}
}
}
?>
Where the code validates the login user and then it checks if the password is correct. “$run” Should return a value of 2 in order to display the page after the validation or else it would display a error message.
My problem is that the password validation won’t work. “$user” and “$password” comes from “$_POST[’######’]”.
It can open and find the password in the file but will just not return a “$run” value of 2.
I also have a similar problem with “updating control” of my site. Made so that index.php checks a text file if the site is down for automatic update or not. At the beginning it worked exellent but suddenly died on me. Adding this here aswell.
<?
$filetext = file("admin/data.txt");
while (list($rownr,$row) = each($filetext))
{
if ($row == "update")
{
echo "<script type='text/javascript'>";
echo "window.location = 'update.php'";
echo "</script>";
}
elseif ($row == "run")
{
echo "<script type='text/javascript'>";
echo "window.location = 'main.php'";
echo "</script>";
}
}
?>
The code above makes the whole site to redirect to a “updating the site at the moment” page in order for the automatic calculations and updating to work in peace for a couple of minutes.
Thankfull for help! / Artagard