diff options
author | Luke Bratch <luke@bratch.co.uk> | 2020-07-09 11:32:49 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2020-07-09 11:32:49 +0100 |
commit | 12289bbe0e4ea8836ed631a1dec743b0e11f28f6 (patch) | |
tree | c0712eaa81730ed92ca37179d8e884826d1e72c3 /submit.php | |
parent | 73ce50c869166e51d95d0c24d7dd6a9d715a4b71 (diff) |
Diffstat (limited to 'submit.php')
-rw-r--r--[-rwxr-xr-x] | submit.php | 10 |
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 ); } ?> |