Date: 07/13/01
- Next message: Richard Archer: "Re: [phplib] HTML::Template"
- Previous message: Tarique Sani
email protected>>: "Re: [phplib] HTML::Template" - In reply to: Cresta Johnson: "Re: [phplib] login page help"
- Next in thread: giancarlo pinerolo: "Re: [phplib] login page help SIMPLE!"
- Reply: giancarlo pinerolo: "Re: [phplib] login page help SIMPLE!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>
> Hacking is good when you don't have the functionality in the class. In fact
> it is a necessity. But when the functionality is already there, it seems to
> me, just lazy.
I don't like using preauth, because I loose all the buolt in permission
'authentication_scheme' (admin etc, great stuff),
and when I install a package that uses phplib I'm stuck
Here is the code I finally sorted out
Index page:
.....
<?
page_open(array("sess" => "Example_Session",
"auth" => "Example_Default_Auth", // default authentication, no login
required
"perm" => "Example_Perm", "user" => "Example_User"));
$sess->register("dologin"); //say to welcome we want to login
$dologin=true;
?>
<FORM action="welcome.php" method=post>
Login
<INPUT name=username size=10 value="">
Password
<INPUT name=password type=password size=10 value="">
<INPUT type=submit value="login"><BR>
</FORM>
<?
page_close();
?>
....
welcome page:
<?
page_open(array("sess" => "Example_Session",
"auth" => "Example_Default_Auth", // you need this
"perm" => "Example_Perm", "user" => "Example_User"));
if (isset($dologin) && $auth->auth["uid"]=="nobody") // have we been
asked a login?
{
if ($auth->auth_validatelogin()) // were the provided $username and
$password correct?
// watch! some versions of local.inc return true
also for nobody
{
$sess->unregister("dologin"); // you're OK, next time pass
through
page_close();
header("Location: ". $sess->url($PHP_SELF)); // come back here
now
}
else // provided $username and $password are not OK
{
$auth->auth_loginform(); // enter the normal authentication
(show a register form
exit;
}
}
else // dologin not set
{
$auth->mode="reg"; // show a register form
$auth->login_if("doit"); // enter the normal authentication (show a
register form
}
?>
WELCOME USER
<?
page_close();
?>
-- Abbestellen mit Mail an: phplib-unsubscribe <email protected> Kommandoliste mit Mail an: phplib-help <email protected>
- Next message: Richard Archer: "Re: [phplib] HTML::Template"
- Previous message: Tarique Sani
email protected>>: "Re: [phplib] HTML::Template" - In reply to: Cresta Johnson: "Re: [phplib] login page help"
- Next in thread: giancarlo pinerolo: "Re: [phplib] login page help SIMPLE!"
- Reply: giancarlo pinerolo: "Re: [phplib] login page help SIMPLE!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

