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: Supercharge your marketing across design, automations, analytics, and more, using our marketing smarts.


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.

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. Just downloaded PHP Login System. I have a problem with register/index.php I get an error at line 100 indicating “E_PARSE syntax error, unexpected”}
    at index.php line 100″ Using PhpED as development tool. Tried to find unbalanced “{}” in index.php but find none. Also checked /php/core.php thinking it may be there but no luck. Any ideas?

  2. Anyone seen a problem in /register/index.php regarding line 100 and a ‘unexpected “}”‘? I am using PhpEd to run through and understand the code. Code seems to run until I get to the login screen and select “register”.
    The code looks correct and I looked for places where an extra “}” may be, found none
    getSessionInfo()->isLoggedIn()) {
    echo “Registered”;
    echo “We’re sorry $session->username, but you’ve already registered. ”
    .”Main.”;
    }
    else {
    ?>

    Registration

    Personal Details
    First and Last name

    Country

    For inserting a country, just start typing and wait a little. A drop down is going to be shown and you can pick your country.

    Account Details
    E-Mail

    Repeat E-Mail

    Password

    Repeat password

    Verification

    var RecaptchaOptions = {
    theme: ‘clean’,
    lang: ‘en’
    };

    Register

  3. Hi chad!
    great script!

    I have a question, how can I add additional field such as birthdate, contact etc.. I tried to add those fields but when I start to modify your script, everything doesn’t work.. can anyone help me, what should I do or where can I add additional fields?

    thanks..

  4. could anyone here kindly help to advise how to update a field in TABLE users? i’d tried to add in core.php following

    $this->dbcontroller->updateUserField($this->sessioninfo->getUserKey(), “my_field_name”, “my_data”)

    $this->dbcontroller->query(“my_query_here”);

    and even add a public function in dbcontroller.php to call it from core.php

    the executions work OK, but NONE of them really update the field in TABLE users.

    Any advice is highly appreciate.

  5. Hi, is it possible to change the content of each users page so I can add things to a diffenernt users page than everyone elses.

    Thanks for the script 😛

  6. MY captcha is not working?? Its saying: input error: K: format of the site key is not valid

  7. Hi ChadKing,
    Firstly, thankyou for the code, save me a lot of time, very much appreciated.
    Can you please relink the public and private keys I am trying to download them but I get an ERROR 404, or maybe explain to me how I would go about generating my own.
    Great! Work!
    toadz…

  8. Hi I am facing this error: What is meant:
    Input error: k: Format of site key was invalid.

    How i can solve to it

  9. hello how are you i need some help. im trying to create two different register pages, “one for customers and one for resellers”, and i have created the tables in my database:

    “users”
    “resellers”
    “active_users”
    “active_guests”
    “banned_users”
    now im trying to have the info for when customers sign up for the approicate pages and have the info go to the right pages. code below:

    function addNewUser($username, $password, $email, $firstname, $lastname, $address, $addressline2, $city, $state, $zip, $phone, $fax, $addresstype, $companyname, $businessphone, $resellpermitnumber, $issuedstate, $monthly){
    $time = time();
    /* If admin sign up, give admin user level */
    if(strcasecmp($username, ADMIN_NAME) == 0){
    $ulevel = ADMIN_LEVEL;
    }else{
    $ulevel = USER_LEVEL;
    }
    $z = “INSERT INTO “.TBL_USERS.” VALUES (‘$username’, ‘$password’, ‘0’, $ulevel, ‘$email’, $time, ‘$firstname’, ‘$lastname’, ‘$address’, ‘$addressline2’, ‘$city’, ‘$state’, ‘$zip’, ‘$phone’, ‘$fax’, ‘$addresstype’, ‘$businessphone’)”;
    mysql_query($z, $this->connection);

    $q = “INSERT INTO “.TBL_RESELLERS.” VALUES (‘$username’, ‘$password’, ‘0’, $ulevel, ‘$email’, $time, ‘$firstname’, ‘$lastname’, ‘$address’, ‘$addressline2’, ‘$city’, ‘$state’, ‘$zip’, ‘$phone’, ‘$fax’, ‘$addresstype’, ‘companyname’, ‘$businessphone’, ‘$resellpermitnumber’, ‘$issuedstate’, ‘$monthly’)”;
    return mysql_query($q, $this->connection);
    }

    but when i test it out. its not working. its repeating in info from one register page and puts into both, while the other page comes up as errors. how can i have these two pages inerts the proper info into the two different page without errors ?

    thank you
    sketchone

  10. Has anyone tried to use PostgreSQL with these scripts instead of MYSQL.
    The MYSQL version runs alright but when I am try to convert to PostgreSQL nothing seems to work and its just a blank page!

  11. hey chadking, i no this was posted like 4 years ago but if you still look at it I need, some help, for some reason every time I try and type a country for a registration form nothing shows up and on the bottom of the browser it says error on page, please someone get back to me as soon as possible cause i kind of want to get this project done. thanks for you time

  12. I am implementing this system in POSTGRESQL, finally it seems to work but there looks some problem in the javascript portion as the register, edit profile and send password button doesnt work. Has anyone done something similar?

  13. Got an issue where I get an “an error occurred bla bla bla” popup whenever I try and register. I think it is the javascript throwing the error. Any ideas?