i found the solution, i just made a compare between HTTP_REFERER
and the HTTP_HOST
using strpos
, if they match that mean there is no hotlinking. the code :
if($_SERVER['HTTP_REFERER']) { if(!strpos($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST'])) { $redirect='index.php'; header("Location: $redirect"); } }