Re: Auth not working properly when loading new page, and you need to be authed

From: Date: Wed, 22 Jun 2005 07:09:27 +0000
Subject: Re: Auth not working properly when loading new page, and you need to be authed
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19720@lists.php.net to get a copy of this message
Justin Patrin wrote:
On 6/19/05, Torbjørn Amundsen <torbjoam@stud.ntnu.no> wrote:
Hi! Im using AUTH 2.1.3 DB 1.7.5 PEAR 1.3.5. I have this odd problem which I cant identify. Everything is working fine except for one thing. Im using two frames (yes, I too dont like frames, but...). In one of the them there are links that show up only when $session->getAuth() is true. I login, the links show up, but when I click the links to load a page into the other frame (which checks if you are logged in), I only get the internal login again. Then if I reload page, and click the link again, everything is fine. Does anyone know what causes this? I tried to look at earlier posts, but I couldnt find anything similar. Please help me as Ive been stuck with this problem for a couple of weeks... :-\
I suggest: If the user is not authed, redirect to a non-frames login page. Then upon login redirect back to the frames.
Can't do that. The problem is there because the user is authed, but it seems the system is not picking it up. Im using an ordinary login like this: function loginFunction() {
     /**
      * Change the HTML output so that it fits to your
      * application.
      */
     print "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">";
print "Username:";
     print "<input type=\"text\" name=\"username\">";
     print "Password:";
print "<input type=\"password\" name=\"password\">";
     print "<input type=\"submit\" value='Log in'>";
     print "</form><br>";
	 print "If you are not registered, please do so <a href='register.php' target='mainFrame' >here. </a>\n";
} $dsn = "mysql://torbjoam_master:Reiki1602@mysql.stud.ntnu.no/torbjoam_master_email"; $a = new Auth("DB", $dsn, "loginFunction"); $a->start(); Then I check on an another page loaded in another frame if $a->getAuth() (tried with checkAuth also), which is false. Not until I reload, this turns true, and I cant figure out why this is. My best guess is that the session data does not reach the frame in question, but I have no idea as to how to correct it. :-( TØA

« previous php.pear.general (#19720) next »