RE: Login and sessions?
| From: | John W. Holmes | Date: | Fri, 24 Jan 2003 01:48:34 +0000 |
| Subject: | RE: Login and sessions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-132931@lists.php.net to get a copy of this message | ||
> I am trying to add a "login" functionality to my new manager. A
> simple
> username/password functionality, so that the user logs in and
everything
> he
> does inside the site will have his name. I mean, if he wants to create
a
> new entry on the database, the field "name" wont have to be filled,
etc.
> Anyway, i dont have a clue to where to start. Tried to search
the
> net but
> i dont even know the keywords to search for. Could you guys please put
me
> in the good path?
> Heres where i got so far:
>
> Have a table on a mysql database named USERS, with "name",
password"
> "address", etc on it.
> What do i use to authenticate the user on my site? Sessions? If
so,
> the
> steps i need to solve the problem are, user logs in, the server keeps
his
> personal variables in "memory" so everytime they are needed for some
form
> or whatever, the server fills the fields automatically.
>
> How can i have several users "logged on" and then have like a
box on
> the
> site displaying who and how many users are logged in?
> Sorry for the messed up explanation, but i really dont know what
do
> do
> about it. Thanks.
Load the information into a session and use that when you insert data.
It won't happen "automatically" but if you save the user's name in
something like $_SESSION['name'], then you can use that variable in your
SQL statements and it'll be the value of the current logged on user.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/