summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar steering72532026-08-01 00:09:14 -0600
committerGravatar steering72532026-08-01 00:09:14 -0600
commit98abfb1d57333f13f9e8e2cd0836e77423fc6284 (patch)
tree12500392304e5734627bfb24d09d7c6366ab0465
parenti2p (diff)
downloadhostfiles-98abfb1d57333f13f9e8e2cd0836e77423fc6284.tar.gz
hostfiles-98abfb1d57333f13f9e8e2cd0836e77423fc6284.tar.bz2
hostfiles-98abfb1d57333f13f9e8e2cd0836e77423fc6284.zip
make a function for remote_addr
-rw-r--r--upload.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/upload.php b/upload.php
index 352fdf8..180f508 100644
--- a/upload.php
+++ b/upload.php
@@ -18,7 +18,7 @@ if ($c_t == 'application/x-www-form-urlencoded') {
header('Content-Type: text/plain');
echo "You seem like a really dumb bot that doesn't check the enctype of the form before spraying common vulnerabilities.\n";
echo "Content-Type: application/x-www-form-urlencoded is not supported.\n";
- send_notification("[hostfil.es] $_SERVER[REMOTE_ADDR] tried to $_SERVER[REQUEST_METHOD] $c_t");
+ send_notification("[hostfil.es] " . get_addr() . " tried to $_SERVER[REQUEST_METHOD] $c_t");
exit;
} elseif ($c_t == 'multipart/form-data' || 0 === strpos($c_t, 'multipart/form-data;')) {
$FILES = remap_files();
@@ -48,7 +48,7 @@ if ($c_t == 'application/x-www-form-urlencoded') {
symlink($real_filepath, $filepath);
}
echo UPLOAD_URL . $filename . "\n";
- send_notification("[hostfil.es] $_SERVER[REMOTE_ADDR] uploaded $file[full_path] $file[type] -> https://g.hostfil.es/$filename");
+ send_notification("[hostfil.es] " . get_addr() . " uploaded $file[full_path] $file[type] -> https://g.hostfil.es/$filename");
}
} else {
$in_fh = fopen('php://input', 'r');
@@ -91,7 +91,7 @@ if ($c_t == 'application/x-www-form-urlencoded') {
symlink($real_filepath, $filepath);
}
echo UPLOAD_URL . $filename . "\n";
- send_notification("[hostfil.es] $_SERVER[REMOTE_ADDR] uploaded $_SERVER[PATH_INFO] $c_t -> https://g.hostfil.es/$filename");
+ send_notification("[hostfil.es] " . get_addr() . " uploaded $_SERVER[PATH_INFO] $c_t -> https://g.hostfil.es/$filename");
}
@@ -109,7 +109,7 @@ function die_error($s, $status='500 Server Is 💩') {
echo $s . "\n";
error_log($s);
@$debug = json_encode(array('s'=>$_SERVER, 'f'=>$_FILES, 't'=>$tmp_path, 'p'=>$filepath, 'size' => $size));
- send_notification("[hostfil.es] $_SERVER[REMOTE_ADDR] ! $s\n$debug");
+ send_notification("[hostfil.es] " . get_addr() . " ! $s\n$debug");
exit;
}
@@ -153,3 +153,7 @@ function remap_files() {
}
return $files;
}
+
+function get_addr() {
+ return $_SERVER['REMOTE_ADDR'];
+}