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:

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. It doesn’t seem that I can post the code here, can you read what I posted earlier Chadking?

    Martin

  2. hi chad
    i keep running into the same 2 errors no matter how i structure the folders (as they were in the .zip or w/ everything inside public_html.

    public_index.php gives me:
    Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /homepages/34/d300058515/htdocs/login11/public_index.php on line 22

    index.php (inside register folder or outside):
    Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /homepages/34/d300058515/htdocs/login11/register/index.php on line 24

    line 22 of public_index.php and line 24 of index.php are exactly the same:
    if($objCore->getSessionInfo()->isLoggedIn()){

    if i try to access the “login11” folder, btw (which is what i name the overall login; i think you called it loginsystem2 or something) it gives me a stylized error 403 message so i guess that’s a good sign? i did re-name it correctly in “constants.php” (?) your help would be much appreciated.
    thanks,
    rob

    • Hi,
      and if you type “homepages/34/d300058515/htdocs/login11/public_html/”
      does it give the same error?
      You should not access public_index.php directly, the index.php inside of public_html does that! What you can do is remove the public_html folder, and rename public_index.php to index.php, but then you will need to check and replace in every file the references to public_html.
      greetings

  3. when i just type “…/login11/public_html/ ” i get this error message:

    “Fatal error: main() [function.require]: Failed opening required ‘../public_index.php’ (include_path=’.:/usr/lib/php’) in /homepages/34/d300058515/htdocs/login11/public_html/index.php on line 2”
    (this is the small “index.php” that was originally inside the public_html folder when i downloaded it)

    public_index.php and index.php are both currently inside the folder public_html. so if i renamed “public_index.php” to “index.php” i would have to move one 🙁
    ————–
    as an experiment, i moved index.php (the small file) into the login11 folder, and renamed public_index.php to index.php ….i get the same error messages for them in the new locations, whether i type their names directly or just the names of the folders that access them, except the error message for “index.php” references line 22 instead of 24, b/c it’s that same line of code that triggers the error 🙁 i’m a newbie. sorry.

    • rob, I am sure that’s some configuration issue in your php.ini file. I tried searching something about that and some seem to point to the “safe mode” property. I am not sure though…

  4. I am trying to run admin.php and am getting
    Fatal error: Call to undefined function mysqli_connect() in /home/www/*******/php/dbcontroller.php on line 15

    I am guessing that this is because mysqli is not enabled.
    The server is running
    php version 5.2.8
    mysql version 4.1.20

    Is there any way around this?

    Thanks

    Paul

  5. I think you need to enable the mysqli extention somewhere in php.ini, although I think it should be already by default for that vesion of php…

  6. I have now checked and mysqli is not enabled on my shared server.
    Is there any way around this – by using mysql for instance.
    No experience really in this subject so hoping for some advice.

    Thanks

    Paul

  7. Have been looking for something like this for quite some time, but nothing as simple and straightforward. Unfortunately I do not really know much about PHP, but do plan to learn. However, I need to install this on my website and there are a couple of things I need to know which do not seem to be indicated anywhere on here: 1. How do I access the admin area? After install everything worked fine, but when going to the admin.php page it redirected to the registration page and when registering it simply creates an account, but does not give me admin access. 2. Is there a way to have this automatically load the main website once the user has logged in, as opposed to merely showing the “logged in” screen? 3. How do I implement this for only one page on my site as opposed to the entire website? Thank you for your patience, and hopefully kind answers for a php newbie.

    • JohnDD,
      1- In order to be admin and be able to access the admin panel you need to set it directly in the database (usr_is_admin = 1). Once you do this, you can set as many users you want in the admin panel to be also admin.
      2- The “logged in” screen is just an example of what can be shown to the user after the login. You can show whatever you want as far as you make the logged in validation (like it’s done for that screen and for the admin.php). You can also redirect the user to the page you want:

      if (logged in)
      Location(your page)
      else
      show login form

      In your page:
      //again you need to check if the user is logged in
      if (logged in)
      show content
      else
      Location(/public_html/)

      greetings

  8. I am trialing on a different server now that supports mysqli
    When i access the register form id do not get a drop-down when i go to type the country.
    Any thoughts please?

    Paul

  9. THX THE SCRIPT IS GREAT! BUT WE NEED TO KNOW HOW ADD “EDIT USER FROM ADMIN” OR HOW ADD MORE INPUT LIKE AGE…

  10. so far am improving from my problem; but i still a lil more problem,:
    i have this error whenever i click on the user confirmation link from my mail.

    the requested URL /loginsystem/loginsystem/loginsystem/php/confirm.php was not found on this server

    what could be wrong here or with the url av checked am seeing the path is just ok.

  11. Hey dude theres a problem. I done it in dreamweaver and when I run it it IE browser and when I click the register button, theres an error here:

    Warning: require_once(sessioninfo.php) [function.require-once]: failed to open stream: No such file or directory in C:\AppServ\www\joemar\local\loginsystem\register\core.php on line 2

    Fatal error: require_once() [function.require]: Failed opening required ‘sessioninfo.php’ (include_path=’.;C:\php5\pear’) in C:\AppServ\www\joemar\local\loginsystem\register\core.php on line 2

    -What should I do PLEASE HELP ME ANYONE??

  12. hi, nice scrip, you do a very good job. i have a question. i would like to add one more filed like country, but i do not succeed. the field I’ve named device(a create a new table Device with 2 columns, device_code and device_name; in table users i insert a new row, device_code). can you tell me where i should make some change to have this filed working like country?

  13. Greetings ChadKing.

    On behalf of the community – much love goes out to you …
    This Login script looks like it could be really ‘Wow’.
    I say that becoz I have not managed to get it to work.

    i’m no programmer … so its hard for me to be specific here but the script takes my details via register form etc.
    I have created a new dbase and dropped the .sql file into it ok too.
    I noticed some files actually had dead links – straight up.

    Is there more documentation. on the script – Im afraid I need spoon feeding.

    ChadKing give thx in adv.

    DaLegsMan

  14. I am getting this” You don’t have permission to access /loginsystem1/admin.php on this server.”
    Is anybody knows what i should change in httpd.conf to get a permissin?
    Please help!!