会员仅排名区域 [英] Members Rank only areas
问题描述
在我的网站上,我有一个员工休息室,但看来无论您是成员还是现在,每个人都可以看到它.
In my site I have a Staff lounge, But it seems that everyone can see it, whether your a member or now.
Header.inc.php:
Header.inc.php:
$userinfo = mysql_fetch_array(mysql_query("SELECT * FROM members WHERE username='$username'"));
$rank = $userinfo[rank];
$rank1 = $userinfo[rank1];
$rank2 = $userinfo[rank2];
$rank3 = $userinfo[rank3];
$rank4 = $userinfo[rank4];
if (!$checkrank) { $checkrank = 0; }
if (!$rank) { $rank = 0; }
if (!$rank == ' ') { $rank = 0; }
if ($rank < $checkrank)
{
header("Location: $baseurl/index.php?error=You+can+not+view+this+page.");
}
if ($rank >= 30)
{
$admin = "<a href=\"$baseurl/staff/admin.php\">Admin</a>";
}
等级是5-30,职员休息室成员可以看到的等级越高,但是,无论等级如何,每个人都可以看到该页面(但是管理员区域,这是除了排名30人)
Ranks are 5-30 The higher the rank the more of the staff lounge members can see, However No matter what peoples ranks are everyone can see the page (BUT THE ADMIN AREA, Thats the only thing no one can see other than RANK 30 people)
在每个页面的顶部,我都有(banners.php):
At the top of each page I have (banners.php):
$checkrank = 5;
if ($rank <= 0)
{
header("Location: $baseurl/index.php?article=$article&error=Only+SketchedNeo+staff+can+see+this.");
}
include ($_SERVER['DOCUMENT_ROOT'].'/staff/header.inc.php');
我和一个朋友昨晚在这里坐了几个小时,将$ checkrank更改为20,如果将$ rank更改为18,然后在数据库中将其排名更改为15,但是她仍然会看到所有页面.
A friend and I sat here for hours last night, Changing the $checkrank to 20 and the if $rank 18 and then making her rank to 15 on the database, but she would still see all pages.
我的数据库结构是:
id int(11)
username varchar(200) latin1_swedish_ci
password varchar(216) latin1_swedish_ci
security varchar(200) latin1_swedish_ci
email varchar(216) latin1_swedish_ci
ip varchar(200) latin1_swedish_ci
rank varchar(216) latin1_swedish_ci
name varchar(30) latin1_swedish_ci
age varchar(40) latin1_swedish_ci
gender varchar(40) latin1_swedish_ci
location varchar(40) latin1_swedish_ci
helpfaerie int(11)
profile text latin1_swedish_ci
about text latin1_swedish_ci
tasks text latin1_swedish_ci
joined varchar(216) latin1_swedish_ci
laston int(200)
icedmutereason text latin1_swedish_ci
icedmutedetails text latin1_swedish_ci
icedmuteby varchar(200) latin1_swedish_ci
icedmutedate int(200)
posts int(11)
signature varchar(216) latin1_swedish_ci
avatar varchar(216) latin1_swedish_ci
neohtml text latin1_swedish_ci
siggy text latin1_swedish_ci
verify int(11)
changedpass int(1)
我如何做到这一点,所以只有排名最低的成员才能看到页面? 我需要它是例如具有17+或更高等级的会员才能看到此页面,因此具有16和更低等级的会员将被重定向回首页.
How can I make it so only members with a minimum rank see pages? I need it to be for example members with rank 17+ can see this page, Therefore members with ranks 16 and Lower are redirected back to the home page.
我找到了有关ACL(访问控制列表)的教程
I found a tutorial for ACL (access control list)
推荐答案
在发送重定向标头后,您需要阻止任何页面输出.
You need to prevent any page output after sending redirect headers.
header("Location: $baseurl/index.php");
die();
如果不停止执行脚本,则重定向将永远不会发生.
If you don't stop the script from executing, then the redirect will never happen.
这篇关于会员仅排名区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!