LinksTraffic - Links and traffic exchange system

Login & Sign up forms

english directory french directory
Search: Advanced Search

Index Webmaster | Tutorials | Web Scripts

Login & Sign up forms

Warning: include(../../inc/g468x60.htm): failed to open stream: No such file or directory in /home/wwwuser/RHM/ on line 60

Warning: include(): Failed opening '../../inc/g468x60.htm' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/wwwuser/RHM/ on line 60
Copy and paste the following codes into your editor and run it (you should end up with 4 files: 2 for the login and 2 for the sign up).
  • You have one database named logindb
  • You have one table named login which is part of the database
  • You have 2 files login.html and login.php for the login (a login form and a script to check the entries against the database)
  • You have 2 other files signup.html and signup.php for the signup form and for the insertion of the dataset inside the database.

The login system works on session variables (see the $_SESSION global variable defined in Php) stocked on the server side and which expire usually after 20 minutes of inactivity.

We also need to store the dataset inside a database (Mysql is used here).

We assume you have some basic knowledge with Mysql or just copy the following code and execute it (for details about setting up a database and adding tables, please have a look to these Mysql tutorials):

Just insert this table inside the database logindb. And remember your username and password (we will assume they are respectively: userlogin and passlogin) to connect to this database.

Let's build an online login form containing a login and a password field:

Store this code inside login.html
You may add some javascript to check the entries on the client side.

Now comes the function to retrieve the data from the login form and match the data against the database:

Store this code inside login.php

The signup html form (just require a login name and a password to confirm):

Store this code inside signup.html
You may add some javascript to check the entries on the client side.
You can also add as many fields as you wish assuming you add columns to the login table.

Finally the script to insert the signup datas inside the database:

Store this code inside signup.php

At this point you can upload everything onto your server, arrange the layout and try to signup first and then login.


No comment yet, write the first now here or onto our webmaster forum


Copyright 2004-2010 @ LinksTraffic RHM Solution ::: Partners | Privacy | Contact us form