RE: [PHP] Incoming Development
| From: | John Holmes | Date: | Wed, 19 Jun 2002 03:26:32 +0000 |
| Subject: | RE: [PHP] Incoming Development | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-102851@lists.php.net to get a copy of this message | ||
> For example, if I show the student: echo "Welcome &userid" at the
login
> script, when that student goes to some other page that is does not
holds
> the login script, it would print "Hi " instead of "Hi Whatevername".
How
> can I keep track of this things??? Cookies which I want to avoid???
<?
Session_start();
$_SESSION['userid'] = $userid;
?>
Now you have $_SESSION['userid'] on any page you use session_start() on.
That's the idea of sessions...passing variables among pages...
You use the same technique to make sure a person logged in. When the
username and password match, set a session variable like 'logged-in'. On
every other page, check for this variable. If it exists, they are logged
in, if not, then redirect to the log in page.
---John Holmes...