在我的成员数据库中,我有一个名为 rank 的部分。
基本上,我试图做的是让某些页面对排名高于 12 的成员可见,如果排名低于 12,那么它们将被重定向回主页。(显然,对于 5 级以上成员、7 级以上成员、20 级以上成员等,他们将有很多不同的页面)
任何人都可以帮我提供教程或其他东西吗?
我之前确实向我当前的代码寻求过帮助,但我认为该代码永远不会起作用,我已经改变它并使用它一周了,不可能看到任何其他方法让它工作唯一的区域
我还在学习 php,所以理想情况下,一个简单易懂的教程会很好。
数据库:
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)
头文件.inc.php
<?php
include ($_SERVER['DOCUMENT_ROOT'].'/dblink.php');
include ($_SERVER['DOCUMENT_ROOT'].'/addon.php');
$geterror= $_GET['error'];
$error= stripplus($geterror);
$extra = mysql_fetch_array(mysql_query("SELECT * FROM extra WHERE id='1'"));
$cp = mysql_fetch_array(mysql_query("SELECT * FROM members WHERE username = '$username'"));
$weather = $extra[weather];
$wurl = $extra[wurl];
$games = $extra[games];
$xword = $extra[xword];
$xword2 = $extra[xword2];
$xworddate = date("M j Y",$extra[xworddate]);
$userinfo = mysql_fetch_array(mysql_query("SELECT * FROM members WHERE username='$username'"));
$rank = $userinfo[rank];
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>";
}
if ($username)
{
mysql_query("UPDATE members SET laston = $timestamp+120 WHERE username='$username'");
mysql_query("UPDATE members SET ip = '$ip' WHERE username='$username'");
$login = "Welcome $username :) <a href=\"$baseurl/logout.php\" >Logout</a>";
$helpfaerie = "<a href=\"$baseurl/helpfaerie.php\" >Help Faerie</a>";
}
else
{
$login = "<form name=\"login\" action=\"$baseurl/login.pro.php\" method=\"post\" > <input type=\"hidden\" name=\"act\" value=\"doLogin\" color=\"#000000\" valign=\"middle\" > Username: <input type=\"text\" name=\"username\" color=\"#000000\" style=\"width:100px; height:20px;font-size:10px;\">
Password: <input type=\"password\" name=\"password\" style=\"width:100px; height:20px;font-size:10px;\"> <input type=\"submit\" name=\"submit\" value=\"Login\" style=\"width:42px; height:20px;font-size:10px;\"></form>";
}
ECHO <<<END
然后是 font.php
<?php
$pagetitle = "Add Font";
session_start();
// Rank Limit
$limit = 10;
// Using a session
$rank = $_SESSION['rank'];
// Using a cookie
$rank = $_COOKIE['rank'];
if ($rank < $limit) {
header("$baseurl/index.php?error=You+can+not+view+this+page.");
exit();
die();
}
include ($_SERVER['DOCUMENT_ROOT'].'/staff/header.inc.php');
ECHO <<<END