Jump to content

login form - member and admin page after login


Recommended Posts



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



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



  // 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



  // 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

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.

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.