PDA

View Full Version : PHPLIB: Auth / Default_Auth sessions


arahn
02-25-2000, 08:47 PM
ˇHola!
I want some "hard authed" pages on my site and some "soft authed" in which any user can enter and browse, beeing default logged as "nobody". I'm using PHPLIB. All the classes are expanded and ready. auth class is expanded to a default_auth class in where nobody=true. The cookie is programmed to last for a month.
Then, in the soft-authed pages i put:

[nbsp][nbsp] page_open(array("sess" => "xfreefriends_Session",
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp] "auth" => "xfreefriends_Default_Auth"));

Then, in the hard-authed page(s) i put:

page_open(array("sess" => "xfreefriends_Session",
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]"auth" => "xfreefriends_Auth"));
$auth->login_if($auth->auth["uid"] == "nobody");

The front page uses soft-auth. So, when a user enters it must remember if the user is logged in or it's in as nobody. In the first case, it must show a greeting for the user and hide the "subscribe" option from the top menu bar.
Then, in the second case, it would not show any greeting, and give the option to subscribe on the menu.

It works when the user logs on and then returns to the f.p., but if the user closes the broswer and returns, again the system doesn't remember which user it is and shows the menu bar for the unlogged user...

In resume --- despite all the bloat of explanations i've done so far: Which is the mechanism for implementing such a policy of access? How it's done?

TYA
Alfredo

arahn
02-25-2000, 09:15 PM
ˇHola de Nuevo!
I forgot to tell: When I autenthicate using full auth (not nobody) and return to any page that uses the soft-auth, it crawls with:

Fatal error: Can't redeclare already declared function in /xfreefriends/www/lib.inc.php3 on line 12

The first part of index.php3, for example goes:

<? require(&quot;dbconnect.inc.php3&quot;); # creates pconnect to
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp] # mysql - not using phplib
[nbsp][nbsp] require(&quot;includes/imprimirFechaSinYear.inc.php3&quot;);
[nbsp][nbsp][nbsp][nbsp]# for printting dates
[nbsp][nbsp] require(&quot;lib.inc.php3&quot;); # this is the kid
[nbsp][nbsp] include(&quot;ffprepend.php3&quot;); # the prepend file
[nbsp][nbsp] page_open(array(&quot;sess&quot; => &quot;xfreefriends_Session&quot;,
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp] &quot;auth&quot; => &quot;xfreefriends_Default_Auth&quot;));
[nbsp][nbsp] require(&quot;includes/postales.common.inc.php3&quot;); # common
[nbsp][nbsp][nbsp][nbsp] # files to my app
[nbsp][nbsp] ImprimeEncabezado(); # prints the header
?>

OTOH, there is no redeclaration of functions, but it seem that it's parsing lib.inc.php3 more than once. Include instead of require doesn't solve the problem neither.

żAny suggestions?

arahn
02-25-2000, 09:42 PM
ˇIt's me de nuevo!
I suppressed the line:
$auth->login_if($auth->auth[&quot;uid&quot;] == &quot;nobody&quot;);

From the hard-authed page (the page i want to requiere other user than nobody, thus login request via form if needed). Now the sys behaves a little better, but it enters the user panel as nobody, thus it doesn't requiere effective authentication as a registered user for that zona.

How could I implement a login page like yahoo! where you are sent to a login cgi which then redirects you to the protected page? How can I do it using phplib?

Any sugs?

[This message has been edited by arahn (edited 02-25-00@8:44 pm)]

heath
02-26-2000, 11:20 PM
Auto-auth. using the nobody scheme is tricky ijn phpLIB, and the manual sez it can get kind of goofy if you want to later have the user login for real.

I would recommend searching the phplib mailing list at geocrawler.com -- there is some decent info there, but a lot of is just &quot;read the docs&quot; which doesn't help much since the documentation might be the worst I've ever seen, for any piece of software.

I would also recommend using the defualt classes they have set up, and once you have the functionality you want working with their classes to extend your own.

Hope this helps.

Heath