• Stars
    star
    601
  • Rank 71,693 (Top 2 %)
  • Language
    PHP
  • Created over 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An extremely minimal login / register script in pure PHP.

php-login-minimal

A simple, but secure PHP login script. Uses the ultra-modern & future-proof PHP 5.5 BLOWFISH hashing/salting functions (includes the official PHP 5.3 & PHP 5.4 compatibility pack, which makes those functions available in these versions too).

Why does this script exist ?

In the PHP world every beginner tries to build login systems from scratch, doing all the typical mistakes, usually going from saving plain text passwords to using (horribly wrong) MD5 hashing. This script tries to give beginners a usable code base with a fully implemented user authentication ("login") system, preventing less-experienced developers at least from the worst security issues.

This script was originally part of the "php-login project", a collection of 4 different login scripts made in the 2012-2013 PHP era to give especially beginners and security-inexperienced users a set of basic auth functions that fitted the most modern password hashing standards possible. You know, this was the time when even major companies like SONY and LinkedIn used horrible outdated MD5-hashing for their passwords (or even saved everything in plain text) and when the big PHP frameworks didn't have proper user auth solution out-of-the-box.

Find the other versions here:

One-file version (not maintained anymore) Full login script in one file. Uses a one-file SQLite database (no MySQL needed) and PDO: Register, login, logout. https://github.com/panique/php-login-one-file

Minimal version (not maintained anymore) All the basic functions in a clean file structure, uses MySQL and mysqli. Register, login, logout. https://github.com/panique/php-login-minimal

HUGE (professional version) Quite professional MVC framework structure, useful for real applications. Additional features like: URL rewriting, mail sending via PHPMailer (SMTP or PHP's mail() function/linux sendmail), user profile pages, public user profiles, gravatars and local avatars, account upgrade/downgrade etc., OAuth2, Composer integration, etc. https://github.com/panique/huge

Requirements

  • PHP 5.3.7+
  • MySQL 5 database (please use a modern version of MySQL (5.5, 5.6, 5.7) as very old versions have a exotic bug that makes PDO injections possible.
  • activated mysqli (last letter is an "i") extension (activated by default on most server setups)

Installation (quick setup)

Create a database login and the table users via the SQL statements in the _install folder. Change mySQL database user and password in config/db.php (DB_USER and DB_PASS).

Installation (detailed setup tutorials)

Security notice

This script comes with a handy .htaccess in the views folder that denies direct access to the files within the folder (so that people cannot render the views directly). However, these .htaccess files only work if you have set AllowOverride to All in your apache vhost configs. There are lots of tutorials on the web on how to do this.

Useful links

License

Licensed under MIT. You can use this script for free for any private or commercial projects.

Contribute

Please create a feature-branch if possible when committing to the project, if not then simply commit to master branch.

Support

Support the project by renting a server at DigitalOcean or just tipping a coffee at BuyMeACoffee.com. Thanks! :)

Buy Me A Coffee

I'm blogging...

at DEV METAL, mostly about PHP and IT-related stuff. Have a look if you like.

More Repositories

1

huge

Simple user-authentication solution, embedded into a small framework.
PHP
2,142
star
2

mini

Just an extremely simple naked PHP application, useful for small projects and quick prototypes. Some might call it a micro framework :)
PHP
1,342
star
3

php-long-polling

An extremely simple example of a "real-time" self-updating page using long-polling.
PHP
425
star
4

mini2

Just an extremely simple naked PHP application, useful for small projects and quick prototypes.
PHP
414
star
5

mini3

Just an extremely simple naked PHP application, useful for small projects and quick prototypes.
PHP
273
star
6

php-login-one-file

PHP
219
star
7

vagrant-lamp-bootstrap

A super-simple Vagrantfile / bootstrap.sh to setup a LAMP stack inside Vagrant 100% automatically
Shell
132
star
8

php-sass

Compiles SASS to CSS automatically with pure PHP. No ruby used. One line of code. Currently uses latest SCSS 3.2 syntax, imports and mixins. Compass can also be used.
PHP
124
star
9

tiny

TINY is an extremely simple naked demo PHP application that runs nearly config-free everywhere.
PHP
80
star
10

laravel-sass

Automatic SASS-to-CSS compiling for Laravel 4 (and any other framework too), config-free, in pure PHP, works with latest SASS 3.2 .scss syntax, imports and mixins
PHP
71
star
11

pdo-debug

Emulates the SQL query constructed by PDO. The magic behind: A simple function that combines your parameters and the raw query. Not perfect, but does the job.
PHP
69
star
12

html5-video

A simple copy&paste solution for crossbrowser-safe HTML5 video with a flash fallback. 100% free and open-source. Works on all browsers. All.
HTML
58
star
13

php-login-styles

THIS PROJECT IS DEPRECATED AND HAS REACHED END OF LIFE
44
star
14

php-sass-watcher

One simple PHP file that "watches" your SASS file folder and compiles all .scss automatically every X seconds. Sounds weird, but works perfectly. Automatic SASS compiling with 100% PHP. No Ruby used.
PHP
28
star
15

simple-php-api

An extremely simple API (with authentication) example, written in PHP (server) and JS (client), using JSON
PHP
24
star
16

phpstorm-theme-github-remixed

Get GitHub's syntax highlighting / colours and fonts within PHPStorm
19
star
17

simple-php-api-client

A PHP client for using a JSON based API
Shell
13
star
18

phpstorm-theme-github-remixed-2

Get GitHub's 2014 style syntax highlighting (colours and fonts) within PHPStorm
13
star
19

php-logo

This repo tries to professionalize the current PHP logo, offering versions that fit print / web / broadcast standards, containing vector-, pixel- and css-based versions.
11
star