Auth documentation

From: Date: Tue, 28 Jan 2003 18:19:17 +0000
Subject: Auth documentation
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-320@lists.php.net to get a copy of this message
I love pear -- it's great and fits my needs nicely. Pear and the Auth class were crucial to my convincing management to move to PHP from ColdFusion on several projects! Thanks! I have a few suggestions for the Auth docs: 1) Add a description of getUsername() such as Auth::getUsername string getUsername() This function returns the name of the user that logged in. This value will match the username entered when the user logged in. 2) Add a description of logout() such as: Auth::logout void logout() This function logs the user out and removes the session variable. After calling this function, the user would have to log back in to re-authenticate. 3) Mention what should be called before Auth::start(), such as setSessionname. For example: $a->setSessionname("MYAUTH"); $a->start(); 4) Mention that the Auth::start call has to occur PRIOR to any other HTML headers. For
     example:
$a->start(); echo "<HTML><HEAD><TITLE>My Title</TITLE></HEAD>"; ...etc.... 5) Add an example of a login page and an application page. Add a redirect on the application
     page back to the login page.  For example:
login_page.php: -- sample login page based on current examples app_page.php: <?php function Redirect($url) { Header ("HTTP 302 Redirect'); Header ('Location:'.$url); exit; } function LoginFunction() {
        Redirect("login_page.php");
} require_once "Auth/Auth.php"; $parms=""; $a=new Auth("DB", $parms, "loginFunction"); $a->setSessionname("MYAUTH"); $a->start(); if ($a->getAuth()) { echo "<HTML><HEAD><TITLE>App Page</TITLE></HEAD>"; echo "<BODY><H1 User ".$a->getUsername()." is logged in</BODY></HTML>"; } else { Redirect("login_page.php"); } NOTE, THIS WAS COPIED FROM MY CODE AND NOT YET TESTED. 6) Add a recommended practices page for use of this class???? This is
     a very important function for many apps hence some guidance might
     be useful.....
Hope this helps, -- Wade Hampton

« previous php.pear.doc (#320) next »