views:

130

answers:

4

I am developing the ability for administrators to log in and I'm to the point of creating the admin log-in page, but I'm somewhat torn as to where the best place to put it.

For details, this is part of an MVC framework, and the administration portion is in it's own folder - /admin; so administration is completely separate from the public portion of the site.

I would like to place the actual log-in page in its own php file for security by separating it from the rest of the site. That way if they bust one, they don't bust all. However, then you get to the point of processing the log-in request - should it be in the same PHP file as the log-in, or should it reside in another file, or should all of this just be part of the framework?

Any suggestions would be much appreciated.

EDIT: just for some clarification, this is my first time creating any sort of user system, so please bear with me :) (Any good tutorial/example links are greatly appreciated too).
The admin portion of the site is in it's own folder but uses the same base files, classes, etc as the front end - the files are only overwritten in the admin portion as needed. Also, an 'admin' is just a certain user type - roles and permissions have already been figured out.

I'm just having a hard time starting - particularly where to implement/put the login form. I thought it would be best for security to have a physically separate file for login, but I see that might not be the case.

A: 

IMHO, Admin should login through the same form as regular user, but permissions should allow him to view additional content. You can place admin forms in any folder, and then allow admin to access it.

Sorantis
A: 

Using the same login system for both admin and users will enable you to simplify your application. First off, you'll only need to create one login form. Secondly, if the admin section is part of the same codebase, you'll gain a huge benefit from being able to access all of the classes used throughout the site. If you used an MVC architecture, you'll probably want to use the same models in the admin as you do on the site. Even if you didn't, there is probably still a lot of code you can reuse for the admin section (base classes, database abstraction layer, shared settings/configuration, etc).

pix0r
Yes, even though the admin section of the site is in it's own folder, it uses all the same classes as the rest of the site. It only uses files in the admin folder if they are present - if not, it defaults to the framework classes
Robert DeBoer
A: 

I think the admin user should just be another class of user (or be an option for a normal user). Take note that there's slightly more chance of granting access to a normal user by mistake with this approach.

James C
An admin will be just another type of user. I'm going to be implementing a role/permissions user structure, so a user can be an admin, a custom admin with access to only x component, etc.
Robert DeBoer
+1  A: 

I agree with the rest of the posts, Admin should be in the same work-flow. Here is a good example to reference.

Phill Pafford
Thank you very much, I'm going to try it out; seams very informative.
Robert DeBoer