monkey_boys
monkey_boys

Reputation: 7348

How to redirect if not from $_SERVER['HTTP_REFERER']?

<?PHP
if (ereg("www\.test", $_SERVER['HTTP_REFERER']) != true)
{
    header("location http://www.example.com");
    end;
}
    echo "111";
        //dosomting?
?>

It still not working

Upvotes: 0

Views: 1137

Answers (1)

Jacob Relkin
Jacob Relkin

Reputation: 163318

Try this:

<?php

   if (!preg_match("www\.test", $_SERVER['HTTP_REFERER'])) {
      header("Location: http://www.example.com");
      exit();
   }
   //do stuff...

?>

Upvotes: 3

Related Questions