User Access (Limiting Access)
| From: | Hunter, Jess | Date: | Mon, 14 Apr 2003 14:07:59 +0000 |
| Subject: | User Access (Limiting Access) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-143769@lists.php.net to get a copy of this message | ||
Well as I conitnue on my quest for understanding user authentication I am
starting to grasp the concept.
I have managed to set up a login screen that uses cookies and even figured
out how to kill the session when the browser is shut down.
Now comes my dilemma. Let's say I have several user types in a database
(1,2,3,4,5) and I only want certain levels to have access to certain areas.
Could someone either tell me or show me if this is possible and how to go
about implementing it into my current script?
Here is the validation part I am using now:
<SNIPPET>
$userInfo = mysql_query($sql);
if($user = mysql_fetch_object($userInfo))
{
setcookie(userID, "" . $Username);
session_start();
session.cookie_lifetime;
header("Location: $afterLoggedIn?user=" .
$user->$useridField);
}
else
{
$error = "$errorMessage";
}
</SNIPPET>
Thanks in advance
Jess