Hi, I have this function in a class file Fileops.php which is suppose to read from a text file then validate a username and password from that text file then if they match will take me to Links.php when the function is called from index.php, but i am getting these errors:
Warning: file(../tmp/users.txt) [function.file.html]: failed to open stream: No such file or directory in /home/student/nguydn08/public_html/p2475/cinc/Fileops.php on line 123
Warning: Invalid argument supplied for foreach() in /home/student/nguydn08/public_html/p2475/cinc/Fileops.php on line 125
public function validateUser( $username, $password) {
$file_link = "../tmp/users.txt";
$lines = file($file_link);
foreach($lines as $line_num => $line){
$decodedline = urldecode($line);
$pieces = explode("::", $decodedline);
if ( $username == $pieces[0] && $password == $pieces[1] ) {
header( 'Location: http://bscacad2.buffalostate.edu/~nguydn08/p2475/Links.php' ) ;
return True;
}
else{
header( 'Location: http://bscacad2.buffalostate.edu/~nguydn08/p2475/index.php' ) ;
}}
}
}