Simple login functions for a non-critical app

Login without a database on a non-critical web site. A simple form for simple tasks.

Caution: For non-critical use only

About

login_script.php allows a user to login and logout. It is intended to be lightweight. A few options can be customized in the script.

The script is for use where a "simple pseudo login" is desired, with no concern for security. This could be in games, mock-up sites, etc. The script provides a form in which you can input a username and a password, just like any other login form. But is does this entirely without a database.

NOTE: Do NOT use this script to password-protect anything that you consider critical. This script is not for password protecting sites on the WWW. Security is not very high, and while no "average joe" will be able to bypass it given a sufficiently safe password, the password may easily be cracked by an expert.

Usage

  1. Download php file
  2. Customize php file to suit your needs
  3. Include php file in your project

Re "Customize": Please note that this script only provides the relevant login/-out functions. In order to stay lightweight it does not include additional database functions. You would probably want to put your user names and passwords in a database. Also, you may want to validate form input and POST/GET requests.

NOTE: This is a basic template with the bare necessities only. It is intended only as a starting point. You should take care of security, databases, input validation etc., as you see fit.

Try it

Demo

Version and License

Version

Current version: 0.2

License

What? Free!

Source Code and Download

Source code

Please click the "download" link below and the full script will be visible as a plain text file: "login_script.php.txt"

Download

login_script.php.txt (10.6kB) (right-click the link, and choose "Save link/target as...")

IMPORTANT: After the download, rename the file to login_script.php in order to use it. Feel free to choose any other name if that suits you better.

The extra ".txt" filetype extension was set to enable you to view the source code, it will not work in php.