summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsubmit.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/submit.php b/submit.php
index 538fee9..2be2b1b 100755
--- a/submit.php
+++ b/submit.php
@@ -1,13 +1,21 @@
<?php
+ $path = str_replace( basename( $_SERVER['SCRIPT_NAME'] ), "", $_SERVER['SCRIPT_NAME'] );
+
+ if ( isset( $_SERVER['HTTP_HOST'] ) ) {
+ $hostname = $_SERVER['HTTP_HOST'];
+ } else {
+ $hostname = $_SERVER['SERVER_NAME'];
+ }
+
if( isset( $_POST["paste"]) && $_POST["paste"] != "" ) {
$paste = $_POST["paste"];
$id = dechex( crc32( $paste ) );
$fh = fopen( $id, "w" );
fwrite( $fh, $paste );
fclose( $fh );
- header( "Location: http://p.of.je/$id" );
+ header( "Location: http://" . $hostname . $path . $id );
}
else {
- header( "Location: http://p.of.je" );
+ header( "Location: http://" . $hostname . $path );
}
?>