Skip to content

Instantly share code, notes, and snippets.

@treehousetim
Created April 24, 2015 20:25
Show Gist options
  • Save treehousetim/c2ccd831dee4d9c27edb to your computer and use it in GitHub Desktop.
Save treehousetim/c2ccd831dee4d9c27edb to your computer and use it in GitHub Desktop.
<?
//http://treehousetim.com/2011/12/13/hiding-values-in-urls-using-php/
header( 'content-type: text/plain' );
$h = '';
if ( array_key_exists( 'h', $_GET ) && ! empty( $_GET['h'] ) )
{
$test = unserialize( gzuncompress( base64_decode( urldecode( urldecode( $_GET['h'] ) ) ) ) );
if ( is_array( $test ) )
{
$h = $_GET['h'];
$_GET = $test;
}
}
elseif( count( $_GET) )
{
$h = urlencode( urlencode( base64_encode( gzcompress( serialize( $_GET ), 9 ) ) ) );
}
list( $url ) = explode( '?', $_SERVER['REQUEST_URI'] );
if ( ! empty( $h ) )
{
$url .= '?h=' . $h;
}
echo $url . "\n\n";
var_dump( $_GET );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment