Jump to content

login form - member and admin page after login


BluwAngel

Recommended Posts

hi

 

i need help an idea how can i separate members from admins

since i dont know how to create login form i used tutorial (

)  (its session login form only that i made it work other tutorials wre too old or something)

how what i want to do is separate members and admins because admin need more rights to do

now i have idea but dont know will it work like that

what i want to do is create additional row in table named it flag and create 0 (inactive user) 1 (member) 2 (admin) will that work?

and how can i create different navigation bars for users and admins? do you recommend that i use different folders to create it or just script based on session and flag?

Link to comment
Share on other sites

Why not just create a dupe of your site login in /admin folder, and an admins table, that way you save the resources that would be used by outputting one set of content for users and another for admins.

Link to comment
Share on other sites

hi,

 

what you can do is just create a separate folder for members and admin..and separate table for both login, keep it clean for long run

 

member will use the session as

 

session_start();

  // If the session vars aren't set, try to set them with a cookie
  if (!isset($_SESSION['user_id'])) 
  {
    if (isset($_COOKIE['user_id']) && isset($_COOKIE['username'])) 						 	{
      $_SESSION['user_id'] = $_COOKIE['user_id'];
      $_SESSION['username'] = $_COOKIE['username'];
    }
  } 

 

and admin as

 

  session_start();

  // If the session vars aren't set, try to set them with a cookie
  if (!isset($_SESSION['admin_id'])) 
  {
    if (isset($_COOKIE['admin_id']) && isset($_COOKIE['adminuser'])) 						 	{
      $_SESSION['admin_id'] = $_COOKIE['admin_id'];
      $_SESSION['adminuser'] = $_COOKIE['adminuser'];
    }
  } 

 

Note: make sure the difference in cookie 

Link to comment
Share on other sites

wat u can do is

 

u should put one flag  column in database which will tell u whether the logged in user is admin or a normal client

Once u know which user has logged u u can redirect that user to the respective url

 

And yes it would be better to have different folder for different user type

 

say for admin it would be admin folder

and for user it would be user folder

Link to comment
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.