[thelist] PHP / MySQL User Login System

Jake Aust mail_lists at jakesdiner.com
Wed Feb 27 20:40:01 CST 2002


I am very new to PHP/MySQL but I am starting to get the hang of things. My
question is what is the best approach to my problem.

I want to design a username/login form that resides on my homepage. After a
user logs in using this form, they should be authenticated against my
database and the home page for this user retrieved as well to which the user
will be sent.

The idea is that this is a "client extranet" where we as a design company
can display new items for viewing by out client. This application does not
need super-security.

My current approach is as follows:

1. On the home page, set a session variable "user_authorized" and initialize
it no FALSE

2. Pass the username and login from the form to a "login" script that checks
the login info and retrieves the home page (which will be a directory of
work to view).

3. Set the "user_authorized" session variable to "TRUE" and redirect the
browser to the home page URL that was retrieved (not exactly sure how to do
this, but I am assuming that I will be able to figure it out without much
difficulty)

4. On each user "home page" the session variable will be checked to make
sure they are logged in before displaying the contents.



My question is in how to deal with all the content that will be linked to
from the "home page."

In my current model, I assume that I would need to add the session variable
checking to each page of content. This is not a good thing. I don't want to
have to do this if at all possible.

Is it possible to have all the links from my "home page" link back to the
"home page" with a variable tagged on that defines which content to display
and then get the home page to display the requested page instead of the home
page? For instance...can I store HTML pages in a directory that contain my
sub-content. Then have the home page link to homepage.php4?content=A.html.
The homepage.php4 would check to see if the "content" variable is defined
and If it is, retrieve the contents of "A.html" from the subdirectory and
display that content. The subdirectory could be locked for browsing directly
to it.

Would this model work? Does anyone have any pointers for me on how to handle
this problem overall? Does my model suck?

Thanks

Jake Aust
web developer
lovejoy(creative)
www.lovejoycreative.com




More information about the thelist mailing list