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
https://forums.phpfreaks.com/topic/66886-solved-access/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.