Exemplo n.º 1
0
}
//Get colour scheme
if (isset($_SESSION['color_scheme_session'])) {
    $color_scheme_code = $_SESSION['color_scheme_session'];
}
$color_scheme = color_scheme($color_scheme_code);
//Set the view mode: thumbnails or list
if (isset($_SESSION['view_mode_session'])) {
    $view_mode = $_SESSION['view_mode_session'];
}
//Set the display language
if (isset($_SESSION['lang_id'])) {
    $local_text = set_local_text($_SESSION['lang_id']);
    $lang_id = $_SESSION['lang_id'];
} else {
    $local_text = set_local_text($default_language);
    $lang_id = $default_language;
}
?>
<!-- Output basic HTML code -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>dirLIST - <?php 
if (empty($url_folder)) {
    echo "Index of: home/";
} else {
    echo "Index of: home/" . $url_folder . "/";
}
?>
//some servers return empty $_POST and $_FILES arrays when the file size is too large
if (empty($_POST) || empty($_FILES)) {
    header("Location: ../index..php?err=" . base64_encode("upload_error"));
    exit;
}
//check if file is too big
if ($_FILES['file']['error'] == 1) {
    header("Location: ../index..php?folder=" . $_POST['folder'] . "&err=" . base64_encode("size"));
    exit;
}
//check if any file was uploaded
if ($_FILES['file']['error'] == 4) {
    header("Location: ../index..php?folder=" . $_POST['folder'] . "&err=" . base64_encode("nofile"));
    exit;
}
$local_text = empty($_SESSION['lang_id']) ? set_local_text(0) : set_local_text($_SESSION['lang_id']);
if ($_POST['submit'] == $local_text['upload']) {
    $file_name = $_FILES['file']['name'];
    if (get_magic_quotes_gpc()) {
        $file_name = stripslashes($_FILES['file']['name']);
    }
    $folder = base64_decode($_POST['folder']);
    substr($folder, -1, 1) != "/" && !empty($folder) ? $folder .= "/" : $folder;
    $new_path = '../' . $dir_to_browse . $folder . $file_name;
    if (in_array(strtolower(strrchr($file_name, ".")), $banned_file_types)) {
        header("Location: ../index..php?folder=" . $_POST['folder'] . "&err=" . base64_encode("upload_banned"));
        exit;
    }
    $same_file_counter = 1;
    while (is_file($new_path)) {
        $file_ext_comp = strrchr($file_name, '.');