RE: [PEAR] How does login form work in Auth?
| From: | Rob Agar | Date: | Fri, 12 Aug 2005 00:21:10 +0000 |
| Subject: | RE: [PEAR] How does login form work in Auth? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20386@lists.php.net to get a copy of this message | ||
hi Ed
the POSTed values are caught by assignData(), which is called by
start(). They are processed in login() if the user is not already logged
in. The POST variable names are hard coded to 'username' and 'password',
it seems.
(from my limited experience of Auth - used it in anger for the first
time this week :)
hth,
Rob
> -----Original Message-----
> From: edmahoney@infortegroup.com [mailto:edmahoney@infortegroup.com]
> Sent: Friday, 12 August 2005 9:05 AM
> To: pear-general@lists.php.net
> Subject: [PEAR] How does login form work in Auth?
>
>
> 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.
> */
> }
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>