You are here: Re: sessions and domain names « PHP Programming Language « IT news, forums, messages
Re: sessions and domain names

Posted by Tom on 11/04/06 17:22

I confess I wasn't aware of this problem, but I've never encountered
it. In addition to configuring your server to redirect to one or the
other, you could also try this:

I define the base url as a constant at the beginning of my scripts:

define('MY_BASE_URL', 'http://www.mydomain.com/');

or, if you want to get more dynamic:

define('MY_BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/');

Then whenever you include a link on your page, just use:

<?php echo MY_BASE_URL . 'path/to/file.php'; ?>

Tom



On Oct 26, 4:27 pm, "magic_hat60622" <magic_hat60...@yahoo.com> wrote:
> Hi all. I've got an app that dumps a user id into a session after
> successful login. the login page ishttp://www.mydomain.com/login.php.
>
> If the user visits pages on my site without the www (i.e.,http://mydomain.com/foo.php), the session works fine and login state is
> maintained.
>
> If he visitshttp://www.mydomain.com/foo.php, the app drops the
> logged-in state.
>
> Any idea how to fix this? I'm running php 4.4.1 w/ linux apache.

 

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

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