Solved

Authentication for multiple user type in php

Posted on 2004-10-13
4
266 Views
Last Modified: 2012-05-07
I have a problem on authentication in php. You see, I have three types of account, one for a guest, one for a normal member and another one for an administrator. Now, how can I limit the directories that each type of member account can access? for example, a member will normally gain access to the default.php page. However, he shouldn't be able to access the admin.php page. How do I resolve this?
0
Comment
Question by:Gianz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 5

Accepted Solution

by:
php-webdesign earned 70 total points
ID: 12305900
i gues you put the information in sessions

create a file inc_logged_in_heretheuserlevel(eg admin).php:

<?
if($_SESSION['userlevel'] != "admin"){
  die("Not allowd to enter this page!!");
}
?>

and inlcude this file on every page you only want your admin to enter it. And for user and guest do the same
0
 
LVL 2

Expert Comment

by:hewtluca
ID: 12305955
Yeah php-webdesign is right........put what he says at the top of the pages you want to protect.

Just assign your session variables at the same time they login.......I also assign

$_SESSION['logged']==true

Just make sure you destroy the session when they logout.

Hewt
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JSON decode 5 46
How to confirm and grey the submit button using JavaScript ? 14 67
Which is best Image Resizing Web service 11 41
php non-object 7 28
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question