Mode 1:- Open file
admin.phpAt top of this file, add
<?php
require('authorized.php');
function error ($error_message) {
echo $error_message."
";
exit;
}
if ( (!isset($PHP_AUTH_USER)) || !
(($PHP_AUTH_USER == $LOGIN) && ( $PHP_AUTH_PW ==
"$PASSWORD" )) ) {
header("WWW-Authenticate: Basic
entrer=\"Form2txt admin\"");
header("HTTP/1.0 401 Unauthorized");
error("<h3>Unauthorized access...</h3>");
}
function removedir ($dirb)
{
$dh=opendir($dirb);
while ($file=readdir($dh))
{
if($file!="." && $file!="..")
{
$fullpath=$dirb."/".$file;
if(!is_dir($fullpath))
{
unlink($fullpath);
}else{
removedir($fullpath);
}
}
}
closedir($dh);
if(rmdir($dirb))
{
print "Directory:<font
color="#FFCC00">[b]$dirb[/b]</font> deleted.<p
/>";
return true;
}else{
return false;
}
}
if ($_REQUEST['submitted'])
{
$dirc= "$abpath/$select";
removedir ($dirc);
}
?>
- Make file
authorized.phpContent
<?php
$LOGIN = "Your Login Name";
$PASSWORD = "Your Password";
?>
You can hide file authorized.php in some sub folder and edit line
require('authorized.php'); in code before to request right location of authorized.php. Ex : require('bao/ve/login/authorized.php');
Mode 2:Base on code Rapidleech
- In file
admin.php add line
include("login.php");
- Make file
login.phpContent
<?php
$login = true; # false - Authorization mode is off, true - on
$users = array('dleviet' => '123456'); # false - Authorization mode is off, enter the username and password in the given way
if ($login === true && (!isset($_SERVER['PHP_AUTH_USER']) || ($loggeduser = logged_user($users)) === false))
{
header("WWW-Authenticate: Basic realm=\"DataLife Engine Vietnam Support\"");
header("HTTP/1.0 401 Unauthorized");
exit("<center><h2><a href=http://dleviet.com>DataLife Engine Vietnam Support</a> : Access Denied - Wrong Password or Username</h2>\n</center>");
}
function logged_user($u)
{
global $_SERVER;
foreach ($u as $user => $pass)
{
if ($_SERVER['PHP_AUTH_USER'] == $user && $_SERVER['PHP_AUTH_PW'] == $pass)
return true;
}
return false;
}
?>
A little h@ck to protect admin file