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 [开发者_JS百科'shop'];
$site = base64_decode($request_id);
header( 'Location: $site' ) ;
?>
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.
If you copied and pasted that second code, try removing the space between <
and ?
. It should be <?php
.
精彩评论