How does login form work in Auth?
| From: | edmahoney at infortegroup dot com | Date: | Thu, 11 Aug 2005 23:05:08 +0000 |
| Subject: | How does login form work in Auth? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-20385@lists.php.net to get a copy of this message | ||
In the introduction to Auth, the example below uses a simple login form
that posts a username and password to the same page. What function
receives this post? I can't find it documented anywhere. Does start() or
checkAuth() somehow receive these posted variables? The documentation for
the constructor says it merely displays the loginFunction form. Somebody
must be handling it somewhere?
Thanks,
Ed
function loginFunction()
{
/*
* Change the HTML output so that it fits to your
* application.
*/
echo "<form method=\"post\" action=\"test.php\">";
echo "<input type=\"text\" name=\"username\">";
echo "<input type=\"password\" name=\"password\">";
echo "<input type=\"submit\">";
echo "</form>";
}
$dsn = "mysql://user:password@localhost/database";
$a = new Auth("DB", $dsn, "loginFunction");
$a->start();
if ($a->checkAuth()) {
/*
* The output of your site goes here.
*/
}