summaryrefslogtreecommitdiff
path: root/submit.php
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2020-07-09 11:32:49 +0100
committerLuke Bratch <luke@bratch.co.uk>2020-07-09 11:32:49 +0100
commit12289bbe0e4ea8836ed631a1dec743b0e11f28f6 (patch)
treec0712eaa81730ed92ca37179d8e884826d1e72c3 /submit.php
parent73ce50c869166e51d95d0c24d7dd6a9d715a4b71 (diff)
Redirect to HTTP or HTTPS depending on which protocol the request came from.HEADmaster
Diffstat (limited to 'submit.php')
-rw-r--r--[-rwxr-xr-x]submit.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/submit.php b/submit.php
index 2be2b1b..5bbc1bf 100755..100644
--- a/submit.php
+++ b/submit.php
@@ -7,15 +7,21 @@
$hostname = $_SERVER['SERVER_NAME'];
}
+ if ($_SERVER['HTTPS'] == "on") {
+ $protocol = "https";
+ } else {
+ $protocol = "http";
+ }
+
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://" . $hostname . $path . $id );
+ header( "Location: " . $protocol . "://" . $hostname . $path . $id );
}
else {
- header( "Location: http://" . $hostname . $path );
+ header( "Location: " . $protocol . "://" . $hostname . $path );
}
?>