Login System in PHP


Login System in PHP

Learn how to create a secure login system in PHP and MySQL. This script contains the login form for the registered user to login into his account.It prevents MySQL injection that makes it difficult for your site to be hacked. Example Source Code
  1. <?php
  2. include ("connection.php");
  4. if (isset($_SESSION["SESS_MEMBER_ID"]))
  5. {
  6. $result = mysql_query("SELECT member_id FROM `member` WHERE `member_id`='" . $_SESSION["SESS_MEMBER_ID"] . "' LIMIT 1");
  7. if (mysql_num_rows($result))
  8. {
  9. $row = mysql_fetch_array($result);
  10. $_SESSION["logged"] = $row["member_id"];
  11. }
  12. }
  14. ?>
On the next tutorial, would be on how to create a twitter, youtube, Gmail and much more.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Submitted bytakudzwa jeke (not verified)on Tue, 10/04/2016 - 18:06

could not select database on registration wat shld i do???

Add new comment