Suggested articles for you:

39 thoughts on “Complete Login and Registration Application using PHP and MySQL

  1. blankarisa

    hi, can i add different roles for user? for example i want to add admin and normal user. do i need to link to admin page after log in? and should i create another table in database which store admin’s information?

    Reply
    1. blankRavi Bandakkanavar Post author

      Hi Arisa,

      The role is decided at the time of registration. Either super admin decides the role or by default, everyone will have a common role, for example subscriber role. After logging in, each role will lead to a different interface (webpage).
      A common database is enough.

      Reply
  2. blankanand

    Warning: Use of undefined constant title – assumed ‘title’ (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\loginsystem\edit-profile.php on line 2

    Reply
  3. blankarisa

    hi, i try to delete “bio” element just to check whether it can function or not, apparently the data does not enter in database anymore once i delete any elements. can you tell me why?

    Reply
  4. blankarisa

    hi, i try to add “address” in the signup function but it always lead me to error. can you show me how to do it? and where i am supposed to edit

    Reply
    1. blankRavi Bandakkanavar Post author

      Add a new placeholder in form and you need to read the same key in PHP and store it into the database. Just follow any one of the existing elements of the form, you will get it.

      Reply
  5. blankcbabic

    Hi! I am trying to modify the signup.php by adding croppie.js image cropper to it. The problem is that croppie displays the final photo as base64 and thus it cannot be uploaded to the database. Any chance of adding a base 64 decoder to this application?

    Reply
      1. blankcbabic

        thank you for the response. However, I’m new to PHP and i don’t know how to do this the right way. Tried nearly all combinations of the decode without success :(

        Reply
      1. blankAnvesh

        Warning: mysqli_connect(): (HY000/1049): Unknown database ‘loginsystem’ in C:\wamp64\www\anvesh\includes\dbh.inc.php on line 8

        Reply
        1. blankRavi Bandakkanavar Post author

          Hi,

          Its failing at $conn = mysqli_connect($serverName, $dBUsername, $dBPassword, $dBName, 3306);
          Do verify your MySQL server’s credentials.

  6. blankYushiko

    Warning: mysqli_connect(): (HY000/1045): Access denied for user ‘root’@’localhost’ (using password: YES) in C:\xampp\htdocs\Complete-Login-and-Registration\includes\dbh.inc.php on line 8
    Connection failed: Access denied for user ‘root’@’localhost’ (using password: YES)

    what do i change in the code?

    Reply
    1. blankRavi Bandakkanavar Post author

      Hi Yushiko,

      What is the username and password for your MySQL application? You need to add the same details in the connection string.

      Reply
  7. blankrakshitha

    hi
    I am getting following error

    *website error. contact admint to have it fixed

    could you please help me

    Reply
    1. blankRavi Bandakkanavar Post author

      Hi Rakshitha,

      As you can see in the code, this error is thrown when SQL exception is raised. You have to verify the MySQL server’s credentials and database name. It should work after that.

      Reply
  8. blankFred

    Thanks for these great script. Bravo.
    I got the following error when i click on the edit profile button:

    Notice: Use of undefined constant TITLE – assumed ‘TITLE’ in C:\xampp\htdocs\loginsystem\edit-profile.php on line 2

    Reply
    1. blankRavi Bandakkanavar Post author

      Hi Fred,

      Sorry about that. Could you please try commenting the second line. The following line

      define(TITLE, “Edit Profile”);

      Reply
  9. blankDarryl Santmayor

    Hey im getting an error “Warning: mysqli_connect(): (HY000/1045): Access denied for user ‘root’@’localhost’ (using password: NO) in C:\xampp\htdocs\log\includes\dbh.inc.php on line 8
    Connection failed: Access denied for user ‘root’@’localhost’ (using password: NO)”

    I created loginsystem database but can u give the sql code for table creation.

    Reply
    1. blankRavi Bandakkanavar Post author

      Hi Darryl,

      Where are you executing this one?
      Please make the following change in dbh.inc.php and try.

      $dBPassword = “”; //Database password

      Reply
  10. blankDOHNA A S

    i want to download the complete project source code link please

    Reply
  11. blankRobert

    Hi Ravi,

    thanks for a nice tutorial! Regarding the registration process, can you add e-mail validation, i.e. the visitor needs to validate his/her e-mail (using a link with a token) before he/she can gain access?

    Reply
    1. blankRavi Bandakkanavar Post author

      Thanks Robert. You are proposing a good extension to the registration process. It needs a tweak in the table to include an additional column to track the email activations.
      I will either add it in the same process or try to write a separate post for the same.

      Reply
  12. blankRocky Edwards

    this is a very good tutorial but how could I make it where whoever logins has a personal page like background and other personal links to other pages based on their login credentials

    Reply
  13. blankt3ch_guru

    this is great but how can you add a personal page for the user login like if they have a custom background picture and links or icons on their personal page instead of everyone accessing the same index.php that shows nothing

    Reply
  14. blankcharles

    Thanks for the tutorial. I’m new to php; please kindly help me on how to link the files. Do I create several page templates for the “.inc.php” files?.

    Reply
      1. blankCharles

        Hello Ravi,
        Thanks for your prompt response to my last mail. But you haven’t uploaded the project zip as promised. There seems no download link to this tutorial. Please help…

        Reply

Did it help? Comment here..