Yes, I distinguish a host from a user. I store the member type in the database and in a global variable. When a host logs in I direct them to their control panel where they can maintain settings. Below is the code for the host control panel usercp.php, but I’m not sure if I need to do something login specific to make sure host can only see their own control panel and users cannot see the control panel at all. After login I direct host to usercp.php and I pull user specifc information from the database for the logged in user. Regular members are sent to the site’s index page.
[php]<?php
session_start();
ob_start();
require_once($_SERVER[‘DOCUMENT_ROOT’].’/db_connect.php’);
require_once($_SERVER[‘DOCUMENT_ROOT’].’/global.php’);
//check cookie
if ($_SESSION[‘logged_in’] != 1 && isset($_COOKIE[‘login_cookie’])) {
list($user, $pass) = explode(’[]’, $_COOKIE[‘login_cookie’]);
$qu = mysql_query(“SELECT user_password
FROM hgl_members
WHERE username
= '”.addslashes($user)."’") or die(mysql_error());
if (mysql_num_rows($qu) == 1) {
$passw = mysql_fetch_object($qu);
if ($passw->user_password == md5($pass)) {
$_SESSION[‘logged_in’] = 1;
$_SESSION[‘username’] = $user;
$_SESSION[‘password’] = $pass;
}
}
}
if(!isset($_SESSION[‘username’]) && !isset($_SESSION[‘password’])) {
$_SESSION[‘logged_in’] = 0;
$user = “Guest”;
echo $html_cpheader;
echo ‘You are not logged in and do not have access to this area.’;
echo $html_cpfooter;
} else {
echo $html_cpheader;
//I will do user specific database read/writes here
echo $html_cpfooter;
}
?>[/php]
*MOD Edit - For readability.