oceans Posted June 5, 2007 Author Share Posted June 5, 2007 extract 1401view.php <?php ob_start(); // If session is set then use previous set session by old session id otherwise start new session $this_is_set_session_id = isset($_GET['session_id'])?$_GET['session_id']:""; session_id($this_is_set_session_id); session_start(); $NumberOfSessionVariables=10; for ($i=1; $i<=$NumberOfSessionVariables; $i++) { $_SESSION['14ForView'.$i]=0; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> extract file before 1401view typical home page with only <href>, one of the <herf> will bring me to 1401view.php file where you have first time set session in our example 1401view, but as i mentioned i will be setting 5 sets independently. my ORIGINAL arrangement works fine, no conflict with any page, but the only problem same PC same session file. if I can get same pc different client = different session file, bingo i am fine... I placed your " <?php ob_start(); session_start(); // when first time set session $this_is_set_session_id = session_id(); header('location:112/Home.php?session_id='.$this_is_set_session_id); ?> " in the index.php Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268188 Share on other sites More sharing options...
oceans Posted June 5, 2007 Author Share Posted June 5, 2007 Dear Jitesh, I know you are trying hard, thanks friends really, i am in a state of shock! this is what i discovered after developing 90% of my work. I have read each session will have different file so i built arroud it, but now it is scarry. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268197 Share on other sites More sharing options...
oceans Posted June 5, 2007 Author Share Posted June 5, 2007 Dear Friends, I have a Grave problem please help! When two or more client programs are open from the SAME computer, there are NO multiple session files but only one, thus the server uses the same data set from a single session file for all the client programs from the SAME computer, this is disaster! How can I overcome, please? The above story about this, but I still can't get over. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268231 Share on other sites More sharing options...
jitesh Posted June 5, 2007 Share Posted June 5, 2007 Now Try this (1) For each category start session. (2) When First time session start for each category save session id in different cookie (1 cookie for 1 category) (3) The cookie name may be like this $_COOKIE[projecttitle_categoryname_sessionid] (4) Now for pages for different categories when you are writting session_start(); mention session_id($_COOKIE[projecttitle_categoryname_sessionid]); before. (5) Use session cookie (must not a persistent cookie). Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268234 Share on other sites More sharing options...
oceans Posted June 5, 2007 Author Share Posted June 5, 2007 Thanks, I thought I lost you. I will do as per you request and will keep you posted. (1) I put back my index to my original status, thus have removed your earlier code. (2) I put this in 14view.php session_start(); // when first time set session $this_is_set_session_id = session_id(); echo $this_is_set_session_id; I opened 2 insentences of client windows, i get the same sessionid file, thus we are still back to same issue. I am reading out there too but could not find a way. what do you think. I tell you what simple if you are using WAMP simply create a php file with nothing put this session_start(); // when first time set session $this_is_set_session_id = session_id(); echo $this_is_set_session_id; why am i so worried when user open two windows, on client process leading the the other, it leading client will receive wrong data for processing, that is the the leading client will use the lagging client's data as well. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268239 Share on other sites More sharing options...
jitesh Posted June 5, 2007 Share Posted June 5, 2007 echo session_id(); Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268240 Share on other sites More sharing options...
jitesh Posted June 5, 2007 Share Posted June 5, 2007 and for differner categories you can generate individual session id by yourself like this session_id(md5('category_name')); session_start(); echo session_id(); ---------------------------- After set cookie the code will be like this $id = isset($_COOKIE['projectname_categoryname_sessionid'])?$_COOKIE['projectname_categoryname_sessionid']:md5('category_name'); session_id($id); session_start(); Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268241 Share on other sites More sharing options...
oceans Posted June 5, 2007 Author Share Posted June 5, 2007 Sorry, I think I did not express myself correctly earlier. I will give you the situation: Take cat 1 for example. It has 10 pages, idea, collect data from page 1 till 9 and store in MySQL in Page 10. Lets say One ignorent person, opens two clients from the same pc, In one screen he is in page 9, in one page he is page 3, when he goes to the page 10 on earlier, he will not not only same the data collected by the first but also data altered by the second. Thus what ever session id we give, as long as we did not force the each clients windows to have its own unique we will not be able to get arround. Am I right, please correct me. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268243 Share on other sites More sharing options...
jitesh Posted June 5, 2007 Share Posted June 5, 2007 when you first time start session do not write session_start(); only But write session_id(md5(time())); session_start(); Make sure you are not openning multiple clients by ctr+n Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268246 Share on other sites More sharing options...
oceans Posted June 5, 2007 Author Share Posted June 5, 2007 Friend it appers to work , but I will work out full then will keep you posted "pm" if you are not arround. by the way how can we set time out for these session variables, thgough i have destroy and unset if a user does not get to the alst page, i get these orphaned files littered in the temp folder. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268253 Share on other sites More sharing options...
jitesh Posted June 5, 2007 Share Posted June 5, 2007 Make changes in session time out will effect a lot and in whole project. It better at first page you make a check then session(with some set data) is set or not if yes then flush whole and start a new session. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268261 Share on other sites More sharing options...
oceans Posted June 5, 2007 Author Share Posted June 5, 2007 Friend, I do this, that is, on every first page, i will set all session variable to be "" then get on. I will give you situation: Say 50 persons view my page(s), but they do not get to the last page(s), where my session unset and session destroy is, thus the session files are just left there untill one day i stop server and delete all these files, thus if we could set time out when we create the a session variable it will be very usefull. I did it in ASP, but in PHP, I honestly do not know Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268265 Share on other sites More sharing options...
jitesh Posted June 5, 2007 Share Posted June 5, 2007 I do not think that we can set session time out for perticular session variable. If you want to set then you can use persistent cookie. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268267 Share on other sites More sharing options...
oceans Posted June 5, 2007 Author Share Posted June 5, 2007 My intention is not to set time out for a particular variable, but for the whole sesion file, that is after some time the file should go off, else the server computer will be collecting orphaned session files. "persistent cookie", is this the client side variable you are talking about. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268272 Share on other sites More sharing options...
jitesh Posted June 5, 2007 Share Posted June 5, 2007 This will effect to whole session management in php.ini change directive session.cookie_lifetime = seconds + restart web server // default is 1440 secs or you may set this durective in .htaccess. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268277 Share on other sites More sharing options...
oceans Posted June 5, 2007 Author Share Posted June 5, 2007 Dear Jitesh, I am very very tired suffering from earlier shock! Well I think you have bailed me out, I will test and get back, I will sent you PM if I can ;t find you later or tom. I need sleep now, if I continue i will mess my codes more. catch you later. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268279 Share on other sites More sharing options...
oceans Posted June 5, 2007 Author Share Posted June 5, 2007 Dear Friend, Nope we have not solved, the data is still mixing with each other... Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268357 Share on other sites More sharing options...
jitesh Posted June 5, 2007 Share Posted June 5, 2007 Are you sure that individual client contains individual session id? I mean individual session files are created for individual clients. Quote Link to comment https://forums.phpfreaks.com/topic/54228-solved-experiments-on-session/page/2/#findComment-268392 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.