Re: [PHP] Newbie - Can't get sessions to work
I've tried the suggested code changes and no difference :( I just don't think sessions are working for me at all. I said in my original posting that the second page was creating an empty file in my session.save_path directory as though the second page has no reference to the first one. In my save_path directory I have the following files: sess_8e603c46412d9c4dd3fa6bf3d98c100f0 KB File23/10/2003 10:37 sess_f548763ea84f7d812539720142ac6efe1 KB File23/10/2003 10:37 The top one presumably created by page 2 is empty and the bottom one contains foo|s:5:Hello;bar|s:5:World; I don't know how sessions work in php and whether they use cookies or not but it seems to me that the session_start() on page 2 is creating a new session instead of referring to the current one. Jason how do I check for those settings? I see nothing in php.ini that refers to transparent sessions and I believe my browser is accepting cookies. Could it be an Apache configuration issue? I thought sessions were maintained on the server somehow. Thanks Shaun Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wednesday 22 October 2003 22:08, Shaun Campbell wrote: I've got a problem getting sessions to work and I wondered if anyone could offer any advice. The example I am using is to get one page to set variables in a session and then use another page to retrieve them. I am using 4.3.4RC2 and prior to that 4.3..3 on Win2k with IE6 and Apache 1.3.22. The code is: [snip] Code looks OK. One explanation: you have not enabled transparent sessions, and your browser is not accepting cookies. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Sturgeon's Law: 90% of everything is crud. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie - Can't get sessions to work
That's it. Setting use_trans_sid to 1 got sessions working. I'm now getting PHPSESSID=7398a182a64f0b2603e369812e130727 appended to the end of the page2.php URL and only one session file in my temp directory. One final question. In the php.ini file it says that Use of trans sid may risk your users security. ; Use this option with caution. If you don't use this option because of the security impications how else should you get sessions working? Thanks Shaun PS Marek I'd forgotten but I'd got cookies working yesterday using the code you suggested. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie - Can't get sessions to work
I've got a problem getting sessions to work and I wondered if anyone could offer any advice. The example I am using is to get one page to set variables in a session and then use another page to retrieve them. I am using 4.3.4RC2 and prior to that 4.3..3 on Win2k with IE6 and Apache 1.3.22. The code is: page1.php -- ?php session_start(); $_SESSION['foo'] = 'Hello'; $_SESSION['bar'] = 'World'; ? HTML HEAD TITLE /TITLE /HEAD BODY Variables set in session - hopefully??? ?php echo foo = {$_SESSION['foo']}BR; echo bar = {$_SESSION['bar']}; ? form action=page2.php method=post input type=submit name=submit value=Page 2 / /form /BODY /HTML page2.php -- ?php session_start(); echo foo = {$_SESSION['foo']}; echo bar = {$_SESSION['bar']}; ? On page 1 I am seeing the session variables displayed correctly i.e. Hello World and I can see a session file created in my temp directory with the correct values in there. However, when I display page 2 the variables are always displayed blank and what seems to happen is that a new empty session file is created in my temp directory. It's as though the second page is not related to the same session somehow. I've also tried lots of other examples from books and on the net and I still can't get sessions to work. Am I doing something wrong in connecting the two pages although I don't close the browser down at all between the two? Any ideas would be greatly appreciated. Thanks Shaun Campbell -- Shaun Campbell IT Consultant apps2net Tel: 07900 911072 Email: [EMAIL PROTECTED] Web: www.apps2net.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php