I am writing a PHP module where I need to check if the incoming link is coming from a particular page.
I have 2 pages :
- Services.php :
I have a
href
something like this
<a href="product.php">SUBSCRIBE NOW</a>
- Product.php : Here I check, if the incoming link is from services.php using the following code :
$ref_url = $_SERVER['HTTP_REFERER']; $refData = parse_url($ref_url); if (strpos($refData['path'],'services.php') !== false ) { // Subscribe_Module } else { //Other }
This works fine, as long as the user clicks on the
<a href="product.php">SUBSCRIBE NOW</a>
However, there is a side effect, when the user is on services.php page and then clicks on product.php on the header, it executes, the subscribe_module
in the PHP. Any idea, how to fix it ?
Thanks