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: Ship fast and never break a thing with Shortcut (formerly Clubhouse.io).


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:

define("REPEAT_EMAIL",true);
define("REPEAT_PASSWORD",true);

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:

define("PUBLICKEY","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
define("PRIVATEKEY","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

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!

DEMO

Download the source code here

Tagged with:

chadking

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.

http://tympanus.net/codrops/author/chadking/

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

Feedback 287

Comments are closed.
  1. WOW! chadking, this is awesome. the site is just too good. alot of improvements in here. i av been away for long.
    this is great keep it up.

  2. hey there chadking.
    this is an awesome tutorial!
    Everything works perfect.. After i click the Register button the data inserts into my database and i receive an email with the hash in it.. My problem here is when i hit the register button it hides the button and shows the loading gif as it suppose to do.. but it stuck there and doesn’t shows the next page (Confirmed or Password Reset Successfully or Register successfully go to your email and confirm..).. don’t know why but i’m guessing that the jquery does not correspond with the data==1 and textStatus==”success”..
    thenx for your time!

    • Hey pol thanks,
      could you take a look at the response you get in firebug, when you click register?

  3. i’m not sure if i understood what you meant..
    but at the console tab.. under the POST http://site/…… i get this
    {“result”:-1,”errors”:[{“name”:”email”,”value”:”Email already in use”},{“name”:”pass”,”value”:””},{“name”:”flname”,”value”:””},{“name”:”country”,”value”:””},{“name”:”confemail”,”value”:””},{“name”:”confpass”,”value”:””}]}

    hope this will help you understood my problem..
    thenx!

    • Hey pol,
      it should just print {“result”:-1} when everything is OK. I see on your website that some more things are being printed (noscript …). You should take a look at your code and check if you don’t have any syntax errors and also all php tags are in the form <?php > If you want just send me the register/index.php to codrops@googlemail.com and I will take a look.
      Cheers

  4. hey chadking,
    i’ve manage to fix it!!:) The problem was the mail().. every time i’ve tried to register; jquery was waiting to send the mail.. but the mail never send so it just stand there and waits the mail to be send and; then move on.. i’ve tricked the php.ini on my wamp server (localhost) to send a fake mail and.. the script now works perfect!
    for those with the same problem here is how to trick localhost to send fake mails..
    http://www.php.net/manual/en/ref.mail.php

  5. chadking,
    This is a great and it has saved me a lot of time. I’m having one minor issue with the error messages. You clear out the error messages, i.e. invalid email, when the field gets focus. But this doesn’t work with an invalid captcha response. I was able to get around it by explicitely clearing the captcha error message when the register button is clicked but the behavior is different than the other fields. Is there a way to know when the captcha field has focus so the error message can be cleared?

  6. Hello chad,
    i have a problem which is no related to this topic, is it okay if i just post it here or is there a way i can contact you or send it to you if not here (its about my chat system am working on).

  7. hi this is a great script.. i have problems when i try to check

    http://iba-smlm.com/loginsystem2/public_index.php

    the error is:

    Fatal error: Call to undefined function mb_internal_encoding() in /home/ibasmlm/public_html/loginsystem2/php/dbcontroller.php on line 13

    is same error with all the other files

    how can i fix it ??? thanks for your help

  8. Fatal error: Call to undefined function mysqli_connect() in H:\inetpub\vhosts\unikdesigners.com\httpdocs\php\dbcontroller.php on line 15

    Getting this error can you help me….

    define(“DB_SERVER”,”localhost”);
    define(“DB_USER”,”login”);
    define(“DB_PASS”,”biotronics”);
    define(“DB_NAME”,”najmuddin_login”);

    This is the database setting

  9. hey this script work great…
    but when i register a new user i
    cannot receive the activation e-mail or the forgot password email can somebody help with this?

  10. Fatal error: Call to undefined function mysqli_connect() in H:\inetpub\vhosts\unikdesigners.com\httpdocs\php\dbcontroller.php on line 15

    Getting this error can you help meâ?¦.

    define(â??DB_SERVERâ??,â??localhostâ??);
    define(â??DB_USERâ??,â??loginâ??);
    define(â??DB_PASSâ??,â??biotronicsâ??);
    define(â??DB_NAMEâ??,â??najmuddin_loginâ??);

    This is the database setting
    Can Any one help on this

  11. im having a problem that seems to be un answered so far from other sites i have asked this…but on your public_index.php file your version of jp’s main.php in the original he said that was a example of a main page…how can i add that to my html pages so that it will work… where it says if session is logged and right under where it has the link for edit account i added the code include(“whatever.php”); and after i logged in it sent me to that page and showed the links for edit account and log out but it messed my layout of the page up…is there any way to do it so it doesnt mess the layout up???? thank you in andvanced

  12. Chad,

    Thanks much! I am an Emergency Physician (very amateur programmer) and have no complaints only gratitude to you and the others. Installed your files on a 1and1 virtual server–all features work great! Appreciate your efforts.

    Open Source Rocks!

    -JO, Doc from Colorado

  13. I tried to change
    $objCore->getSessionInfo()->getUserInfo(‘email’)
    for
    $objCore->getSessionInfo()->getUserInfo(‘flname’)

    and db controller line 230 to

    $q = “SELECT pk_user,email,usr_userid,flname FROM users WHERE pk_user = ‘$username’”;

    with a blank page as result
    what did I do wrong? Please help because I want to use the “flname on different pages.
    thanks in advance

  14. in the recaptchalib.php file where it says “For security reasons, you must pass the remote ip to reCAPTCHA” what is it talking about??? what am i supposed to put there??

  15. Is it possible to specify a basis for the email administrator? the email that will be used by default to send the registration validation link to the user.

  16. same problem as HTF
    (March 4th, 2010 at 20:37)

    Got an issue where I get an “an error occurred bla bla bla” popup whenever I try and register.

    PLEASE HELP

    Thanks.

  17. Also believe its a javascript problem. with register.js

    maybe line 192 – //} needs removing?

    tried this, no luck.

    But am not sure what is causing data.results to = -2 not =1.

    Anyone with any ideas/solutions?

    Thanks.

  18. Ok now sorted, error in MYSQL database table.

    Now error with

    Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in ******/loginsystem/php/dbcontroller.php on line 433

    any ideas