Reply to Re: PHPSESSID problem

Your name:

Reply:


Posted by nigel.t on 10/10/06 11:22

In article <egepup$ju1$1@emma.aioe.org>, submit@flexiwebhost.com says...
>
> <nigel.t@by.uk> wrote in message
> news:MPG.1f9489496079c6d5989907@news-text.blueyonder.co.uk...
> >I have a page that contains just
> >
> > <?php
> > session_start();
> > $_SESSION['test'] = 'HELLO';
> > $host = $_SERVER['HTTP_HOST'];
> > $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
> > $extra = '../listings/store.php';
> > header("Location: http://$host$uri/$extra");
> > exit;
> > ?>
> >
> > store.php would then start with:
> >
> > <?php
> > session_start();
> > echo($_SESSION['test']);
> > // and so on
> > ?>
> >
> >
> > The purpose of the page is just to do a re-direct but is needed.
> >
> > The problem I have is this:
> >
> > If a user comes to my site with: www.mysite.com and then visits
> > the above re-direct script/page all is well and the page store.php can do
> >
> > echo($_SESSION['test']); and get HELLO out.
> >
> > BUT
> >
> > If the user comes to the site with just mysite.com
> > PHP sets TWO PHPSESSID cookies : one for mysite.com and another for
> > www.mysite.com
> >
> > This causes the $_SESSION['test'] variable to be lost.
> >
> > Hard coding the re-direct page can't cure this for me.
> >
> > Can anyone shed any light or help me prevent the second PHPSESSID from
> > losing the variable please?
> >
>
> You could always use a htaccess redirect to ensure that people who came to
> yoursite.com would be redirected to www.yoursite.com
>

Thanks for the idea peter but that doesn't do it I'm afraid as I'd need
the redirect everywhere on the site.

This is turning into a worrying problem here. Fortunately we havn't
implemented passwords with PHP sessions! That would have been a disaster.

nigel.

[Back to original 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

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