This commit has been accessed 558 times via Git panel.
commit dcbb305fdf4be71d58471e99472d17949b24addb
tree a8bd0190419e705224ebbf3552c3ed09ea51c814
parent d66ba64c1b5791850e3c96c7e848ab7c6bf0ec1c
author Engels Antonio <engels@majcms.org> 1318827763 +0800
committer Engels Antonio <engels@majcms.org> 1318827763 +0800
Shorten filedrop path with microtime()
diff --git a/filedrop.php b/filedrop.php
index ec50965..51372e2 100644
--- a/filedrop.php
+++ b/filedrop.php
@@ -14,19 +14,17 @@ if (isset($_FILES['filedrop_obj']) and !empty($_FILES['filedrop_obj']) and isset
if ($_FILES['filedrop_obj']['size'] <= $max_file_size) {
- $filedrop_dir = sha1($_SESSION['logged_uid']);
-
$filedrop_box = $_POST['filedrop_box'];
$filedrop_nom = str_replace(" ", "_", $_FILES['filedrop_obj']['name']);
- if (!file_exists(".tmp/$filedrop_dir/$filedrop_box")) {
- mkdir(".tmp/$filedrop_dir/$filedrop_box",0700,1);
+ if (!file_exists(".tmp/$filedrop_box")) {
+ mkdir(".tmp/$filedrop_box",0700,1);
}
- if (!file_exists(".tmp/$filedrop_dir/$filedrop_box/$filedrop_nom")) {
+ if (!file_exists(".tmp/$filedrop_box/$filedrop_nom")) {
- $res = copy($_FILES['filedrop_obj']['tmp_name'], ".tmp/$filedrop_dir/$filedrop_box/$filedrop_nom");
+ $res = copy($_FILES['filedrop_obj']['tmp_name'], ".tmp/$filedrop_box/$filedrop_nom");
unlink($_FILES['filedrop_obj']['tmp_name']);
echo "<script>alert(\"{$_FILES['filedrop_obj']['name']} saved as $filedrop_nom\");</script>";
}
diff --git a/index.php b/index.php
index e66608f..8612c9a 100644
--- a/index.php
+++ b/index.php
@@ -768,7 +768,8 @@ if (isset($_SESSION['logged_uid'])) {
if ($_SESSION['logged_lvl'] == "subscriber") {
- $filedrop_box = date("YmdHis");
+ //$filedrop_box = date("YmdHis");
+ $filedrop_box = sha1(microtime(true));
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
@@ -782,34 +783,27 @@ if (isset($_SESSION['logged_uid'])) {
if (isset($_POST['filedrop_box']) and !empty($_POST['filedrop_box'])) {
- $do_filedrop_dir = sha1($_SESSION['logged_uid']);
$do_filedrop_box = $_POST['filedrop_box'];
- if (file_exists(".tmp/$do_filedrop_dir/$do_filedrop_box") and (count(glob(".tmp/$do_filedrop_dir/$do_filedrop_box/*")) > 0)) {
+ if (file_exists(".tmp/$do_filedrop_box") and (count(glob(".tmp/$do_filedrop_dir/$do_filedrop_box/*")) > 0)) {
$do_reply_from = extract_emails_from($reply_from);
$do_reply_to = extract_emails_from($reply_to);
- $do_filedrop_num = $_SERVER['SERVER_NAME'] . $do_reply_from[0] . $do_reply_to[0] . $reply_subj;
-
- $do_filedrop_num = sha1($do_filedrop_num);
-
if (!file_exists("filedrop")) {
mkdir("filedrop",0700);
}
- rename(".tmp/$do_filedrop_dir/$do_filedrop_box","filedrop/$do_filedrop_num");
-
- rmdirr(".tmp/$do_filedrop_dir");
+ rename(".tmp/$do_filedrop_box","filedrop/$filedrop_box");
- $do_filedrop_msg = glob("filedrop/$do_filedrop_num/*");
+ $do_filedrop_msg = glob("filedrop/$filedrop_box/*");
sort($do_filedrop_msg);
reset($do_filedrop_msg);
foreach ($do_filedrop_msg as $do_filedrop_put) {
- $reply_body = $reply_body . "\r\n\r\n" . str_replace("filedrop/$do_filedrop_num/","",$do_filedrop_put) . " (" . HumanReadableFilesize(filesize($do_filedrop_put)) . ")\r\n" . "http://" . $_SERVER['SERVER_NAME'] . "/$do_filedrop_put";
+ $reply_body = $reply_body . "\r\n\r\n" . str_replace("filedrop/$filedrop_box/","",$do_filedrop_put) . " (" . HumanReadableFilesize(filesize($do_filedrop_put)) . ")\r\n" . "http://" . $_SERVER['SERVER_NAME'] . "/$do_filedrop_put";
}
}
}
tree a8bd0190419e705224ebbf3552c3ed09ea51c814
parent d66ba64c1b5791850e3c96c7e848ab7c6bf0ec1c
author Engels Antonio <engels@majcms.org> 1318827763 +0800
committer Engels Antonio <engels@majcms.org> 1318827763 +0800
Shorten filedrop path with microtime()
diff --git a/filedrop.php b/filedrop.php
index ec50965..51372e2 100644
--- a/filedrop.php
+++ b/filedrop.php
@@ -14,19 +14,17 @@ if (isset($_FILES['filedrop_obj']) and !empty($_FILES['filedrop_obj']) and isset
if ($_FILES['filedrop_obj']['size'] <= $max_file_size) {
- $filedrop_dir = sha1($_SESSION['logged_uid']);
-
$filedrop_box = $_POST['filedrop_box'];
$filedrop_nom = str_replace(" ", "_", $_FILES['filedrop_obj']['name']);
- if (!file_exists(".tmp/$filedrop_dir/$filedrop_box")) {
- mkdir(".tmp/$filedrop_dir/$filedrop_box",0700,1);
+ if (!file_exists(".tmp/$filedrop_box")) {
+ mkdir(".tmp/$filedrop_box",0700,1);
}
- if (!file_exists(".tmp/$filedrop_dir/$filedrop_box/$filedrop_nom")) {
+ if (!file_exists(".tmp/$filedrop_box/$filedrop_nom")) {
- $res = copy($_FILES['filedrop_obj']['tmp_name'], ".tmp/$filedrop_dir/$filedrop_box/$filedrop_nom");
+ $res = copy($_FILES['filedrop_obj']['tmp_name'], ".tmp/$filedrop_box/$filedrop_nom");
unlink($_FILES['filedrop_obj']['tmp_name']);
echo "<script>alert(\"{$_FILES['filedrop_obj']['name']} saved as $filedrop_nom\");</script>";
}
diff --git a/index.php b/index.php
index e66608f..8612c9a 100644
--- a/index.php
+++ b/index.php
@@ -768,7 +768,8 @@ if (isset($_SESSION['logged_uid'])) {
if ($_SESSION['logged_lvl'] == "subscriber") {
- $filedrop_box = date("YmdHis");
+ //$filedrop_box = date("YmdHis");
+ $filedrop_box = sha1(microtime(true));
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
@@ -782,34 +783,27 @@ if (isset($_SESSION['logged_uid'])) {
if (isset($_POST['filedrop_box']) and !empty($_POST['filedrop_box'])) {
- $do_filedrop_dir = sha1($_SESSION['logged_uid']);
$do_filedrop_box = $_POST['filedrop_box'];
- if (file_exists(".tmp/$do_filedrop_dir/$do_filedrop_box") and (count(glob(".tmp/$do_filedrop_dir/$do_filedrop_box/*")) > 0)) {
+ if (file_exists(".tmp/$do_filedrop_box") and (count(glob(".tmp/$do_filedrop_dir/$do_filedrop_box/*")) > 0)) {
$do_reply_from = extract_emails_from($reply_from);
$do_reply_to = extract_emails_from($reply_to);
- $do_filedrop_num = $_SERVER['SERVER_NAME'] . $do_reply_from[0] . $do_reply_to[0] . $reply_subj;
-
- $do_filedrop_num = sha1($do_filedrop_num);
-
if (!file_exists("filedrop")) {
mkdir("filedrop",0700);
}
- rename(".tmp/$do_filedrop_dir/$do_filedrop_box","filedrop/$do_filedrop_num");
-
- rmdirr(".tmp/$do_filedrop_dir");
+ rename(".tmp/$do_filedrop_box","filedrop/$filedrop_box");
- $do_filedrop_msg = glob("filedrop/$do_filedrop_num/*");
+ $do_filedrop_msg = glob("filedrop/$filedrop_box/*");
sort($do_filedrop_msg);
reset($do_filedrop_msg);
foreach ($do_filedrop_msg as $do_filedrop_put) {
- $reply_body = $reply_body . "\r\n\r\n" . str_replace("filedrop/$do_filedrop_num/","",$do_filedrop_put) . " (" . HumanReadableFilesize(filesize($do_filedrop_put)) . ")\r\n" . "http://" . $_SERVER['SERVER_NAME'] . "/$do_filedrop_put";
+ $reply_body = $reply_body . "\r\n\r\n" . str_replace("filedrop/$filedrop_box/","",$do_filedrop_put) . " (" . HumanReadableFilesize(filesize($do_filedrop_put)) . ")\r\n" . "http://" . $_SERVER['SERVER_NAME'] . "/$do_filedrop_put";
}
}
}