In my members database I have a section called rank.
Basically what im trying to do is make certain pages viewable to members with a rank higher than 12 for example, and if the rank is lower than 12 then they are redirected back to the home page. (obviously their will be lots of different pages for rank 5+ members, Rank 7+ members, rank 20+ members etc)
Can anyone help me with a tutorial or something please?
I did ask for help earlier with my current code, but I dont think that code is ever going to work, Ive been changing it and playing with it for a week now and can not possibly see any other ways to get it to work Members Rank only area's
I am still learning php, So ideally a nice easy explaining tutorial would be nice.
Database:
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)
Header.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
and then the 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