Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm building a web app where one use case will be at a registration desk where the staff will both add a contest entry on one screen on behalf of a guest, but login to another page on another tab of the same browser to mark that entry as paid once the guest has done so. I'm finding that my PHP session is shared between the two pages as I have this at the top of all my scripts:

// start the session (if needed)
if (!is_session_started()) {
    session_start();
}



My question is how to create a separate sessions? In both cases, the staff will navigate to other pages but return to the main ones and I don't want new sessions created each time that happens.

What I have tried:

For the page which marks the entry as paid, I was thinking of doing this at the top of the script:

// How to keep this from generating a new session ID every time the user
// refreshes the page during a valid login session?????
session_id(openssl_random_pseudo_bytes ( 32, true ));
session_start();


But I don't know if each subsequent page they navigate to will use that session ID, and when they return to this page will it generate a new session ID every time?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900