I have started a new website and I know basic HTML but I am clueless with PHP. I need to set up a login system where members can save their info on the site. I need to learn PHP, cookies, and a login system. Thanks.

8 Years
Discussion Span
Last Post by cwarn23

The way is:

You have to design the login page with two text boxes and then retrieve them and compare them with select statement with your database..
Then if it is ok ,navigate to another page like welcome.php...
Its very simple ,try....


I have just completed a login system for a php site and although it is not open source I will tell you how it works. So for beginners, you will need to know the following:

Making sessions
Making HTML Forms
The isset($_POST) command
MySQL querys
PHP Variables

And a few other small things. So to begin with, make a html page with a html login form then when it all looks perfect, change the extension to php and use the echo ""; command to show the page. Be sure not to use any double quotation marks ( " ) in your html codes otherwise you will come across problems.

After you have a html form, you have a php code at the beginning that detects if the form has been submitted. If the if function detects the form has been submited, then the script will attempt to connect to the MySQL database to check if the form details are valid. Then if the details are valid, a session is created. When the session is created, other parts of the website can see if the user is logged in. You then set the pages so that if there is no session in place, then the parts of pages (or even whole pages) will not load up.

Also if you are new to php then you should read some books and online tutorials about php before using it otherwise you may find yourself very lost. This is a brief post but I can explain more if you have any trouble understanding.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.