ack 🙂
Ok lemme describe this best I can.
All PHP scripts must reside withing the <?php...?> tags. These tags tell the server to begin parsing PHP...
<?php
The first line checks to see if the built-in variable HTTP_REFERER has been set...
if (isset($HTTP_REFERER)) {
If that variable does indeed have a value, then next we check to see if that value is one gained from clicking your link at paypal...
if ($HTTP_REFERER == "https://www.paypal.com") {
If the user was referred from paypal, then they are valid. I put an echo here, but this is where you would display other stuff. You can echo an entire form, or an entire page.
echo "REFERRED FROM PAYPAL - VALID";
}else {
The line below is executed if HTTP_REFERER is set, but they didn't come from Paypal by clicking your link....
header ("Location: http://www.compudecintl.com); }
}
The lines below execute if there is no REFERER value set...
else {
header ("Location: http://www.compudecintl.com);
}
?>
I'm thinking I'm missing some part of the big picture here. Are you trying to add this code to an existing page? If so, it is already a .php file or is it .html?
It works for me by simply creating a new text file, typing it in, and naming the file something like testreferer.php, and pointing my browser toward it.
I'm not saying this is the best or only way to do this, but it's just the idea that sprang to mind 🙂 I'm sure some of the more expert members here could maybe offer a better solution.
Anyway... here's the code you need all put back together...
<?php
if (isset($HTTP_REFERER)) {
if ($HTTP_REFERER == "https://www.paypal.com") {
echo "REFERRED FROM PAYPAL - VALID";
}else {
header ("Location: http://www.compudecintl.com); }
}
else {
header ("Location: http://www.compudecintl.com);
}
?>