Valhalla Legends Forums Archive | Web Development | Can't figgure out why this wont read properly...

AuthorMessageTime
Black4C6F747573
[code]<?php

$teacher=$_POST["teacher"];
$password=$_POST["password"]; 
$success ==0;
if(!($t=fopen("teacher2.txt","r")))
exit("Unable to open Teacher File");

while(!feof($t))
  {
$name=stream_get_line($t,32768,"þ");
echo "Comparing database name \"".$name."\"to username \"".$teacher."\"<br>";
if($name===$teacher)
  {
$t_true=1;
fseek($t,1,SEEK_CUR);
$pass=stream_get_line($t,32768,"þ");
echo "Comparing $pass to $password.";
if($pass===$password)
  {
echo "Successful Loggin!~  Please wait while I transfer you to your consol " . $teacher;
$success = 1;
break;
  }
else
  {
exit("Password is invalid`-~");
  }
  }
else{fgets($t);}
  }
fclose($t);
if(!($t_true===1))
exit("That teacher could not be found in our database.");
setcookie("uname", $teacher, time()+36000);
header("Location: http://dburg-php.bizhat.com/teacher-consol.php");
?>[/code]

and the file is

[code]tomþhhhþ
gregþgggþ
fartþtttþ
andyþaaaþ
shawnþsssþ
casyþshineonþ
lexiþgoodtogoþ[/code]

it wont read past 4 charecters in any name

I.E.

The echo prints out this

[quote]Comparing database name "tom"to username "shawn"
Comparing database name "greg"to username "shawn"
Comparing database name "fart"to username "shawn"
Comparing database name "andy"to username "shawn"
Comparing database name "shaw"to username "shawn"
Comparing database name "casy"to username "shawn"
Comparing database name "lexi"to username "shawn"
That teacher could not be found in our database.[/quote]

shawn is being read as shaw, missing the n.

Same goes with the password

lexi has the password goodtogo

the echo spits this out

[quote]Comparing database name "tom"to username "lexi"
Comparing database name "greg"to username "lexi"
Comparing database name "fart"to username "lexi"
Comparing database name "andy"to username "lexi"
Comparing database name "shaw"to username "lexi"
Comparing database name "casy"to username "lexi"
Comparing database name "lexi"to username "lexi"
Comparing good to goodtogo.
Password is invalid`-~[/quote]

I can't figgure out why it won't read more than four charecters.  Ruining my login script :-)  Any help would be appreciated.
December 9, 2004, 3:00 PM

Search