Jump to content

Session Check!


TheJoey

Recommended Posts

That seems pretty simple and efficient to me, although not hard to spoof. It depends on the security necessary for your website. I've personally adopted the habit of saving session ID's in the database, and then saving any appropriate information there (like what user is logged in - and if they are logged in for that matter, IP's, etc.). This puts all the authentication server side and the only thing that the user submits is a session ID (much harder to spoof, although not impossible, hence the IP is checked too).

 

If the code you made works for you and you just want an easy way of including it all your scripts without copy and pasting it, you could put it into a file such as session.php and then have all your scripts run:

require_once('session.php');

Link to comment
https://forums.phpfreaks.com/topic/177604-session-check/#findComment-936433
Share on other sites

I've personally adopted the habit of saving session ID's in the database, and then saving any appropriate information there (like what user is logged in - and if they are logged in for that matter, IP's, etc.). This puts all the authentication server side and the only thing that the user submits is a session ID (much harder to spoof, although not impossible, hence the IP is checked too).

 

All session data is stored server-side anyway.

Link to comment
https://forums.phpfreaks.com/topic/177604-session-check/#findComment-936446
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.