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 :
href
something like this<a href="product.php">SUBSCRIBE NOW</a>
$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
Simple, Nest another loop inside If
:)
if (strpos($refData['path'],'services.php') !== false )
{
if($_SERVER['REQUEST_URI'] == abc/services.php)
{
//call services function
}
else
{
// Subscribe_Module
}
}
else
{
//Other
}