Jump to content

[SOLVED] Access


unidox

Recommended Posts

I have a problem, the access for the user levels arnt working. Even members have admin access. Here are the files:

 

I have it so when u make a user, a number 1,2,3 goes in the db. 1 For admin, 2 for staff, 3 for member.

 

part of the func2.inc.php:

 

	require_once 'config.inc.php';
$oncolour = "#BCD5FE";
$offcolour = "#FFFFFF";
$bdrcolour = "#F0F0F0";

$islogged = preg_match("/index.php?page=login/", $_SERVER['PHP_SELF']);
if ($islogged == "0") {
	if ($_COOKIE['uniqueid'] == "") {
		header ("Location: index.php?page=login");
		exit;
	}
}

if ((!$_REQUEST['method']) || (!$_COOKIE['uniqueid'])) {
	$access = $_COOKIE['access'];
	if (array_search($page,$levels)) {
		if ($access > $levels[$page]) {
			echo $access . $levels[$page];
			//showError('You do not have access to this page.');
			exit;
		}
	}
}

 

Config.inc.php:

 

<?php
###############################################
// Folder Locations
$template_folder = "template/";
$folder = "/";
$imagefolder = "pics/";
$imagefilepath = $folder . $imagefolder;

// Vulgarity on or off
// 1: On, 0: off
$vulgarity = 0;

// Special Character
// Default: |
$special_character = "&";

// Max Links & Roster Characters
// Default: 20
$max_length = 16;

// Max News Posts Displayer Per Page
// Default: 8
$max_news = 8;

// Do not change
$root = $_SERVER['DOCUMENT_ROOT'];
$imagefullpath = $root . $imagefilepath;

// Access Levels
// 1: Master, 2: Staff, 3: Members, 4: All Users
$levels = array();
$levels[login] 		= "4";
$levels[index] 		= "3";
$levels[news] 		= "2";
$levels[roster] 	= "3";
$levels[links] 		= "2";
$levels[leagues] 	= "2";
$levels[matches]	= "2";
$levels[servers] 	= "2";
$levels[faq] 		= "2";
$levels[sponsors] 	= "2";
$levels[downloads]	= "2";	
$levels[meda]		= "2";	
$levels[demos]		= "2";	
$levels[settings] 	= "1";
$levels[changepass]	= "3";
$levels[admins] 	= "1";
$levels[config]		= "1";
?>

 

The SQL structure is:

 

  `user_id` int(11) NOT NULL auto_increment,
  `username` varchar(20) NOT NULL default '',
  `password` varchar(255) NOT NULL default '',
  `cur_ip` varchar(25) NOT NULL default '',
  `last_logged` varchar(25) NOT NULL default '',
  `access` int(2) NOT NULL default '0',

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.