Home » Authentication » Auth_HTTP » Bug #3692
Auth_HTTP Example 2
Details
| Submitted | 2005-03-03 17:40 UTC |
|---|---|
| From | wim at volh dot be |
| Assigned | hirokawa |
| Status | Closed |
| Package | Auth_HTTP |
| PHP Version | 4.3.10 |
| OS | Linux Fedora Core 2 |
| Roadmaps | (Not assigned) |
Comments
[2005-03-03 17:40 UTC] wim at volh dot be
Description:
------------
When you want to try the example 2 code that is published on the pear website, you don't get the wanted result.
Normally the getAuthData('xxx') method must give you extra information stored in the usertable. But it don't give a result.
Reproduce code:
---------------
http://pear.php.net/manual/en/package.authentication.auth-http.auth-http.example2.php
Expected result:
----------------
Normally you want to have the email, telephone and userid.
Actual result:
--------------
the getAuthDate give a NULL as result.
[2005-03-03 17:49 UTC] wim at volh dot be
Example code:
http://www.volh.be/privaat/test/
You can login with Test - T4uWI9YE7h
Normally you must get more than 'Your details on file are: '
The code is:
// example of Auth_HTTP basic implementation
require_once("/usr/share/php/Auth/HTTP.php");
// setting the database connection options
$AuthOptions = array(
'dsn'=>"mysql://xxx:xxx@localhost/volh_1",
'table'=>"tblGebruikers", // your table name
'usernamecol'=>"strGebruikerNaam", // the table username column
'passwordcol'=>"strGebruikerWachtwoord", // the table password column
'cryptType'=>"md5", // password encryption type in your db
'db_fields'=>"*", // enabling fetch for other db columns
);
$a = new Auth_HTTP("DB", $AuthOptions);
$a->setRealm('yourrealm'); // realm name
$a->setCancelText('<h2>Error 401</h2>'); // error message if authentication fails
$a->start(); // starting the authentication process
if($a->getAuth()) // checking for autenticated user
{
echo "Hello $a->username welcome to my secret page <BR>";
echo "Your details on file are: <BR>";
echo $a->getAuthData('fkIntGroepID'); // retriving other details from the database row
};
The value in the database for fkIntGroepID = 5
[2005-03-31 07:31 UTC] wim at volh dot be
Auth 1.2.3 (Stable)
Auth_HTTP 2.1.4 (stable)