• Welcome to Valhalla Legends Archive.
 

Can't figgure out why this wont read properly...

Started by Black4C6F747573, December 09, 2004, 09:00 AM

Previous topic - Next topic

Black4C6F747573

<?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"$teachertime()+36000);
header("Location: http://dburg-php.bizhat.com/teacher-consol.php");
?>


and the file is

tomþhhhþ
gregþgggþ
fartþtttþ
andyþaaaþ
shawnþsssþ
casyþshineonþ
lexiþgoodtogoþ


it wont read past 4 charecters in any name

I.E.

The echo prints out this

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

shawn is being read as shaw, missing the n.

Same goes with the password

lexi has the password goodtogo

the echo spits this out

QuoteComparing 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`-~

I can't figgure out why it won't read more than four charecters.  Ruining my login script :-)  Any help would be appreciated.