Need help with PHP script to check a field and then allow / disallow

Hi all,
I have been tearing my hair out and I think its something simple I am missing.

what I have is members area on my site which allows access to people that have registered. What I want to is restrict access to certain pages.

What I have in the members database is a field called “level” this is an integer value.

I want the page to check if the level is >2 and if it is then it should deny access to the page and give only a link to “go back” and not show the content of that page, if the level is 2 or below then the page should load normally.

for instance “members-index.php” has a link to administration page called “admin-index.php”, I only want members with level 2 or below to have access to “admin-index.php”

any help would be greatly taken.

regards
dave

thought it may help for you to see the table

CREATE TABLE IF NOT EXISTS `members` ( `member_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ip` text NOT NULL, `nickname` varchar(100) DEFAULT NULL, `lastname` varchar(100) DEFAULT NULL, `login` varchar(100) NOT NULL DEFAULT '', `passwd` varchar(32) NOT NULL DEFAULT '', `level` varchar(15) NOT NULL DEFAULT '5', `status` varchar(15) NOT NULL DEFAULT 'Active', `lastonline` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `logins` int(5) NOT NULL DEFAULT '0', `pts` int(10) NOT NULL DEFAULT '0', PRIMARY KEY (`member_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2011006 ;

ignore the above post - wrong thread

Sponsor our Newsletter | Privacy Policy | Terms of Service