Sign out'; if (isset($_GET) && count($_GET) > 0) { $getstring = "?" . http_build_query($_GET); } else { $getstring = ""; } if (isset($_GET['signout'])) { if (isset($_COOKIE['password'])) { unset($_COOKIE['password']); setcookie('password', null, -1, '/', $_SERVER['SERVER_NAME']); header('Location: ' . $url); } } if ($_POST && $pass) { if ((hash("sha256", $_POST['password']) == $pass)) { if (isset($_POST['rememberme'])) { /* Set cookie to last 1 year */ setcookie('password', hash("sha256", $_POST['password']), time()+60*60*24*365, '/', $_SERVER['SERVER_NAME'] ); } else { /* Cookie expires when browser closes */ setcookie('password', hash("sha256", $_POST['password']), false, '/', $_SERVER['SERVER_NAME'] ); } header('Location: ' . $url . $getstring); } else { header('Location: ' . $url); exit(); } } else if ($pass) { if (!isset($_COOKIE["password"]) || (isset($_COOKIE["password"]) && $_COOKIE["password"] != $pass)) { ?> Irn-Bru


Remember me

= $sys['size'] && $i < $depth) { $size /= $sys['size']; $i++; } return sprintf($retstring, $size, $sys['prefix'][$i]); } $nameurl = "?C=N;O=A"; $modifiedurl = "?C=M;O=A"; $sizeurl = "?C=S;O=A"; if (isset($_GET['C'])) { $sort = preg_split("/;O=/", $_GET['C']); if ($_GET['C'] == "N;O=A") { $nameurl = "?C=N;O=D"; } else if ($_GET['C'] == "M;O=A") { $modifiedurl = "?C=M;O=D"; } else if ($_GET['C'] == "S;O=A") { $sizeurl = "?C=S;O=D"; } } $listing = array(); date_default_timezone_set("GB"); #print_r(listdir_by_date("./")); $files_directory = "./"; $new_array = array(); $files = array(); $fdirectory = opendir("$files_directory"); while ($file = readdir($fdirectory)) { if (($file == ".") || ($file == "..")) { } else { array_push($files, $file); } } foreach ($files as $key=> $file) { $c_date = filemtime("$files_directory/$file"); $new_array[$c_date] = $file; $size_array[$c_date] = filesize("$files_directory/$file"); } if (isset($sort)) { if ($sort[0] == "M") { if ($sort[1] == "A") { ksort($new_array); } else { krsort($new_array); } } else if ($sort[0] == "N") { if ($sort[1] == "A") { asort($new_array); } else { arsort($new_array); } } } else { krsort($new_array); } $listsize = 0; while ($this_array = each($new_array)){ $value = $this_array['value']; $key = $this_array['key']; // Only show last X entries if requested if (isset($_GET['last']) && ($listsize > $_GET['last'] - 1)) { break; } // Drop if on index ignore list if (in_array($value, $indexignore)) { continue; } // Drop if outside (optional) date range if (isset($_GET['from'])) { $from = $_GET['from']; // If $from has a -, assume not Unix time if (strpos($from, "-") !== false) { $from = strtotime($from); } if (isset($_GET['to'])) { $to = $_GET['to']; // If $to has a -, assume not Unix time if (strpos($to, "-") !== false) { $to = strtotime($to); } } else { $to = time(); } if ($key < $from || $key > $to) { continue; } } $fileparts = explode('.', strtolower($value)); $icon = "unknown"; switch ($fileparts[count($fileparts)-1]) { case "png": case "jpg": case "gif": case "bmp": case "jpeg": case "svg": $icon="image2"; break; case "exe": case "jar": case "class": case "apk": $icon="binary"; break; case "c": case "cpp": case "h": $icon="c"; break; case "doc": case "docx": case "dot": case "dotx": case "odt": case "ott": case "oth": case "odm": case "xls": case "xlsx": case "ppt": case "pptx": $icon="layout"; break; case "avi": case "mkv": case "wmv": case "ogv": case "3gp": case "divx": case "mov": $icon="movie"; break; case "pdf": $icon="pdf"; break; case "ps": $icon="ps"; break; case "java": case "php": case "html": case "htm": case "xml": case "cs": case "sh": case "bat": case "js": case "jsp": case "py": case "cgi": case "pl": $icon="script"; break; case "wav": $icon="sound1"; break; case "mp3": case "ogg": case "wma": case "aac": $icon="sound2"; break; case "tex": $icon="tex"; case "txt": case "rtf": case "log": $icon="text"; break; case "zip": case "rar": case "gz": case "bz2": case "tar": case "tgz": case "7z": case "iso": $icon="compressed"; break; default: $icon="unknown"; break; } $listing[$listsize]['filename'] = utf8_encode($value); $listing[$listsize]['type'] = $icon; $listing[$listsize]['modified'] = $key; $listing[$listsize]['size'] = $size_array[$key]; $listsize++; } clearstatcache(); if (!isset($_GET['format']) || $_GET['format'] == "html") { ?> Index of /
Icon  Name                    Last modified      Size        

23) { $preview = substr($listing[$i]['filename'], 0, 20) . "..>"; } else { $preview = $listing[$i]['filename']; } $spaces = ""; for ($j = 0; $j < (24 - strlen($preview)); $j++) { $spaces = $spaces . " "; } echo '[IMG] ' . $preview . '' . $spaces . date("d-M-Y H:i", $listing[$i]['modified']) . ' ' . size_readable($listing[$i]['size'], null, "bi") . ' ' . "\n"; } ?>
Apache Server at " . $_SERVER['SERVER_NAME'] . " Port " . $_SERVER['SERVER_PORT'] . ""; ?> ' . $listing[$i]['filename'] . '
'; } } ?>