phpcloaking

php link cloak via base64 encryption -- need help


I used to have a script that basically base64 encoded the link and then the redirect PHP page would decode it and send you off to the page.

I don't know what I am doing wrong and PHP is not my best skill, just looking for some help.

Link on page:

<a href="http://www.XXXXXX.com/find.php?shop=<?php echo urlencode(base64_encode("long ass link goes here"));  ?>">Test</a> 

find.php:

< ?php

    $request_id = $_GET ['shop'];
    $site = base64_decode($request_id);

    header( 'Location: $site' ) ;

?>

Solution

  • If you want to use $variables in strings, use double quotes:

    header("Location: $site");
    

    Or concatenate the strings:

    header('Location: '.$site);
    

    More info here

    +++ But better store that value into $_SESSION, because users can change it and it will bring up errors.