WebWorld misc helper

Password Protection

Download a small PHP helper for protecting a web page with a login and password, with the original setup notes preserved below.

Protect a page with a login

This free PHP script allows you to protect your web pages with a simple login and password. Instead of linking directly to your main page, visitors must pass through this login script first.

How it works

Edit the password-protect.php script and update:

  • $users: your usernames, passwords and emails
  • $protect: the page to protect
  • $owner and $owneremail: your details
  • $url: the login page location

Important: For better security, place login.html and protected.html in a folder outside the public www or public_html directory. If you keep them public, users might bypass the protection by directly visiting protected.html.

Installation

  1. Upload the files to your server in ASCII mode.
  2. Edit password-protect.php with your login details.
  3. Set file permissions (CHMOD) to 755 if needed.
  4. Test with your browser.

Download

Download the complete package

If you use this script, please consider linking back to misc.webworld.nu.

WebWorld Traffic Exchange

Find Your Next Domain Name

Every successful business starts with a strong online identity. Register a memorable domain name for your company, project, blog, or online store and take the next step toward growing your presence on the web.