Mam stronie gdzie po nacisnięciu otwiera mi sie nowe okienko ( java ) i w tym okienku o ustalonych rozmiarach pokazują się ulotki. W przeglądarce jednak widać link do tej strony zatem może ktoś na nią wejśc jesli dostanie linka. Chciałem wstawić kod aby te podstrony z ulotkami otwierały się tylko z tej samej domeny a jesli ktos bedzie chciał wejsc docelowo przez linka byłby kierowany na strone główną.
Znalazłem taki kod ale nie działa mi to jak należy :
Kod
<?
// this parse's into the following: $url["scheme"], $url["host"], $url["path"]
$url = parse_url($HTTP_REFERER);
//$url["host"] could be in uppercase so.. new var to lower
$check=strtolower($url["host"]);
// checks proper domain only
// no reffer needed
if ($check!='your.domain.com')
{
echo "<meta http-equiv=\"refresh\" content=\"0; url=http://your.domain.com/warn_page_or_redirect\">";
exit;
}
?>
// this parse's into the following: $url["scheme"], $url["host"], $url["path"]
$url = parse_url($HTTP_REFERER);
//$url["host"] could be in uppercase so.. new var to lower
$check=strtolower($url["host"]);
// checks proper domain only
// no reffer needed
if ($check!='your.domain.com')
{
echo "<meta http-equiv=\"refresh\" content=\"0; url=http://your.domain.com/warn_page_or_redirect\">";
exit;
}
?>
Czy to jest dobry kod? I czy ktoś mi moze pomoc bo nie jestem master z php
