I am trying to prevent session fixation and have read the following from the owasp website:
Session Fixation
Session IDs are to be generated by your application only. Never create a session only because you receive the session ID from the client, the only source of creating a session should be a secure random generator.
I handle sessions by using:
ini_set('session.use_only_cookies', 1); // Forces sessions to only use cookies.
ini_set('session.entropy_file', '/dev/urandom'); // better session id's
ini_set('session.entropy_length', '512');
session_start();
and checking for the existence of a user id:
if(isset($_SESSION['user_id'])) {
//act like user is logged in
} else {
//refer user to the login page
}
Does this mean the only source of creating my session is via a secure random generator?