Hey guys. I'm working on a login script and I'm having some problems getting my code to compare two things correctly. I have an html page with a form containing

<input type=text name=username> :username

<input type=text name=password> :password


sending it to my php script

Then in my script i have this :
Code:
	$teacher==$_POST["teacher"];
	$password==$_POST["password"];
	$somecontent == "tom/nhhh/nkelley/nkkk/ntaylor/nttt";

	echo $teacher . "
";                ---  Verify Teacher
	echo $password . "
";             ---   Verify Password

	$success ==0;


	if(!($t=fopen("teacher.txt","r")))
	exit("Unable to open Teacher File");
	
	while(!feof($t))
	   { 
		$t_read=fgets($t,65535);
		echo $t_read . "
";
		if ($teacher . "/r" == $t_read)
		   {
			$p_read == fgets($t,65535);
			echo $p_read . "
";
			if ($password==$p_read)
			   {
				echo "Successful Loggin!~";
				$success == 1;
			   }
		   }
	
		else
		   {
			fgets($t);
		   }
	   }
	fclose($t);
	if(!($success==1))
	echo $teacher . " with the password " . $password . " can not be 
found in the database";
I made the text file myself, because is_writeable would return false and chmod wouldnt work, so I couldn't write a script to register the usernames with fwrite.

My database looks like this in notepad

tom
hhh
kelley
kkk
taylor
ttt

I want it to scan the database's 1st line and show me what it finds
Code:
$t_read=fgets($t,65535);
		echo $t_read . "
";
then I want it to compare that to the name entered by the user
Code:
		if ($teacher . "/r" == $t_read)
		   {
			$p_read == fgets($t,65535);
			echo $p_read . "
";
			if ($password==$p_read)
			   {
				echo "Successful Loggin!~";
				$success == 1;
			   }
		   }
and in that script it does the same thing for the password. I think that after it reads the teachers name from the database, it is set on the next line. Then from there, if the teachers name matches the one entered, it reads the next line and compares that to the password. Tom's password would be hhh. Kelley's would be kkk... etc... If the teachers nme doesnt match, it reads a new line with fgets, but doesnt do anything with it, inorder to set it at the next username line.

all of this works fine. Visuallly, I see tom print out first, then hhh, for the things entered by the user in the form, then I see tom print out as the first line read out, so I know thats being compared to the tome entered, but I see a blank space after it when I highlight. I'm thinking there might be some sort of charecter that was generated when I hand wrote my notepad document. I could be wrong, but eitehr way its not working. If you guys could give me a hand that would be thx :-). I am trying to avoid usign mySQL as my webhost doesnt support it.

Sincerly,
Black Lotus [/code]