Re: help!
| From: | andreas \(@work\) | Date: | Thu, 24 Aug 2000 14:01:35 +0000 |
| Subject: | Re: help! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13411@lists.php.net to get a copy of this message | ||
hi,
check bracket_matching
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/ viva technologies
_/ gstrein andreas
"Always listen to the experts; they'll tell you what can't be done and why.
Then do it."
- Robert A. Heinlein
----- Original Message -----
From: "TheDngo" <mike.candelori@home.com>
To: <php-general@lists.php.net>
Sent: Thursday, August 24, 2000 6:49 PM
Subject: [PHP] help!
> I have a script that goes like this:
>
> <?php
>
> // File Name: login.php
>
> // Check to see if $PHP_AUTH_USER already contains info
>
> if (!isset($PHP_AUTH_USER)) {
>
> // If empty, send header causing dialog box to appear
>
> header('WWW-Authenticate: Basic realm="Saint Johns Church Intranet"');
> header('HTTP/1.0 401 Unauthorized');
> exit;
>
> } else if (isset($PHP_AUTH_USER)) {
>
> // If non-empty, open file containing valid user info
>
> $filename = "authuser.txt";
> $fp = fopen($filename, "r");
> $file_contents = fread($fp, filesize($filename));
> fclose($fp);
>
> // Place each line in user info file into an array
>
> $line = explode("\n", $file_contents);
>
> // For as long as $i is <= the size of the $line array,
> // explode each array element into a username and password pair
>
>
> $i = 0;
>
> while($i <= sizeof($line))
>
> $data_pair = explode(":", $line[$i]);
>
> if (($data_pair[0] == "$PHP_AUTH_USER") && ($data_pair[1] ==
> "$PHP_AUTH_PW")) {
> $auth = 1;
> break;
> } else {
> $auth = 0;
> }
> $i++;
> }
>
> if ($auth == "1") {
>
> echo "<P>You're authorized!</p>";
> exit;
>
> } else
>
>
> header('WWW-Authenticate: Basic realm="Saint Johns Church Intranet"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.';
> exit;
>
> }
>
> ?>
>
> I'm getting a "parse error" on the last line, the closing tag. What's
> wrong?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>