Left Quote    Black holes are where God divided by zero.
- Steven Wright    
Right Quote
[login] | [Register]

Complete Members System

by: bs0d
Page: 7 of 9
(View All)


Simply done, $get_user is a mysql query to the database that will select a username with the values you provided. If the query is not successful, a match was not found in the database. so either it was the username field, or password.


This is the code that will follow the code from above. If the script executes a successful query, then a member name and password matched. We can now apply session variables to recognize them - and immediately redirect to the main page (or whatever page you decide).

We are assigning three session variables. A logged in status (1 = logged in, 0 = not logged in), username and password. These sessions will last until the browser is closed. session_write_close(); is not required, but will force the session data to be saved before the browser changes to the new page when we call the header function.


Now the form must be shown for them to login. Our first condition checked if the submit button was pressed. All code above was to be executed based on that condition. If that condition fails, we display the form. That is what we do below.

Notice the else condition opening bracket before the html form, and the closing bracket at the end. Else is saying "show the form because the submit button was not pressed." Nothing is special about the form and table, basic html - you can church it up as you like. This is the bare bones to get the job done. We will now cover the code in the page header.

1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  
Next »

No Comments for this page.

You Must be logged in or a member to comment.

Tutorial Stats

Tutorial Stats

41 Total Comments
4.8 Rating of 5 (5 Votes)


Tutorial Options

· Login to Rate This Article
· Login to Post a Comment
· Read more by this author
Digg This Article! Bookmark This Article Reddit: Bookmark This Article BlinkList: Blink This Article! YahooMyWeb BlogMarks: Add This Mark! Furl: Save This Article Spurl: Mark This Article



· Simple PHP Tutorial
· One File Website
· Pagination with PHP
· Building a Comments Script
· Variable Scope

"" Copyright © 2002-2020; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank