php - Check if referral on list and print alert -


i'd code check if referrer url of visitor website registered on list, give 1 alert or another. have tried this, doesn't work, , can check if visitor coming specific url, not checking list want:

<?php if (ref.match(/^https?:\/\/([^\/]+\.)?friendsite\.com(\/|$)/i)) {   alert("you came friend website");   else { alert("you came non friendly webstie"); } ?> 

   if(!empty($_server['http_referef'] ) {// if there referer        $host = parse_url($_server['http_referer'], php_url_host); // parse site (remove page, protocol, etc        if(in_array($host, array('site.com', 'friend.ru'))) {            echo "<script>alert(\"etc\")</script>";        }    } 

Comments