Jump to content

Creating a Loging Script


topflight

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.

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.