示例#1
0
文件: function.php 项目: TauThickMi/M
function createConfig($username = LOGIN_USERNAME_DEFAULT, $password = LOGIN_PASSWORD_DEFAULT, $pageList = PAGE_LIST_DEFAULT, $pageFileEdit = PAGE_FILE_EDIT_DEFAULT, $pageFileEditLine = PAGE_FILE_EDIT_LINE_DEFAULT, $pageDatabaseListRows = PAGE_DATABASE_LIST_ROWS_DEFAULT, $isEncodePassword = true)
{
    $content = "<?php if (!defined('ACCESS')) die('Not access'); else \$configs = array(";
    $content .= "'username' => '{$username}', ";
    $content .= "'password' => '" . ($isEncodePassword ? getPasswordEncode($password) : $password) . "', ";
    $content .= "'page_list' => '{$pageList}', ";
    $content .= "'page_file_edit' => '{$pageFileEdit}', ";
    $content .= "'page_file_edit_line' => '{$pageFileEditLine}', ";
    $content .= "'page_database_list_rows' => '{$pageDatabaseListRows}'";
    $content .= '); ?>';
    if (@is_file(REALPATH . '/' . PATH_CONFIG)) {
        @unlink(REALPATH . '/' . PATH_CONFIG);
    }
    $put = @file_put_contents(REALPATH . '/' . PATH_CONFIG, $content);
    if ($put) {
        return true;
    } else {
        $handler = @fopen(REALPATH . '/' . PATH_CONFIG, "w+");
        if ($handler) {
            if (@fwrite($handler, $content)) {
                @fclose($handler);
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
    return true;
}
示例#2
0
define('ACCESS', true);
define('LOGIN', true);
include_once 'function.php';
if (IS_LOGIN) {
    goURL('index.php');
} else {
    $title = 'Đăng nhập';
    $notice = null;
    if (isset($_POST['submit'])) {
        $notice = '<div class="notice_failure">';
        $username = addslashes($_POST['username']);
        $password = addslashes($_POST['password']);
        if ($username == null || $password == null) {
            $notice .= 'Chưa nhập đầy đủ thông tin';
        } else {
            if (strtolower($username) != strtolower($configs['username']) || getPasswordEncode($password) != $configs['password']) {
                $notice .= 'Sai tài khoản hoặc mật khẩu';
            } else {
                $_SESSION[SESS] = true;
                goURL('index.php');
            }
        }
        $notice .= '</div>';
    }
    include_once 'header.php';
    if (IS_INSTALL_ROOT_DIRECTORY) {
        echo '<div class="title">Lỗi File Manager</div>
<div class="list">Bạn đang cài đặt File Manager trên thư mục gốc, hãy chuyển vào một thư mục. Bạn có thể đăng nhập nhưng tất cả các chức năng đều bị ẩn và chặn</div>';
    }
    echo '<div class="title">' . $title . '</div>';
    echo $notice;
示例#3
0
文件: setting.php 项目: TauThickMi/M
 if (strlen($username) < 3) {
     echo '<div class="notice_failure">Tên đăng nhập phải lớn hơn 3 ký tự</div>';
 } else {
     if (!empty($passwordO) && getPasswordEncode($passwordO) != $configs['password']) {
         echo '<div class="notice_failure">Mật khẩu cũ không đúng</div>';
     } else {
         if (!empty($passwordO) && (empty($passwordN) || empty($verifyN))) {
             echo '<div class="notice_failure">Để thay đổi mật khẩu hãy nhập đủ hai mật khẩu</div>';
         } else {
             if (!empty($passwordO) && $passwordN != $verifyN) {
                 echo '<div class="notice_failure">Hai mật khẩu không giống nhau</div>';
             } else {
                 if (!empty($passwordO) && strlen($passwordN) < 5) {
                     echo '<div class="notice_failure">Mật khẩu phải lớn hơn 5 ký tự</div>';
                 } else {
                     if (createConfig($username, !empty($passwordN) ? getPasswordEncode($passwordN) : $configs['password'], $pageList, $pageFileEdit, $pageFileEditLine, $pageDatabaseListRows, false)) {
                         include PATH_CONFIG;
                         $username = $configs['username'];
                         $passwordO = null;
                         $passwordN = null;
                         $verifyN = null;
                         $pageList = $configs['page_list'];
                         $pageFileEdit = $configs['page_file_edit'];
                         $pageFileEditLine = $configs['page_file_edit_line'];
                         $pageDatabaseListRows = addslashes($_POST['page_database_list_rows']);
                         echo '<div class="notice_succeed">Lưu thành công</div>';
                     } else {
                         echo '<div class="notice_failure">Lưu thất bại</div>';
                     }
                 }
             }