Set WeberTrivia.com to be my default homepage.   Suggest a Question                                               

Suggest A Question : :  Frequently Asked Questions : :  Search : :  Relevant Manuals : : 
PHP Questions : :  Linux Questions : :  MySQL Questions : : 
home  [ Login ] 

Auth_HTTP Example

Auth_HTTP Example -- Example: A simple password protected page

Example

<?php  // example of Auth_HTTP basic implementation   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'=>"none",				//password encryption type in your db );   $a = new Auth_HTTP("DB", $AuthOptions);  $a->setRealm('yourrealm');			//realm name $a->start();					//starting the authentication process $a->setCancelText('<h2>Error 401</h2>'); 	// error message if authentication fails   if($a->getAuth())				// checking for autenticated user  { 	echo "Hello $a->username welcome to my secret page"; 	 };  ?>
Who's Online
Guest Users: 7
Google
Web
WeberTrivia
WeberDev
WeberForums
 Free Sample Chapters  Free Sample Chapters
  Deliver First Class Web Sites: 101 Essential Checklists
Want to learn how to make your web sites usable and accessible? Want to ensure that your sites meet current best practice, without spending hours trawling through incomprehensible specifications and recommendations from dozens of different books, research papers, and web sites? Want to make sure that the sites you build are "right the first time," requiring no costly redevelopments?

More Sample Chapters

PHP General