You are here: PHPSESSID problem « PHP Programming Language « IT news, forums, messages
PHPSESSID problem

Posted by nigel.t on 10/09/06 16:29

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?

thanks.

nigel.

 

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

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