Here is an outline of the steps we will take to prepare for the script and so on.
Just to remind you, this can easily be combined with other scripts/tutorials I have setup that deal with
users on your website, like Users Online and Comments Script. If you get the concept of these tutorials, it wont take much to
- Create members table in database - you can use phpMyAdmin and create the table by hand, or
import SQL, which I will provide.
- Create a register script - If you've going to have members, you need to allow them to signup.
When they do, their information will be stored in the members table.
- Create a login page - At this point, we create a page that will log them into the site and check
their username and password aginst what is stored in the database. Upon success, a cookie will be applied
and the user will be redirected to the main page.
- Modify your page_header - In your page_header code (like from the Site
Design Made Simple tutorial) we will be adding code to check for the cookie to see if
they're logged in.
- Logout - Somewhere on your website, you can display their logged in status with variables we
will setup, but also display a link to logout page, that will log them out. This page will destroy the
session, set the cookie backward and take them back to the main page. If they're not logged in, we can
display a login link and "welcome guest" or something similar.
CREATING THE MEMBERS TABLE
To get things started off, our first step is designing the table that our data will be stored into. We
will be storing information so that members can login to the site. So we create a table "members" - Next we
need something to uniquely identify each member (other than username), so we will have a column
called "user_id" - The other two columns we will use are "username" and "user_password". You might want to
add more to yours, like location, interests, etc. This is just a basic example.
Listed below is the SQL code to create the table. You can run that in phpMyAdmin to create the table, or
just create the table using the design I will now explain. The user_id column will auto increment, meaning
each time a member registers, their unique id will automatically be assigned. the username column is set to
varchar(25), meaning that the max length of the character string (username) cannot exceed 25; The
same applies to the user_password column at 32. User email field can be as long as 255. You can change
those to whatever you wish, that is just the way I set them up.
| Subject: "table"
Date: Mar 16 2008 at 8:15 pm
||where do i
table or place
| Subject: "re: table"
Date: Mar 17 2008 at 4:37 pm
in a PHP page,
but first have
to connect to
Or, you can
| Subject: "Great"
Date: Mar 31 2008 at 11:25 pm
||This is an
allowed me to
basis for the
of my site,
while giving me
||Rating of 5 (5 Votes)