Giter Club home page Giter Club logo

php-login-one-file's Introduction

php-login-one-file

A simple, but secure PHP login script in one file and a flat-file SQLite database.

No installation needed, ready to go in under 60 seconds. 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 these functions available in these versions too).

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

Advanced version (not maintained anymore) Similar to the minimal version, but full of features. Uses PDO, Captchas, mail sending via SMTP and much more. https://github.com/panique/php-login-advanced

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+ (with PDO and SQLite extension activated)

Installation (quick setup)

Run the install script _install.php in the _installation folder which will create a users.db file (the database). That's it.

Installation (very detailed setup)

A very detailed guideline here in this blog post.

Important security note

In the default setup the database - which is only a simple users.db file - can be downloaded directly. To prevent this, change the path of your database file! A path that is not accessable by public is perfect. The .htaccess in the project only works if you have set AllowOverride to All in your vhost / apache config.

Short guide

The index.php does all the action, please look into the code for more info, everything is commented. The install script _install.php creates a database (a file named users.db) right into the root folder. The .htaccess protects your database file from being downloaded. The password_compatibility_library.php is only loaded automatically when you use a PHP version older than 5.5 to add the new PHP 5.5 password hashing functions to these older PHP versions. The _debug.php is a little helper tool, it simply echoes out the content of the database.

Useful links

License

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

Contribute

Please commit only in develop branch). The master branch will always contain the stable version.

Support

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

Buy Me A Coffee

php-login-one-file's People

Contributors

bitdeli-chef avatar cmeeren avatar cunidev avatar grahamcampbell avatar panique avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-login-one-file's Issues

Call to a member function bindValue() on a non-object

When registering a new user, I get this error.
Fatal error: Call to a member function bindValue() on a non-object in C:\inetpub\wwwroot\index.php on line 308

Running PHP 5.5, so I'm not sure what's going on. Logging in gives the same error on line 212

Unable to install script

Hi,
I am trying to install the script in a remote server (It works in my local server) but when I run the install on /_installation/_install.php, I get this error from php:
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /var/www/sevisprocess/test/Sevis-Batch/_installation/_install.php:16 Stack trace: #0 /var/www/sevisprocess/test/Sevis-Batch/_installation/_install.php(16): PDO->__construct('sqlite:../users...') #1 {main} thrown in /var/www/sevisprocess/test/Sevis-Batch/_installation/_install.php on line 16

I assumed the script cannot create the DB due to permissions issue but I already tried 777 in my root folder and still get the same error.

Lol

" If you meet the inventor of PDO, punch him. Seriously." ( ~Chris @panique )

~
LOL. i have to test this project .. panique rocks !
image
The issue function had been hacked. Sorry about that .. i could not control myself . ๐Ÿค˜
lol

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.