Hi, I have posted my question to this list before but I did not get a help that I was expected. All I wanted to do is to give access for the users to view a page in which the below code is embedded. The user will enter his/her username and password. But the code is not working. I don't know what to think. I need your help guys. Don't let me die on this code <?php > > $auth = false; > if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) { > > > $filename = 'c:\\php_data\\file.txt'; > $f = @fopen($filename, "r"); > if ($f != FALSE) > { $a = @fread($f, filesize($filename)); > fclose($f); > } > else > { > echo "Could not open file"; > } > > > > $lines = explode ( "\n", $file_contents ); > > > > foreach ( $lines as $line ) { > > list( $username, $password ) = 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 { > > echo '<P>You are authorized!</P>'; > } > > ?> > > --------------------------------- Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now