|
Posted by amygdala on 08/13/07 10:33
Rik wrote:
> On Mon, 13 Aug 2007 11:53:58 +0200, amygdala <noreply@noreply.com>
> wrote:
>>>> This thing still has me puzzled. What I did is the following:
>>>>
>>>> My SessionHandler class has the following method:
>>>>
>>>> public function redirect( $url )
>>>> {
>>>> session_write_close();
>>>> header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
>>>> header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT'
>>>> ); header( 'Cache-Control: no-store, no-cache, must-revalidate'
>>>> ); header( 'Cache-Control: post-check=0, pre-check=0', false );
>>>> header( 'Pragma: no-cache' );
>>>> header( 'HTTP/1.0 302 Moved Temporarily' );
>>>> header( 'Location: ' . $url );
>>>> // this part between the comments is important
>>>> echo 'You\'re being redirected to ' . $url . ' .
>>>> Click <a href="' . $url. '">here</a> if it doesn\'t work';
>>>> // end important part
>>>> exit(); // exit doesn't really make a difference for Opera
>>>> }
>>>>
>>>> Since I have now included the exit() statement I am sure that this
>>>> is the last thing done by the application when redirecting. Also, I
>>>> have added cache control headers and the likes. But still in Opera
>>>> the problem persists
>>>> if I leave out the echo part you see above between the comments.
>>>
>>> Can you set this up somewhere accessable? I'm curious what happens
>>> if I try it in Opera here. Never gave me problems before.
>>
>> I've set up little example (without the echo part in the redirect
>> method) which you should be able to access temporarily through:
>>
>> http://amygdala.kicks-ass.net/profile/
>>
>> (Please let me know if you are not able to access it.)
>
> HTTP/1.x 302 Moved Temporarily
> ...
> Set-Cookie: PHPSESSID=jhiktdcd4efk720iqahhhquokhm24ill; path=/
> Set-Cookie: PHPSESSID=upgdihd7gbiqnen492advkiu0c0piv4v; path=/
> Location: http://127.0.0.1/user/login/
> ...
>
> I haven't set up your site on my local box, so no, it's not working
> :).
Errrr, sorry about that Rik, forgot to change
define( 'ROOT_PATH', 'http://' . $_SERVER['SERVER_NAME'] );
to
define( 'ROOT_PATH', 'http://amygdala.kicks-ass.net' );
>> If all goes well, this will automatically redirect you to the login
>> page.
>
> OK, on another domain perhaps, so that might get some freaky results
> in cookies/sessions. When I manually go to
> http://amygdala.kicks-ass.net/user/login/ I can see the form, and when
> logging in I'm again redirected to 127.0.0.1 (/profile/view/), which
> is offcourse not found. So, manually going to
> http://amygdala.kicks-ass.net/profile/view/, I get redirected without
> a hitch to http://amygdala.kicks-ass.net/profile/view/demo, and I see
> a var_dump of a User object, seems OK to me.
But then this should be OK indeed.
> Redirecting seems fine here (Opera 9.23), only to the wrong domain...
> I offcourse continuously get the 'page not found' for the 127.0.0.1
> redirects, but I am redirected nonetheless. What if you use the
> $_SERVER['HTTP_HOST'] in the url to which you redirect?
>
>> Bedankt alvast! (Thank you in advance)
>
> Geen probleem :-)
Thanks again!
[Back to original message]
|