summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.php24
-rw-r--r--upload_file.php39
2 files changed, 27 insertions, 36 deletions
diff --git a/index.php b/index.php
index e00f42a..dd34a1c 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,5 @@
<?php
-include('config.php');
+include("config.php");
$signout = '<a href="' . basename($_SERVER['PHP_SELF']) . '?signout">Sign out</a>';
@@ -19,8 +19,8 @@ if (isset($_GET) && count($_GET) > 0) {
if (isset($_GET['signout'])) {
if (isset($_COOKIE['password'])) {
unset($_COOKIE['password']);
- setcookie('password', null, -1, '/', $_SERVER['SERVER_NAME']);
- header('Location: ' . $url);
+ setcookie("password", null, -1, "/", $_SERVER['SERVER_NAME']);
+ header("Location: " . $url);
}
}
@@ -28,14 +28,14 @@ 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'] );
+ 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'] );
+ setcookie("password", hash("sha256", $_POST['password']), false, "/", $_SERVER['SERVER_NAME'] );
}
- header('Location: ' . $url . $getstring);
+ header("Location: " . $url . $getstring);
} else {
- header('Location: ' . $url);
+ header("Location: " . $url);
exit();
}
} else if ($pass) {
@@ -46,7 +46,7 @@ if ($_POST && $pass) {
<title><?php echo $logontitle ?></title>
<script type="text/javascript">
function formfocus() {
- document.getElementById('password').focus();
+ document.getElementById("password").focus();
}
window.onload = formfocus;
</script>
@@ -67,7 +67,7 @@ if ($_POST && $pass) {
$signout = "";
}
-function size_readable($size, $max = null, $system = 'si', $retstring = '%01.2f %s') {
+function size_readable($size, $max = null, $system = "si", $retstring = "%01.2f %s") {
// Pick units
$systems['si']['prefix'] = array('B', 'K', 'MB', 'GB', 'TB', 'PB');
$systems['si']['size'] = 1000;
@@ -200,7 +200,7 @@ while ($this_array = each($ordered_array)) {
}
}
- $fileparts = explode('.', strtolower($value));
+ $fileparts = explode(".", strtolower($value));
$icon = "unknown";
switch ($fileparts[count($fileparts)-1]) {
@@ -297,7 +297,7 @@ while ($this_array = each($ordered_array)) {
$icon="unknown";
break;
}
-
+
$listing[$listsize]['filename'] = utf8_encode($value);
$listing[$listsize]['type'] = $icon;
$listing[$listsize]['modified'] = $key;
@@ -337,7 +337,7 @@ for ($i = 0; $i < count($listing); $i++) {
$spaces = $spaces . " ";
}
- echo '<img src="/icons/' . $listing[$i]['type'] . '.gif" alt="[IMG]"> <a href="' . rawurlencode($listing[$i]['filename']) . '">' . $preview . '</a>' . $spaces . date("d-M-Y H:i", $listing[$i]['modified']) . ' ' . size_readable($listing[$i]['size'], null, "bi") . ' ' . "\n";
+ echo '<img src="/icons/' . $listing[$i]['type'] . '.gif" alt="[IMG]"> <a href="' . rawurlencode($listing[$i]['filename']) . '">' . $preview . "</a>" . $spaces . date("d-M-Y H:i", $listing[$i]['modified']) . " " . size_readable($listing[$i]['size'], null, "bi") . " " . "\n";
}
?>
<hr></pre>
diff --git a/upload_file.php b/upload_file.php
index a1b218e..890078a 100644
--- a/upload_file.php
+++ b/upload_file.php
@@ -1,4 +1,4 @@
-<?php include('config.php'); ?>
+<?php include("config.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
@@ -9,7 +9,7 @@
<body>
<p>
<?php
-function size_readable($size, $max = null, $system = 'si', $retstring = '%01.2f %s') {
+function size_readable($size, $max = null, $system = "si", $retstring = "%01.2f %s") {
// Pick units
$systems['si']['prefix'] = array('B', 'K', 'MB', 'GB', 'TB', 'PB');
$systems['si']['size'] = 1000;
@@ -40,29 +40,20 @@ if (isset($_SERVER['HTTPS'])) {
$url = preg_replace("/^https:\/\//", "http://", $url);
}
- {
- if ($_FILES["file"]["error"] > 0)
- {
- echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
- }
- else
- {
- if (file_exists($_FILES["file"]["name"]))
- {
- echo "Error: " . $_FILES["file"]["name"] . " already exists. ";
- }
- else
- {
- move_uploaded_file($_FILES["file"]["tmp_name"],
- "./" . $_FILES["file"]["name"]);
- echo "Uploaded: " . $_FILES["file"]["name"] . "<br>";
- $fileurl = "$url" . $_FILES["file"]["name"];
- echo "URL: <a href=\"$fileurl\">$fileurl</a><br>";
- echo "Size: " . size_readable($_FILES["file"]["size"], null, "bi");
- }
- }
+if ($_FILES["file"]["error"] > 0) {
+ echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
+} else {
+ if (file_exists($_FILES["file"]["name"])) {
+ echo "Error: " . $_FILES["file"]["name"] . " already exists. ";
+ } else {
+ move_uploaded_file($_FILES["file"]["tmp_name"], "./" . $_FILES["file"]["name"]);
+ echo "Uploaded: " . $_FILES["file"]["name"] . "<br>";
+ $fileurl = "$url" . $_FILES["file"]["name"];
+ echo "URL: <a href=\"$fileurl\">$fileurl</a><br>";
+ echo "Size: " . size_readable($_FILES["file"]["size"], null, "bi");
}
-?>
+}
+?>
</p>
<p>
<a href="<?php echo $url; ?>">Back to index</a>