A PHP & MySQL login script built into a skeleton MVC application. Part of the PHP-LOGIN project.
Thanks for 1.000+ stars and 400+ forks. Wow!
This script is part of the PHP Login Project, a collection of four similar login scripts for different use-cases.
This script here is the MVC framework version.
Find the official portal page of the project here: php-login.net.
Follow the project on Twitter,
Facebook or
Google+ and have a look on the official support blog
Dev Metal.
Ask questions in the Official Support Forum.
Full login script in one file. Uses a one-file SQLite database (no MySQL needed) and PDO. Features: Register,
login, logout.
All the basic functions in a clean file structure, uses MySQL and mysqli. Register, login, logout.
Same like minimal (uses MySQL and PDO), but much more features:
Register, login, logout, email verification, password reset, edit user data, gravatars, captchas,
remember me / stay logged in cookies, “remember me” supports parallel login from multiple devices,
login with email, i18n/internationalization, mail sending via PHPMailer (SMTP or PHP’s mail() function/linux sendmail).
See a live demonstration or see the server’s phpinfo().
Also make sure you know the basics of object-oriented programming and MVC, are able to use the command line and have
used Composer before. This script is not for beginners.
Licensed under MIT. Totally free for private or commercial projects.
Please commit only in develop branch. The master branch will always contain the stable version.
If you think this script is useful and saves you a lot of work, then think about supporting the project:
Bookmark the highly related partner-project “php-login-styles” which
will host beautiful themes for php-login and the eventually also for the smaller version (see above).
This project has not been started yet.
See active issues and requested features here:
https://github.com/panique/php-login/issues?state=open
See the milestone tracking of 2.0 and the upcoming 3.0 (early 2015) here:
https://github.com/panique/php-login/issues/milestones
This installation guideline uses Ubuntu 12.04 LTS (as it is the standard and by far the most long-term supported
mainstream server OS (supported until 2017). For more, see the
Wikipedia page of Ubuntu versions.
When developing in a Vagrant box: please note that it’s quite difficult to identify a Vagrant box to Facebook’s App API,
so currently there’s no guideline on how to use the Facebook login-feature when using a LOCAL Vagrant box.
For more, see this StackOverflow question.
sudo apt-get install php5-gd, restart Apache sudo service apache2 restartsudo apt-get install openssl, restart Apache sudo service apache2 restartrm -r /var/www/*,git clone https://github.com/panique/php-login.git /var/www or by creating thecomposer create-project panique/php-login /var/www dev-masterchmod 775 /var/www/public/avatars and check its rights with stat /var/www/public/avatarsIn application/config/config.php:
true and put in your SMTP provider credentials ((I use SMTP2GO)). Please remember:In .htaccess:
cd /var/www) and do composer install on the command lineVoila! You app should now run fine.
WARNING: Facebook has changed their API behaviour and introduced versioning, disallowing NEW applications to make use of their 1.0 API. If you registered your “Facebook developer application” later than April 30th 2014, you cannot use the “normal” 1.0 API anymore. The 2.x API versions removed the “username” property and will therefore break php-login. EXISTING applications (=API key) will not break, as they are still allowed to use API 1.0. Sorry, but it will take some time to provide a proper fix.
Note: Facebook changes the look, the UI and the way the Facebook App pages work permanently. But you’ll find out what’s
meant. Go to https://developers.facebook.com/apps/ and create a new app.
Go to “preferences” or whatever it is called, enter your email adress, leave “App Domain” empty, click on “Add platform”
and put your URL in “Site URL” (completely with “http://www.”), save. For local development “localhost” works.
Things like “127.0.0.1” don’t seem work. In earlier version of Facebook’s App API you needed to set “sandbox mode” to
“deactivated”, now… well… I don’t know, they have removed the button but the app still says “in development mode”.
Set FACEBOOK_LOGIN in application/config/config.php to true and put your Facebook app id and the secret token
in FACEBOOK_LOGIN_APP_ID and FACEBOOK_LOGIN_APP_SECRET.
You should see the Facebook login / register buttons on the login / register page of your php-login app now.
You can find more in the project’s github wiki.
Then have a look into the partner project PHP-MVC on http://www.php-mvc.net and https://github.com/panique/php-mvc.
A super-reduced and naked bare-bone application.
https://github.com/facebook/facebook-php-sdk
https://developers.facebook.com/docs/php/gettingstarted/
PHPMailer
https://packagist.org/packages/phpmailer/phpmailer
PHP password compatibility library
https://packagist.org/packages/ircmaxell/password-compat
Facebook SDK
https://packagist.org/packages/facebook/php-sdk
Gregwar’s Captcha
https://packagist.org/packages/gregwar/captcha
Kint (a better var_dump)
https://packagist.org/packages/raveren/kint
This project is kindly powered by PHPStorm. A big “Thank You!” to IntelliJ for giving php-login free licenses of this wonderful IDE.
I’m available for freelance work. Remote worldwide or locally around Central Europe. Mail me if you like.