Jump to content

Recommended Posts

Hi all I am in the process of creating a log in system and I would like some feedback,suggestions as I am new to php. I will be using sessions, however I will have different setting (i.e 1=user 2=admin 3=hm and etc..) and I want to show certain things in the login script base on their permissions. Suggestions are welcome.

 

 

Thanks in Advanced

Link to comment
https://forums.phpfreaks.com/topic/127923-creating-a-loging-script/
Share on other sites

In your users table, add a column called 'access', or 'rank', or something, and register it in your session, eg:

 

session_register("access");

 

Then, in your access column, just add different levels to users.

 

If you want to block access to a certain page, if the user level is below the required, add this to the header;

 

<? 
session_start();
if(!session_is_registered(access)){
header("location:index.php");
}
if ($access < 2) {
header("location:denied.php");
}
?>

 

This will send all users with an access level of below 2 to 'denied.php'.

 

Hope that helps.

Well currently I have it set up so that if you are a bm(board member) you will get a 1 if you are not you will get a 0. That's how all the other permissions are set up to. If that ok you think?

 

It's whatever you want.  Show us your code and explain what you're trying to do so we can help you.

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.