Jump to content

Register Page for both Admin/Users


TheNotebook

Recommended Posts

Hi,

 

I'm very new to php/mysql, but for a project I'm working on I need to create users that are admins, and normal users. The admins would be able to post news stories, and delete user accounts. Whereas the users would just be able to comment on the news stories.

 

I'm just wondering how I would create a normal 'register' page for both, which has the same fields, but somehow creates some people as admins, and others as normal users... with the ability to limit who can become an admin, so not everyone can register as one. I'm not sure how I would achieve this, or even know how to do it.

 

Does anyone know any tutorials or code on how to achieve this?

 

Your help is greatly appreciated,

 

Thanks.

Link to comment
Share on other sites

You wouldn't ever assign admin privileges when someone registers. What's to prevent anyone from becoming an admin? If I could guess who you have designated to become admins, I could take over your site by registering as one of them first.

 

You would assign admin privileges by having the 'super/owner' admin assign those privileges to the correct account(s) after they have been created.

 

If you want to pre-designate specific users as admins, you would create those accounts yourself and then distribute the correct username/temporary-password to the correct person.

Link to comment
Share on other sites

how I'd first create the initial admin

 

You would either have an installation script (that gets removed after you use it) that creates the database record or you would register a normal account and then manually go into the database table and change the type to admin.

 

code to make other users admins?

 

You would create an admin page that only existing logged in admin's can access that would allow you to pick a username and edit his information stored in the database table.

Link to comment
Share on other sites

in sites i have made in the past, i have an auto edit form that pre populates the users info, and depending on if that user is an admin or just a normal user, the user group option is hidden or in a drop down.

i.e. an ordinary user will not get the option to change group from user to admin, but the same form viewed by admin will have an extra field with these options.

 

in fact the same form also works for adding new users via the cms backend or as a register form on the front end.

 

 

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.

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.