Search
Left Quote    Maybe this world is another planet's Hell.
- Aldous Huxley    
Right Quote
 
[login] | [Register]
 

Complete Members System

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

VERIFY USER:



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.

APPLY SESSION VARIABLES, REDIRECT:

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.

SHOW FORM

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

332,963 Views
41 Total Comments
4.8 Rating of 5 (5 Votes)

Options

Tutorial Options

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

Articles

Related    

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



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