note 80828 rejected from ref.session by james
| From: | james@php.net | Date: | Sat, 02 Feb 2008 07:37:32 +0000 |
| Subject: | note 80828 rejected from ref.session by james | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-135724@lists.php.net to get a copy of this message | ||
Note Submitter: webm dot blessedwithoutlimits dot com
----
Please help me figure out why I can't get cookies set up.
I recently changed my site to use sessions stored in a database. BTW, I'm on a shared server
running PHP Version: 4.4.7 and MySQL Version: 5.0.30.
I made the following changes; session.use_cookies: On
session.use_only_cookies: On
session.use_trans_sid: Off
Now. I observed the following.
Firstly, session id is recreated everytime I visit the page which has session_start(). Secondly, the
session is only valid in the current page. Subsquent page calls (URLing to another page) cannot see
the session variables set earlier.
- For a minute I accepted that I can live with that but then - it's back to the drawing board.
Finally, the main problem. No Cookies are being created.
I tried:
session_start();
setcookie("suidone","value00");
echo "ck1:" . $_COOKIE['suidone'];
$lifetime = time() + 1440;
setcookie("suidtwo", session_id(),
$lifetime,"/","blessedwithoutlimits.com");
if (isset($suid))
echo "ck2:" . $_COOKIE['suidtwo'];
None of these creates a cookie. (Checked using Firefox, Tools->Show Cookies)
Attempts: I have googled on this for 48+ hours and tried several solutions to no avail. Tried
.htacess too. session.cookie_path and the like.
Please advise where I might be going wrong with the whole thing of saving session data in a
database then use the "one" cookie (preserved session id) to ID the remote user during the
session.
I would also appreciate if someone can 'clickpoint' me to the right material/place to find
help.
Many thanks in advance.