Auth_HTTP Problem
| From: | rogue | Date: | Mon, 12 Apr 2004 05:53:09 +0000 |
| Subject: | Auth_HTTP Problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11779@lists.php.net to get a copy of this message | ||
Hi all,
I am trying out the example code in the pear docs for Auth_HTTP, but I can't get the code to run. Actually, including the class at all causes everything after that to not show up. I am assuming there is an error of some sort, but I am not sure how to display the error.
Here is my code:
<?php
// example of Auth_HTTP implementation with encrypted password and multiple columns fetch
require_once("Auth/HTTP.php");
$AuthOptions = array(
'dsn'=>"mysql://user:pass@localhost/auth",
'table'=>"tbl_auth",
'usernamecol'=>"username",
'passwordcol'=>"password",
'cryptType'=>"md5",
'dbFields'=>"*"
);
$a = new Auth_HTTP("DB", $AuthOptions);
$a->setRealm('yourrealm');
$a->start();
$a->setCancelText('<h2>Error 401</h2>');
if($a->getAuth())
{
echo "Hello $a->username welcome to my secret page <BR>";
echo "Your details on file are: <br>";
echo $a->getAuthData('userid'); // retriving other details from the database row
echo $a->getAuthData('telephone'); // in this example the user id, telephone number
echo $a->getAuthData('email'); // and email address
};
?>