Date: 04/03/01
- Next message: Enrique Motilla: "Re: [phplib] mssql_affected_rows()"
- Previous message: fabrizio.ermini <email protected>: "Re: [phplib] phplib & portals"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3 Apr 2001, at 2:19, Fernando Nunes wrote:
> Yep, you are on the right track. My portal shows DB information to
> registered and unregistered users and I would like it to have a DIV or
> whatever zone so that the user can be recognized and I could give, for
> example, theme support for the very same page we was on before logging
> in.
> The php file is the same, this is, the autentication detection has to
> be included in every other new pages like it is in on main. I was
> pointing to a include "auth.php" with the necessary code to generate
> the diff, but then I looked further and I didn't realize how could I do
> this, because page_open should be diferent (or shouldn't???) if the
> user is autenticated or not. If it isn't the form would show.
>
No, the page_open command would be the same. You have to play
yourself with the appropriate auth methods to do what you want.
If you wish to just differentiate between registered and not
registered, forget the Preauth, you don't need it.
You should do something like this:
(warning, this is very made-up code - it may need several
correction!)
<?
page_open(array("sess" => "Session",
"auth" => "Default_Auth",
"perm" => "Prm",
"user" => "User"));
/* if the user have requested the login and is corrently under
"default", call the login form */
$auth->login_if($requ_login && auth["user"]!="nobody");
/* check if the user ha registered or not */
if ($auth["user"]=="nobody")
{
...do the part for unregistered users...
This part should include a "button" called "login" with
the following action:
<a href="<? $sess->purl("$PHP_SELF?requ_login=1")
?>">LOGIN</a>
}
else // do the part for registered users
{
....
}
I think this could be the easiest way. If you wish, take a look at
"www.polnet.it"; the "lock" button works almost precisely this way.
If you want to avoid the loginform altogether, and put it directly in
the page, you have to do a little more work. Put a piece of code at
the start of the page that does:
-check if we have a couple of pass+user (that means we are being
called by a login form
- if user="nobody", call manually auth::validate_login, else do
nothing (why authenticate 2 times? ;-))
- check the status of auth["user"] to see if login was succesful
...
then you can proceed as above...
HTH!!!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Fabrizio Ermini Alternate E-mail:
C.so Umberto, 7 faermini <email protected>
loc. Meleto Valdarno Mail on GSM: (keep it short!)
52020 Cavriglia (AR) faermini <email protected>
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Enrique Motilla: "Re: [phplib] mssql_affected_rows()"
- Previous message: fabrizio.ermini <email protected>: "Re: [phplib] phplib & portals"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

