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/10/07 16:45

On Fri, 10 Aug 2007 18:10:24 +0200, Scott Bryce <sbryce@scottbryce.com>
wrote:
>> My application examins $_SERVER[ 'REQUEST_URI' ] to determine which
>> page to serve.
>
> Why?

Standard practice: single 'point-of-entry' website, serving up pages as
requested in the url. Saves a whole lot of code duplication, allthough it
might decrease performance. Look at it like an index file in the root
examing GET variables and serving up different pages according to the
given values. Only, for more easily remembered urls for humans, and the
kind of urls search-engines like, the url contains a pseudo-path: the
actual path does not exists, but is handled by a script which might be
anywhere.

> If you have stored the URL of the page you want to go to in a cookie,
> you should be looking for which page to serve in that cookie.

Never store that kind of a thing in a cookie. Use a session and just a
session cookie, store data in the server-side session.

> Or are you examining $_SERVER[ 'REQUEST_URI' ] to determine what URL to
> store in the cookie? Again, why? If I have a PHP script at
> example.com/user/login, why doesn't that script know its own URL?

Because the script might not be there? It's just a script, where the
request finally ends up being processed can have very little to do with
the requested URL.

> I may be way off base here, but your approach seems odd to me.

More a difference in approach, but a very normal one.
--
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

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