Login form and login functions in PHP

A plugin for login on a web site.


login_script.php is a component for a web site, written in php. It allows the user to login and logout. It is intended to be lightweight. A few options can be customized in the script.


  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


Version and License


Current version: 0.1


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"


login_script.php.txt (8.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.