diff options
-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 ); } ?> |