php Session help needed!

I am trying to create an online game using php and MySQL (mainly).

I have a working registration and a working login, however I cannot figure out how to correctly use sessions for each user after login.

How I think this will work is :-

on login checks for valid loginname and password, if valid at the moment it displays
‘Welcome $charname your dex is $dex and your str is $str’

Can anyone explain to me how to use variables so on login it creates a session, which will stay active until 10 minutes idle have passed. And can you also show me how to create session variables ie to display the dexterity of that character or the banked gold that character has on an interface.

This page shows an example of how to implement sessions in your website. The 10-minute-idle thing can be implemented by storing a timstamp in your session and if the timestamp is less than 10 minutes old upon next page load, it should be renewed, if it is older, the session can be dropped.

Sponsor our Newsletter | Privacy Policy | Terms of Service