473,322 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Multiple php Session ID problem

I have two different session IDs ('reg_gen' & 'assess') for the same user to log in to different parts of the web site (containing several pages) with different passwords.
I use the following code in the two php include file to switch between sessions(and website areas):
php include file 1
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. session_id('reg-gen'); 
  3. session_start(); 
  4. session_destroy(); 
  5. session_id('assess'); 
  6. session_set_cookie_params(0); 
  7. session_start(); 
  8. and the rest of the code ................ 
  9.  
  10. AND php include file 2 
  11. <?php 
  12. session_id('assess'); 
  13. session_start(); 
  14. session_destroy(); 
  15. session_id('reg-gen'); 
  16. session_set_cookie_params(0); 
  17. session_start(); 
  18. rest of the code.............................. 
This works fine when I switch from one id to other without leaving the browser.
When I close the browser and try to access a page in the same area of the web site as previously (with the same phpinlude file) I am not asked to login.
I tried adding:
Expand|Select|Wrap|Line Numbers
  1. session_start(); 
  2. session_destroy(); 
at the very beginning of each code above, but this time as I go from one page to other (with the same include file), each time I am asked to log in again.
How can I destroy the previous session when leaving the browser, but only need to log in once on the first page instance of the same site area?
Dec 6 '12 #1
0 1577

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Roman | last post by:
Hi, I've installed .net on my server and since then I'm loosing my sessions from my (old) asp. e.g.: Session("test") works on the same page, but if the page is changed the whole session is...
0
by: Marek | last post by:
Hi, I have the following session problem: I've created simple login/logout form to prevent unknown users from accessing my private web site part and It is not working on the www server. It seems...
4
by: Leslaw Bieniasz | last post by:
Cracow, 20.09.2004 Hello, I need to implement a library containing a hierarchy of classes together with some binary operations on objects. To fix attention, let me assume that it is a...
0
by: Sabari | last post by:
Hi, In our application we face a session problem.Its kinda strange as well.We have our session timeout in web.config file to 240 minutes.It works fine in our intranet.When we moved the project to...
1
by: Jakob Ehn | last post by:
I have a html portal page, where there are several IFrames. All IFrames point to aspx pages that belong to one aspnet web application. The problem I am having is that when I first go to the html...
1
by: caldera | last post by:
Hello, We have a session problem. A dataset is put into a session and call this session value later. When we run this web page in http://localhost it works. But server has a specific name like...
4
by: alan | last post by:
Hi, i have some problem in asp.net session problem in page_load -> i have Label1.text = Session("a") in DataGrid1_sortCommand -> i have Session("a") = e.sortExpression
3
by: sri | last post by:
Hi, I have Login page (login.aspx") and after entering into inbox by giving valid userid and password the session item is userid and password. In inbox page ("inbox.aspx") i have logoff button and...
1
by: hankypan1 | last post by:
Hi All, I am developing a multi threaded CLI application which will be running over the socket interface. So i need to have a telnet server sort of thing, command line editor application with...
3
by: deepsfriend4u | last post by:
Hello, i have one application in that i use session . problem is, same code and session data use work successful in Firefox but not work in Internet Explore. Thanks & Regards ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.