\n";
}
$allowed = 0;
$ub_admin = 0;
$ub_member = 0;
$ub_username = '';
$ub_userid = '';
$allowed_groups_list = explode(",", $groups_allowed); # set $groups_allowed in the file that include()s this one.
$allowed_groups_hash = array();
foreach($allowed_groups_list as $group)
{
if($group)
{
$allowed_groups_hash[$group] = 1;
}
}
$allowed_users_list = explode(",", $users_allowed); # set $users_allowed in the file that include()s this one.
$allowed_users_hash = array();
foreach($allowed_users_list as $username)
{
if($username)
{
$allowed_users_hash[$username] = 1;
}
}
if(preg_match("/^admin=(0|1):::::member=(0|1):::::username=(.*?):::::userid=(\d*?):::::group_memberships=(.*?):::::/", $login_status, $matches))
{
$ub_admin = $matches[1];
$ub_member = $matches[2];
$ub_username = $matches[3];
$ub_userid = $matches[4];
$group_memberships = $matches[5];
$group_list = explode(",", $group_memberships);
foreach($group_list as $group)
{
if($allowed_groups_hash[$group])
{
$allowed = 1;
}
}
if($allowed_users_hash[$ub_username])
{
$allowed = 1;
}
}
#print "\n
groups_allowed: '$groups_allowed' \n
login_check: '$login_check' \n
login_status: '$login_status' \n
\n";
if(!$allowed)
{
#print "
You must login first.
\n"; # Or, if on a crappy server where you must use include() to call userbase.cgi: # #print "You must login first.
\n"; # Or, if you want to auto-redirect to the login page, instead of # displaying the "you must log in" message: # $message = "Please login first."; $gourl = "http://" . $_SERVER['HTTP_HOST'] . "/login/?phasemsg=" . urlencode($message) . "&whence=http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; print "\n"; exit; } ?>