This is a short tutorial that
This tutorial teaches you to
This is a short tutorial on
HTTP as a protocol is
explains how you can protect
initiate user authentication
how to use the sessions (in
stateless, which doesn't
a web page from users. The
using PHP, and then to
PHP4) with a user,
make it easy for a
code in this tutorial is
authenticate users by
form-based login. This would
developer. For example, your
only about 5 lines long, and
matching the value of the
be useful for just about any
web server sends out a page
will protect any PHP page.
global variables
site where you had a
to someone ordering from an
HTTP Authentication involves
$PHP_AUTH_USER, and
"members only"
online shop, and then
the browser displaying a
$PHP_AUTH_PW to a list of
area and wanted to validate
forgets all about it. A few
window for the user to log
valid usernames and
the users from a database or
seconds later, the same
in, once the user logs in
passwords. The sample code
anything else. The examples
person sends another
the page is displayed. If
included with this tutorial
used authorize off of a
request, ordering another
the user fails to log in, a
will show you how to use
MySQL database on the same
item. As far as the web
failure notice is displayed.
either hard-coded values, a
server.
server is concerned, it
flat file, an existing
could be an entirely
.htpasswd file or a database
different person. So to make
table to manage your valid
sure the right orders are
usernames and passwords.
associated with the right
This tutorial is intended
person, a developer has to
for the PHP programmer who
employ some sneaky tricks.
is generally familiar with
Before PHP4, you could have
authentication, but who
used something like PHPLIB
would be interested in
for session management. But
learning a practical method
PHP4 comes with a complete
for authenticating access to
set of sessioning functions.
one or more Web site pages.
This article explains how to
use them.
Date: Aug, 19 2004 Date: Aug, 15 2000 Date: Jun, 09 2000 Date: May, 08 2002 |
One of the new great features
with PHP4 is the session
management feature. It
allows you to store
variables in a session
'object' during a user
visit. This article
discusses what a session and
a session variable are, and
what it can do.
Date: Jun, 21 2000 |