unexpected $ in flat file code :(
Posted: Wed May 19, 2004 1:47 pm
Hi
Was wondering if you could tell me what is causing this error, and maybe how to fix it.
Error: Parse error: parse error, unexpected $ in validate.php on line 25
Line 25 contrains..
?>
thats it.
Here is all of the code, as line 25 tells you nothing

Was wondering if you could tell me what is causing this error, and maybe how to fix it.
Error: Parse error: parse error, unexpected $ in validate.php on line 25
Line 25 contrains..
?>
thats it.
Here is all of the code, as line 25 tells you nothing
Thanks in advance to anybody who helps<?
// Define post fields into simple variables
$username = $_POST['username'];
$password = $_POST['password'];
$filename = 'users.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
// Place the individual lines from the file contents into an array.
$lines = explode ( "\n", $file_contents );
foreach ( $lines as $line ) {
list( $username, $password ) = explode( ':', $line );
if ( ( $username == "$username" ) &&
( $password == "$password" ) ){
echo "Success!";
}
?>