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: Front-end developers, save time and convert designs into clean React, Vue and HTML code using Anima


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. I think you have to look at the permission of the file admin php. I dont think you need to touch httpd.conf!

  2. Hi i have a small problem. I tried to edit an account, but the change what i made are not save to db. There are no error message in this process. Any idea?

  3. Hi, I’m working for my group website, and I plan the login system is intergrated with Social Engine Script. But I don’t have any idea how to modified your script. Thats really complicating scripts. I even can’t run it on my localhost. can you help me?

  4. i’ve solved the problem with my localhost, so now, anybody could help me to integrate it with social engine? Here’s information that you might wanna know. table name = se_users . instead using username for username records, they use user_username and user_password variables.

  5. Greetings Chadkin,
    Well, i solved my problem and it was as always quite simple as it looks right now:)
    But i have another question: if i would like to add some more fields, for example, address and city, can you please point the document where i have to make changes. I was playing around with dbcontroller.php for a while and I changed DB table, but for some reason it just does not collect the data.
    Please, let me know.
    Thanks again for a great script.

  6. Elena,

    I understand your fustration! I tried doing this several times with another php script (a previous one by jpmaster77). What you need to do is when creating new fields, you need to put them in the same order in your MySQL database as you did them in your php code. Wang bam, you should set them up just fine!

    Dan

  7. Hi Elena,
    you need first of all to add those fields in the user table. You can do that by executing something like this
    “ALTER TABLE USER ADD city VARCHAR(30) NOT NULL;”
    in the mysql database. Then, if you wish that these fields are required in the registration, you need to change the index.php of the register folder, the dbcontroller.php, and the core.php. For all these changes just follow the flow of a registration process. For example in the dbcontroller you have the function that inserts data into the user table.You need to add these additional fields to that query. But I would suggest that you start by defining them in the html of the register/index.php.
    I hope it helps.
    Greetings

  8. Daniel, I am sorry but that is not true. The order does not matter. As far as your queries are well defined, the order of the fields in the table is irrelevant. Thanks anyway for your comment!
    Greetings

  9. Chadking,

    Sorry! Its just how I got to get a previous script working, having it all well organised, etc.

    How long is it before we can expect the release of version 1.2?!

    Dan

  10. Hi, you can expect already a new release, I can’t tell you when though, but I am open for any suggestions concerning a future version of this system.
    Greetings

  11. Hey Chad,
    Excellent work with the scripts, I’m learning PHP as I go and your code has been a great asset for my learning. However I am encountering some difficulty trying to make use of the tablesorter 2.0 jQuery plugin. On the page I’m testing with I’m including index.js – I’ve added the function from the plugin to initEventHandlers. I’m receiving no errors or output, firebug shows the script is loading properly but I’m not receiving any of the intended results.

    Do you have something else setup to protect changes or have you modified jQuery in any way?

    Thanks!

    On a side note i used your “handler” method – using Core.php to call upon functions I’ve dropped into another fd_dbcontroller function and its working great. I’ve done this for consistency but is there a performance gain to be had by hiding the members in this way?

  12. Never mind, the plugin is working fine. I just spend 90 minutes troubleshooting something that is working as intended.

  13. How can I tweak the script to redirect an specific user to an specific page instead of main.php? I’m guessing I will have to add a field in the db with the url, and then an if statement (if user = then this url) but I just don’t know enough php! Please help 🙂
    Kind regards

    • Luke, I think you can do that like you say. For that you need do add another field in the users table and change the code that checks if the user is logged in. The query that checks that should also retrieve that new field, and then you just change the line window.location = “url from db”.
      Of course you can always hardcode and say
      if user == user1
      window.location = anotherurl.php
      else
      window.location = main.php
      greetings

  14. Looks like this is just what I need for my site. I downloaded and installed the scripts and everything seemed to go ok. Got the keys for recaptcha. But when I try to register a new user, after submitting it seems to hang. just the three green flashing squares at the bottom of the page. Im sure i just missed something. Any thoughts??

    • Steve, try to see with firebug what’s being sent in the ajax response after you click register.

      greetings

  15. Steve,

    Does your host allow you to use mysqli extensions? I had that problem and decided to move host!

  16. Warning: require_once(../php/core.php) [function.require-once]: failed to open stream: No such file or directory in /hermes/bosweb/web068/b681/ipg.sorcher/loginsystem/public_index.php on line 2

    Fatal error: require_once() [function.require]: Failed opening required ‘../php/core.php’ (include_path=’.:/usr/local/lib/php-5.2.4/lib/php’) in /hermes/bosweb/web068/b681/ipg.sorcher/loginsystem/public_index.php on line 2

    Please help, i get this when i try go to http://dawnforged.com/loginsystem/public_index.php