Page 1 of 1

Sessions n Cookies problem

Posted: Mon Dec 13, 2010 2:51 am
by saily
I want to use session variables to import objects from one page to another. i have successfully done this doing the following file1: insert.php

Code: Select all

<?
session_start();
$sam = "something";
$_SESSION['sam'] = $sam;
?>
file2: select.php

Code: Select all

<?
session_start();
$sam = $_SESSION['sam'];
But when i disable cookies, it doesn't work at all...i am wondering how to do i fix this problem?

Re: Sessions n Cookies problem

Posted: Mon Dec 13, 2010 3:53 am
by Apollo
A user's session ID is usually stored (and thus passed on to the next page) in a cookie. So if you disable that, it doesn't work anymore :)

You can put the session ID in the url (see also the session.use_cookies and session.use_only_cookies settings), which will add a &sid=xxxx param to your URLs. Or invent your own way of saving session IDs :)

Then again, why would you disable cookies. It's completely normal for a website to require cookie support, at least any site that offers user settings or exchanges info between pages.