Sessions

From: Date: Mon, 26 Apr 2004 13:58:22 +0000
Subject: Sessions
Groups: php.general 
Request: Send a blank email to php-general+get-184640@lists.php.net to get a copy of this message
Hi, I have recently started to use and understand Sessions in PHP. Starting and initiating a Session on Login works, but how do or can I check on the following pages, if the user is really logged in? For now I am using the following code, which seems to work: <?php session_start (); if (!$_SESSION) { header("Location: index.php"); // which directs back to login form } ?> Is this a correct way to do so, or is there some better or safer solution to this? Searched the archives as well, but couldn't find an appropriate answer. Thanks in advance for your suggestions & help, Holger

« previous php.general (#184640) next »