Jump to content

Can someone clear a question about sessions up?


JonnySnip3r

Recommended Posts

Sessions are stored on the server in the directory (folder) defined when you run the session_save_path() function;

 

Create a page with only this, and you will be able to see the path:

 

<?php
echo '<h1>SESSION SAVE PATH: '.session_save_path().'</h1>';
?>

post the page on your server and access it from a browser.

 

To answer your question though, give your users a access level of some sort (eg: 1, 2, 3 , 4) and then apply permissions to those access levels in your code like

 

if($access_level >= 2){
  // do some level 2 and up stuff
}
else{
  // you do not have the permissions needed to do it
}

 

sessions are much more secure than cookies, but i don't recommend you use them for what you need. I would store the access level in a session.

 

$_SESSION['access_level'] = $access_level; // queried from your database

 

you can then use it on every page!

 

 

I agree that sessions are much more secure than using cookies, but you could make it even more secure by changing the save path to something custom (instead of the default /tmp) and also try to read up on session hijacking articles.

 

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.