Re: More on Auth problem
| From: | jsWalter | Date: | Sat, 08 May 2004 01:49:17 +0000 |
| Subject: | Re: More on Auth problem | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12358@lists.php.net to get a copy of this message | ||
"Alexander Payne" <apayne1@umbc.edu> wrote in message
news:B2A208E6-7292-11D8-9D0F-000393956FD8@umbc.edu...
> Thanks very much for your reply. I will look into output buffering; I
> think I can accomplish what I desire with that technique.
>
> However, I find it very odd that the PEAR developers would create a
> function that effectively requires you to send an HTML form before the
> opening HTML tag of your site, unless I am misunderstanding something.
> Calling auth->start() at the top of my script draws the login form,
> then sends the rest of the page's HTML. Most browsers can render this,
> of course, but having HTML elements that should be in the BODY tag at
> the top of the file is seriously malformed.
>
> Am I incorrect in the method by which I am calling auth->start()? Is
> there some way to get Auth to generate a cookie first and draw its
> login box later?
Yes, at least for me.
I have a INCLUDE file called [auth_setup.inc.php]
This file setup all it needs to use Auth.
// Call DB Class Libraries and parameters
require_once("db_access.inc.php");
// Call Authentiction Class Libraries
require_once("Auth.php");
// Parameters for DB access in Auth
// $dsn and $db_table are defined in the DB access INC file
// NOTE: This uses the new DB container by Mattias Guns
// It accepts a DB Object now, instead opening the DB itself!
$params = array( "DB" => &$objDB,
"table" => $db_table,
"usernamecol" => "username",
"passwordcol" => "password",
"db_fields" => array('*')
);
// A database is used as storage container in this example
$objAuth = &new Auth("DB", $params, 'login');
Then I define the login function that is used to display the login form...
function login()
{
// nothing
}
:)
Now my login.php displays the login form when and where I want.
This works for me.
Walter