Jump to content

Recommended Posts

I'm making an MMORPG browser game.

 

Players need to log in, I use sessions for that.

For now I just use the player number, but I'm planning on using the encrypted password, ip adress and session number too.

 

Should I check this information on every page?

If not, when / where should I?

 

Also is it smart, if it's even possible, to change the session id on every page?

If not, when / where should I? :D

Link to comment
https://forums.phpfreaks.com/topic/156549-session-security-question/
Share on other sites

You really only need to regenerate the session ID when a change in authority occurs, such as when the user signs on. And regenerate it every "x" requests from the client via a counter in the $_SESSION.

 

And include a unique token in every response sent back, via output_add_rewrite_var().  If the next request does not include that token in $GET (URL) or $POST (form) or it's not in the $_SESSION, politely make the user sign in again.

 

And you can have that token "time-out" via another value in the $_SESSION. Set it to time() + 60*10 (10 minutes or whatever) in the $_SESSION when the next response is generated. The next request must be received back with a valid token before time() is greater than that $_SESSION value, or again, ask the use to sign in again or take some other appropriate action.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.