Quick PHP Password Protection Readme

Quick PHP Password Protection is a single user PHP login system which is secure, quick to implement, and requires no database. Perfect for small web apps, scripts, and personal pages which only have a single admin using them.

Example Usage

<?php
require_once "../quickprotect.class.php";
$quickprotect = new quickprotect();
$quickprotect->checkLoginAndDirect();
?>
                

That's all it takes! One line of effective code (not counting the class include and init), and you've password protected a page!

Features

How to implement

Additional Functions

How do I check if a user is logged in?

$quickprotect->is_logged_in(); //Returns true or false

How do I change a password?

Method 1: Using the built-in function

$quickprotect->setNewPassword($oldusername, $oldpassword, $newpassword);

You may use this form template:

Current Username:

Current Password:

New Password:

Simply pass those values to the function, and your password will change

Method 2: Manually

Change the value of ADMIN_PW in the INI file to the sha1 hash of the password you want to use.

How do I do a logout?

Simply go to login.php?do=logout.