A small login to add to top of online testing scripts

Submitted by Anonymous (not verified) on Tue, 11/17/2009 - 18:12

Sometimes we write a script and need to test it online or on a special domain / IP. And we dont want that public people and web crawlers access the page. We just need a very small Authentication Code. This three-line code could help to protect your beta scripts while developing or testing. Just change 'mypassword' to any word what you like.

<?php

session_start();
if(
$_POST[pwd] ) $_SESSION[admin] = md5( $_POST[pwd] );
if(
$_SESSION[admin] != md5('mypassword') ) die("<center><form method='post'>under construction <input name='pwd' style='border: none;'></form></center>");

?>

Add new comment