PHP Login System Reloaded

Update: There’s a new version of this Login Script. Here’s a PHP Login System, based on the one developed by jpmaster77: PHP Login System with Admin Features Focusing only on […]

Update: There’s a new version of this Login Script.

Here’s a PHP Login System, based on the one developed by jpmaster77: PHP Login System with Admin Features
Focusing only on the core functionalities and aimed to improve certain parts of the code, I took out some functionalities and added some others:

Removed:

  • Admin features
  • Active guests, active users, banned users
  • Global variables
  • Links to other pages after the login

All these can be easily reintegrated if you want. I focused on the login and registration part, leaving out the content “inside”.

Added:

  • PHP 5 instead of PHP 4
  • mysqli extension
  • Send registration confirmation link to the email address
  • Reset password feature without sending password to the email. Instead a link is sent to reset the password
  • UTF8 support
  • InnoDB transactions for database operations
  • Registration and form validations made with AJAX
  • jQuery
  • Captcha image in registration form to avoid spam

Here are the most important settings for the installation of the login system.
Set database access in constants.php:

define("DB_SERVER", "localhost");	//type mysql server url
define("DB_USER", "XXXXXXX");		//type mysql user
define("DB_PASS", "XXXXXXX");		//type mysql password
define("DB_NAME", "XXXXXXX");		//type mysql database name

Further, you have to set the right location of the following files for the mail sending functions:

define("RESETPASSWORDLINK","http://www.tympanus.net/loginsystem/resetpassword.php");
define("CONFIRMACCOUNTLINK","http://www.tympanus.net/loginsystem/php/confirm.php");

The only table that you have to create in your MySQL database is the following:

CREATE TABLE users(
pk_user int unsigned not null auto_increment,
email 	varchar(120) not null,
flname varchar(100) not null,
password varchar(64) not null,
usr_signup_date timestamp not null default CURRENT_TIMESTAMP,
usr_userid varchar(32),
# for the account confirmation:
usr_confirm_hash varchar(255) not null,
# after confirming its set to 1:
usr_is_confirmed tinyint(1) not null default 0,
# when the user resets password (forgot password):
usr_resetpassword_hash varchar(255) not null,
unique index(email),
primary key(pk_user)
)type=innodb DEFAULT CHARACTER SET utf8	COLLATE utf8_general_ci;

I will soon post a new version, as I am currently improving some points.

See a demo here: PHP Login System Demo

You can download the source code here: PHP Login System ZIP

Tiny break: 📬 Want to stay up to date with frontend and trends in web design? Subscribe and get our Collective newsletter twice a tweek.

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.

Stay in the loop: Get your dose of frontend twice a week

👾 Hey! Looking for the latest in frontend? Twice a week, we'll deliver the freshest frontend news, website inspo, cool code demos, videos and UI animations right to your inbox.

Zero fluff, all quality, to make your Mondays and Thursdays more creative!

Feedback 71

Comments are closed.
  1. Hey Chad,
    thanks for the great login system. I installed everything correctly (I’m pretty sure) and I get “an error ocurred bla bla we should put a message for this”. This occurred right after I pressed ‘Register”. I checked the code and found the error trap in ‘register.php’, but in looking at the ‘else if’ statement, can’t make sense of the ‘data.result == “-2”. Any help please? Thanks again

  2. Everybody must know that the submit button can not work on testing server that is not connected to the internet. And if a user is manually entered into the table the sha1 in the core.php where the _login() function is called should be removed if not you will be having “invalid password” message.