For some reason, this code won't work. It loads in usernames into linearray1, passwords into linearray2, and access levels into numberarray3 (which I won't worry about for a login) For some reason, it will NEVER return true for anything like "Terin" == "Terin" It loads in everything correctly, I've output the usernames/passwords (temporarily of course, I don't need people choosing who they want to login as. 😃 ) and what was passed in. ($username and $password) Does anyone see anything?
<?php
$fp = fopen("/u167/chibiice/rpg/admin/admin.cgi", "r");
$linearray1 = array();
$linearray2 = array();
$numberarray3 = array();
while(!feof($fp))
{
$buffer = fgets($fp, 4096);
$linearray1[] = $buffer;
$buffer = fgets($fp, 4096);
$linearray2[] = $buffer;
fscanf($fp, "%d", $temp);
$numberarray3[] = $temp;
}
fclose($fp);
$bool = 0;
if($password != "" && $username != "")
{
for($z = 0; $z < count($linearray1); $z++)
{
$x = $linearray1[$z];
$y = $linearray2[$z];
if(strcmp($username, $x) == 0 && strcmp($password, $y) == 0)
{
$bool = 1;
include("/u167/chibiice/rpg/admin/fileadd.php");
echo(" <input type=\"hidden\" name=\"username\" value=\"$linearray1[$z]\">\n");
echo(" <input type=\"hidden\" name=\"password\" value=\"$linearray2[$z]\">\n");
break;
}
}
}
if($bool == 0)
echo("Incorrect Username/Password");
?>
Thank you!