login for admin

open /admin/index.php

add the code at the begining of the original script,

-----------------------------

/*
  mar/07/2006
  read help following, add this login script under win32 because of there has no protection of admin
  http://sourceforge.net/mailarchive/forum.php?thread_id=9815975&forum_id=12321
*/

center();
title();
login();

function s($variable) {
    $s = Array();
    $s['username'] = md5("your_name"); // Enter your administration username
    $s['password'] = md5("your_password"); // Enter your administration password
    return $s[$variable];
}

function l($variable) {
    $l = Array();
    $l['username'] = "Username";
    $l['password'] = "Password";
    $l['login'] = "Login";
    $l['already_logged'] = "Already logged in";
    $l['logout'] = "Logout";
    return $l[$variable];
}

function title() {
    if ($_POST['Submitted'] == "True") {
        if (md5($_POST['Username']) == s('username') && md5($_POST['Password']) == s('password')) {
            $_SESSION['Logged_In'] = "True";
            $_SESSION['Username'] = s('username');
     }
    }
}

function center() {

  switch ($_GET['action']) {
    case "logout":
        session_start();
        $_SESSION = array();
        session_destroy();

        echo ' ';
        break;

    default:
        return;
  }
}

function login() {
    if ($_SESSION['Logged_In'] != "True") {
        echo "";
        echo "

Login

";
        echo '
       


'. l(username) . ':


       

'. l(password) . ':


       


       


        ';
        exit;

    } else {
        echo '';
        echo '

' .l('already_logged'). '


';
        echo '

'. l('logout') .'

';
        echo '';
    }
}
?>

-----------------------------

文章標籤
全站熱搜
創作者介紹
創作者 xiaolabaDIY 的頭像
xiaolabaDIY

xiaolabaDIY 的部落格

xiaolabaDIY 發表在 痞客邦 留言(0) 人氣(1)