Hiding values in URL’s 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 );
Advertisement

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.