Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

php-login-minimal

> 编程语言
Open source

An extremely minimal login / register script in pure PHP.

617 stars0 likes2 views
WebsiteGitHub

About

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)

  • Detailed tutorial for installation on Ubuntu 12.04 LTS
  • Detailed tutorial for installation on Windows 7 and 8 (useful for development)

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

  • A little guideline on how to use the PHP 5.5 password hashing functions and its "library plugin" based PHP 5.3 & 5.4 implementation
  • How to setup latest version of PHP 5.5 on Ubuntu 12.04 LTS. Same for Debian 7.0 / 7.1:
  • How to setup latest version of PHP 5.5 on Debian Wheezy 7.0/7.1 (and how to fix the GPG key error)
  • Notes on password & hashing salting in upcoming PHP versions (PHP 5.5.x & 5.6 etc.)
  • Some basic "benchmarks" of all PHP hash/salt algorithms

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! :)

I'm blogging...

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

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHP

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言