# Noobish question? Help!

**URL:** <https://www.phphelp.com/t/noobish-question-help/11296>\
**Category:** General PHP Help\
**Created:** [May 8, 2008, 12:48am UTC](https://www.phphelp.com/t/noobish-question-help/11296 "2008-05-08T00:48:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Artagard](https://www.phphelp.com/letter_avatar_proxy/v4/letter/a/58f4c7/32.png) [@Artagard](https://www.phphelp.com/u/Artagard)\
**Post date:** [May 8, 2008, 12:48am UTC](https://www.phphelp.com/t/noobish-question-help/11296/1 "2008-05-08T00:48:44Z")

</div>

I’ve got the following code…

```auto
<?

$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.

```auto
<?

$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

---

<div class="post-metadata">

**Author:** ![peg110](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/bb73d2/32.png) [@peg110](https://www.phphelp.com/u/peg110)\
**Post date:** [May 19, 2008, 11:16am UTC](https://www.phphelp.com/t/noobish-question-help/11296/2 "2008-05-19T11:16:41Z")

</div>

What have you done to debug it? Are you sure you are getting into each of your “IF” Loops which updates the $run?
