PHP Login System Reloaded v1.1

Here’s an updated version of the PHP Login System. You can check the old version here. The following was added: 1. Registration fields: email confirmation password confirmation country recaptcha Email confirmation and password confirmation are configurable fields. By default they are shown, but if you wish to remove one or both of them you have […]

From our sponsor: Experience a seamless creation process from concept to production with advanced design features on Editor X.

PHP Login System

Here’s an updated version of the PHP Login System. You can check the old version here.

The following was added:

1. Registration fields:

  • email confirmation
  • password confirmation
  • country
  • recaptcha

Email confirmation and password confirmation are configurable fields. By default they are shown, but if you wish to remove one or both of them you have to set it in the file constants.php:


2. Table fields:

  • the user ip,
  • number of logins of a user,
  • flag is_admin
  • flag is_blocked
  • new table – Country table

3. dbcontroller class sanitizes user input data

4. Edit Account Area

5. Admin Area – incomplete (for next version)

For now just the list of users is shown and a world map indicating where the users come from.  You can delete Users and set them as Admins. If there are no users to list, no map is shown. Also the User seeing the panel is not shown.
Note that in the demo you will not be able to see the admin part – for admin reasons 🙂

6. New CSS

7. Some other small details in the php code.

For the next version I am planning to :

  • add all admin functions
  • improve and improve ….

To use the recaptcha you need to get a public/private key here . Then you need to define them in constants.php:


In order to use the demo for those who have registered in the previous version’s demo, you need to register again (in the demo login system), since I had to set up another database for it.

Hope you like it. Any suggestions or improvements are welcome!


Download the source code here

Tagged with:


Chadking is an absolute geek that rarely leaves the comfort of his 3-screen desk. He is a self taught programmer and is addicted to all possible legal drugs.

Stay up to date with the latest web design and development news and relevant updates from Codrops.

CSS Reference

Learn about all important CSS properties from the basics with our extensive and easy-to-read CSS Reference.

It doesn't matter if you are a beginner or intermediate, start learning CSS now.

Feedback 287

Comments are closed.
  1. Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web068/b681/ipg.sorcher/loginsystem/php/constants.php on line 7

    There is no text line at constants.php. so i dunno how to solve this :/

  2. Hey Morten,

    What does your script say in public_index.php on line 2? That’s obviously the source of your problem.

  3. Hi Chad,

    I have noticed a little issue (Firefox and IE):
    If a user types his email in the form on the page password_forget.php and then presses the Enter (or Return) key instead of clicking “Send”, the page will refresh instead of validating the input with jQuery.

    Also I think it would be nice if the Enter key could be used to submit ANY OF THE FORMS (like register/index.php) in the login system.
    At the moment, this is not working with either Firefox or IE. With Google Chrome, the entire form is reset.
    This may not be working now because you have used a link (anchor) to submit the forms instead of an input type=”submit”.

    Could you please let me know how this can be fixed?

    Thank you and best regards,

  4. ?????? ??????
    Fatal error: Call to undefined function mb_internal_encoding() in T:\home\localhost\3\php\dbcontroller.php on line 13

    ??? ??? ? ???? ???????: “mb_internal_encoding(“UTF-8”);

  5. hi chad,

    Thanks a lot for this great script I’m working on my new website and want to integrate this login system on it i know nothing about php except some basics. can u please help me
    1. to put a link on top to display the status whether usr is logged in and if user is logged in then the logout link ( basically login and logout link) just a small link

    2. small login form as i want to put that on my main page so that any visitor can login by the time he enters the site or how can i adjust the current login form in 160px wide colum as when usr logs in messages of login stays at top with other links i want to make them log in on main page and keep them at their with logged in status at top

    like i made it with other script but its very confusing to alter

  6. Thanks for the script I’m working on it for a project of mine.

    Two things…

    First, there seems to be an awful lot of ../ when I think you mean ./ for example the public_index.php script has them in 10 places all of which seem to cause problems for the script. The other files seem to work okay.

    Second, is there anyway to do this without the Captcha? There isn’t really a requirement for it in my project as it’s only sitting on a local server so having a web based identification system doesn’t really work.

    I’m not sure where I need to look to prevent this from being activated.

    Thanks for your help.

  7. can somebody help me with this error..

    Warning: require_once(../php/core.php) [function.require-once]: failed to open stream: No such file or directory in /home/www/ on line 2

    Fatal error: require_once() [function.require]: Failed opening required ‘../php/core.php’ (include_path=’.:/usr/local/php5/share/pear’) in /home/www/ on line 2

    if somebody can help please send me a msg to

  8. That’s the problem I was having. Simply change the “../” to “./” and the problem will be fixed.

    ./ = current directory
    ../ = go back one directory

    The problem is that it’s trying to go back a directory instead of looking in the current directory where the file actually is.

  9. @Roberte: You can fix that “enter” bug by adding the following code into the initEventHandlers function at the top of the passwprocess.js file…

    if ($(‘#form_passwprocess’)) {
    return false;

    Make sure that “return false;” line is in there though, otherwise it will try to use the standard submission processing.

  10. The register form layout is broken when using IE7, the capcha box and submit button are out of position

  11. Hello. When an admin logs in, no map is shown? How can you get the map to display?


  12. Hi..

    This is great, however, I’ve hit a point which I don’t understand.

    When it gets to the dbregister function and attempts to run the insert

    $q = “insert into users(pk_user,email,flname,password,usr_confirm_hash,country_code,usr_ip) values(‘NULL’,’$email’,’$flname’,’$pass’,’$hash’,’$country_code’,’$ip’)”;

    I find the insert fails because the db field usr_resetpassword_hash is not allowed to be null be the insert.
    I’m still reading through the code but can’t see how this is supposed to work. Can anyone point me in the right direction..


  13. Chadking,

    Like everyone else here, I love what you’ve done and also thank you for all the time that you have taken, and continue to take, to talk to everyone about it.

    I had messed around with the previous jpmaster’s script and really liked its “active user” feature–it will show what registered users have been active lately. Is any of that legacy code still left in the current version of this project? If so, how difficult would it be to reactivate that function? If not, any thoughts?

    Thanks for your time!

  14. Got an issue where I get an “an error occurred bla bla bla” popup whenever I try and register. Using an unmodified install, only change I did is add the <?php to register.php. I think it is the javascript throwing the error but I can't work out what is causing it. Any ideas?

  15. Hello!

    I’ve studied the code and could improve a lot, but I have a question …
    I only receive confirmation emails in hotmail, why?
    I have tested with gmail and yahoo and I do not receive a confirmation email = (

    • Hi Nicolas, maybe something concerning your mail server configuration? Are the emails landing in the spam at least?

  16. I only received the emails in the hotmail box, I tested on Yahoo and Gmail and do not appear in the inbox much less marked as spam = (

    The configuration file is correct, I have not changed …

    What could be the problem? The configuration of mail that gives me my hosting?

    Maybe you could be?

  17. I can’t seem to find any instructions for installation. Do you have any such instructions? Thanks.