Despabilando la MonoNeurona::Internet es de todos [Inicio] [Regresar]
WWW \ Autentificación con PEAR
WWW
Autentificación con PEAR

Este artículo ha sido consultado en 461 ocasiones.

 

 

<?php 
// example of Auth_HTTP implementation with encrypted password and multiple columns fetch

require_once("Auth/HTTP.php");

// setting the database connection options
$AuthOptions = array(
'dsn'=>"pgsql://test:test@localhost/testdb",
'table'=>"testable",                            // your table name
'usernamecol'=>"username", // the table username column
'passwordcol'=>"password", // 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('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
};
?>


Última actualización: 2007-04-29 10:57:00-05



ir arriba
The Queen is here Mozilla Firefox The Best DataBase CakePHP Framework CSS GNU Hacker