oceans Posted July 10, 2007 Share Posted July 10, 2007 Friends, Has any one encountered the following problem: When I open two or more IE windows on the same computer, both the IE windows are NOT starting different session files at my server, the first one starts a file and all uses the same file! Is this normal? I understand that each client should open a unique file right! Even if all the clients are coming from the same PC? I don’t do any thing special, I just simply declare like the following: <?php ob_start(); session_start(); $_SESSION['SessionVariable01']=0; ?> Got I got to do any setup at my server? Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 10, 2007 Share Posted July 10, 2007 This Problem is with IE 7 and Mozilla. Right ? Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 one sec how do I check ver of my ie? Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 yes here is ie 7 Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 Jitesh, Is it a IE problem? Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 10, 2007 Share Posted July 10, 2007 This is the default behavior of the IE 7 and Mozilla. This is better for you to accept it. The solution is when you first time start session you need to dynamic create and pass session id each time and need to pass session id at each pages and use it to continue with session. The solution is very crucial. Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 I am open, I am willing to handle it myself I do not know If I would have talked to you earlier on this. Can you please advice the following: The maxlength for session file name. I will create random alphanumeric and name the file, then use the file, but the problem is how would I know if the random named file is already in use? Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 10, 2007 Share Posted July 10, 2007 At first make empty session direcoroty Then when you create session id follow this $session_id = md5('projectname_'.time()); session_id($session_id); session_start(); Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 As normal I have 1 start page and all links. thus am I right to say the following goes to the first page $session_id = md5('projectname_'.time()); session_id($session_id); session_start(); the following goes to all the session involved pages session_start(); Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 I wish to replace "projectname_" with some run time random alphanumeric to make it little more robust it is OK? by the way i noted the used sessions files are littered in the session folder, it is the server's job to clear after timeout or is it my job to clear using my php code? Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 Jitesh is OFFLINE, Can any one help, thanks... Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 10, 2007 Share Posted July 10, 2007 Internet was down ------------------- (1) Suppose you are first time starting a session file : page1.php $session_id = md5('projectname_'.time()); // when you come to this page in IE 7 and mozilla session id will be diff so session will be different session_id($session_id); session_start(); (2) Now you are redirecting from page1.php to page2.php location('header:page2.php?session_id?session_id='.$session_id); // I mean you need to pass session id every where (keep in mind this must be in query. do not send in hidden variable) At page2.php start session like this. session_id($_REQUEST['session_id']); // You are using a session which is created at page1.php session_start(); Now i think you will got. what i am saying to do. Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 Jitesh, I tried your method. (1) Index.php $session_id = md5('projectname_'.time()); session_id($session_id); session_start(); (2) All other page session_start(); It works well, I do not know is it reliable as I have not done your latest instruction. But in accordence with your latest instructions I have one concern, if I walk from page to page using PHP I can do your instruction what if I walk from page to page via html hyperlink. In my case yes I do both. Please advice, one interesting thing with I used php 4 i did not have this problem, I tried with yahoo, same set of codes. Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 10, 2007 Share Posted July 10, 2007 I do not think this is related to PHP Version. Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 I am putting in your new instructions Is it " location('header:page2.php?session_id?session_id='.$session_id); " or " header('location: page2.php?session_id='.$session_id); " Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 10, 2007 Share Posted July 10, 2007 It is better to accept default behaviour of browsers. But still you want to implement then it is ok. By the way i have implemented as a same way i have described in my last project. because it was client requirement. Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 Jitesh, I have some problem, this is what I did for sending session id to next page(s), I have a chain of page which requires input from previous. header('location: PageX.php?session_id='.$session_id); in the next page header $session_id = session_id($_REQUEST['session_id']); then body header('location: PageX.php?session_id='.$session_id); somthing is wrong can you help. Yes, I want to implement Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 10, 2007 Share Posted July 10, 2007 next to next page you will get sesssion id through request $_REQUEST['sesson_id']; So make header('location: PageX.php?session_id='.$_REQUEST['sesson_id']); or header('location: PageX.php?session_id='.session_id()); -------------------------------------------------------------- better advide make header('location: PageX.php?session_id='.session_id()); every where in anchor tag like this <a src="test.php?session_id=<?php echo session_id();?>"> because session_id() is PHP API to either set session id or retrive set session id. Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 Jitesh, Thanks for being with me I have 5 pages, Page 1 in header $session_id = md5(time()); session_id($session_id); session_start(); Page 1 in body header('location: Page2.php?session_id='.$session_id); Page 2 in header session_id($_REQUEST['session_id']); session_start(); Page 2 in body header('location: Page3.php?session_id='.$session_id); . Page 3 in header session_id($_REQUEST['session_id']); session_start(); Page 3 in body header('location: Page4.php?session_id='.$session_id); Page 1 ok, page 2 ok, but in page 3, I get the following: " Warning: session_start() [function.session-start]: The session id contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in C:\wamp\www\Page3.php on line 4 " line 4 is "session_start();" I also noted that one new session file is being created as i walk from page 1 to 3 Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 10, 2007 Share Posted July 10, 2007 change to this in header call header('location: Page2.php?session_id='.session_id()); header('location: Page3.php?session_id='.session_id()); header('location: Page4.php?session_id='.session_id()); header('location: Page5.php?session_id='.session_id()); .......................................... Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 Jitesh, I am trying. Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 I don't know why I am using exectly the same code for all page, but i can transfer data from page 1 to page 2, but not from page from 2 to page 3... Quote Link to comment Share on other sites More sharing options...
oceans Posted July 10, 2007 Author Share Posted July 10, 2007 Can any one help me, I AM GOING MAD!!!!!!! Please help. I can't understand why..... ??? :'( " ob_start(); session_id($_REQUEST['session_id']); session_start(); " when I echo later in the body I get different number!!!!!!!!!! Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 11, 2007 Share Posted July 11, 2007 Attach your coding files. Want to see where are you doing wrong. Quote Link to comment Share on other sites More sharing options...
oceans Posted July 11, 2007 Author Share Posted July 11, 2007 Jitesh, I solved, I got the problem when I posted a form, thanks for your warm help!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.