You are here: Re: sessions and redirecting in opera « PHP Programming Language « IT news, forums, messages
Re: sessions and redirecting in opera

Posted by Rik on 08/13/07 10:12

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=3D0, pre-check=3D0', 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=3D"' . $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 meth=
od)
> 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=3Djhiktdcd4efk720iqahhhquokhm24ill; path=3D/
Set-Cookie: PHPSESSID=3Dupgdihd7gbiqnen492advkiu0c0piv4v; path=3D/
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 :).

> If all goes well, this will automatically redirect you to the login pa=
ge.

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.

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 :-)
-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация