Auth_HTTP Example

Auth_HTTP Example

Auth_HTTP Example -- Example: A simple password protected page



// example of Auth_HTTP basic implementation 


// setting the database connection options
$AuthOptions = array(
'table'=>"testable",                            // your table name 
'usernamecol'=>"username",			// the table username column
'passwordcol'=>"password",			// the table password column
'cryptType'=>"none",				// password encryption type in your db

$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";

© Copyright 2003-2023 The ultimate PHP Editor and PHP IDE site.