Jump to content

Managing Session


kecebongsoft

Recommended Posts

Hi,

 

I am currently developing a website that can be accessed in mobile phone. Because not all of mobile browser doesn't support cookie, so I need to put the sessionid on every url, and that increase the filesize :-(.

 

So I make a plan to store the session ID in the database, and attach the ID of the record in every URL, i.e : index.php?sid=1, the workflow is something like this :

 

 

1. User visit the website

2. Check wheter $_GET['sid'] is exists or not, if not, store new session id, user agent/browser, and ip address into database

3. Get the record id, and set value of 'sid' variable in the url to record id (i.e. index.php?sid=1)

 

When the user visit the website, the system will check the 'sid' variable first, and match the criteria (useragent and ip address), if visitor's useragent and ip is same with the record in the database, system will allow the visitor to use that session id, if not, then the system create new session id.

 

is that secure? I never use this method before, is there any chance to hack this method?. am also want to use timestamp to record the visitor's activity, if user try to use the same 'sid' after 30mins, then the 'sid' will not usable again.

 

thanks.

Link to comment
Share on other sites

Thanks for your reply..

 

Yes, but I'm working with mobile phone's browser now, which is not supporting cookie to save the sessionid, so the only way to get the sessionid is by attaching the sessionid in the url. We don't need to use this method for developing a website for PC because PC's browsers are supporting cookie, cmiiw.

 

I need sessionid to tell PHP what session I want to access. I've read from PHP.net, session is only support 2 ways :

 

- Cookie

- URL

 

Thanks.

Link to comment
Share on other sites

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.