i have 1 file named header-guest.php
when you are open this link http://royta.ir/badurl
this code will run:
if(!isset($headerload)){
if(isset($_COOKIE['userid'])){
include_once('tmp/header.php');
}
else{
include_once('tmp/header-guest.php');
}
}
and when you click on بازگشت به خانه
with ajax this code will run in #content
if(!isset($headerload)){
if(isset($_COOKIE['userid'])){
include_once('tmp/header.php');
}
else{
include_once('tmp/header-guest.php');
include_once('block/index-visitor.php');
}
}
and in header-guest.php we have this code
<? echo $sitetitle; $headerload = 1;?>
but when you click on badurl and then click on بازگشت به خانه
header-guest.php will run 2 times
how i prevent it?