why am i getting this error on the closing php tag?
Parse error: parse error, unexpected $ in /export/home/jmaccs64/public_html/test/login.php on line 81
Any help would be great! Im really new at this! so if you happen to see any other improvements please by all means, let me know!
Thanks
Here is my code!
<?php
session_start();
// This makes user not authenticated
$auth = false;
if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) {
// This reads the entire file into the variable $file_contents
$filename = 'passwords.dat';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
// put into array
$lines = explode ( "\n", $file_contents );
// Split and match them to $PHP_AUTH_USER and $PHP_AUTH_PW.
foreach ( $lines as $line ) {
list( $username, $password, $fullname ) = explode( ':', $line );
if ( ( $username == "$PHP_AUTH_USER" ) &&
( $password == "$PHP_AUTH_PW" ) ) {
$auth = true;
break;
}
}
}
if ( ! $auth ) {
header( 'WWW-Authenticate: Basic realm="Private"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';
exit;
} else {
foreach ($file as $num => $line){
if (stristr($line, $fullname))
{
echo 'Sorry you already Voted this Week!<br />';
}
else
{
echo '<form name="examplepost" method="post" action=example.php?do=post>
<select name="teams">
<option value="Bears">Bears
<option value="Green Bay">Green Bay
<option value="Bucs">Bucs
<option value="Bills">Bills
</select>
<br>
<input type="submit" name="Submit" value="Submit">
</form>';
}
}
print $fullname;
echo '<P>You are authorized!</P><br>';
// Check to see if the user is in the flat file
$file = file('week1.dat');
// Register name
$name = $fullname;
session_register("name");
?>