Commit b20a972d authored by Luke Bratch's avatar Luke Bratch
Browse files

Make redirect work with any hostname or path

No related merge requests found
Showing with 10 additions and 2 deletions
+10 -2
<?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 );
}
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment