<?php
/*=============================================================
php simple page login ver. 0.2
---------------------------------------------------------------
(c) 2007 Arie Firmansyah
Website: http://tanpa.info
License:  Freely copy & use, but include this notice.
--------------------------------------------------------------
This script is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability of fitness for a particular purpose.
--------------------------------------------------------------
question, bugs, support, idea or money :)?
contact me from email or website contact form.
===============================================================*/


$adminpass = "5f4dcc3b5aa765d61d8327deb882cf99"; //password is "password" (md5 encryption).

session_start();

function admin(){
if(isset($_GET['logout'])) {
unset($_SESSION['logpassneh']);
echo"<META HTTP-EQUIV=\"refresh\" CONTENT=\"0; URL=$_SERVER[PHP_SELF]\">"; }

else {
// this page secret if you correct enter password.
echo"<h1>Login Successful....<br />This is Page Secret<br />Thanks for Login</h1>
<a href=\"$_SERVER[PHP_SELF]?logout=1\">Logout</a>";
// end of page secret
} }

if(isset($_POST['password'])) {
    $_POST['password']=md5($_POST['password']);
    if($_POST['password']==$adminpass) {
        $_SESSION['logpassneh'] = $_POST['password'];
        admin(); }
    else {
        $wrong = explode("'", "Invalid password! ' Try Again?");
        echo"<h1><font color=red>$wrong[0]</font></h1><a href=\"$_SERVER[PHP_SELF]\">$wrong[1]</a>"; } }

elseif(isset($_SESSION['logpassneh'])) {
    if($_SESSION['logpassneh']==$adminpass) {
        admin(); } }

else {
echo"
<form method=POST>
<input type=password size=15 name=password> 
<input type=submit name=login value=\"LOGIN !\">
</form>"; }
?>