开发者

Re-directing a user if they submit a URL shortener

开发者 https://www.devze.com 2023-03-31 02:32 出处:网络
I\'m trying to re-direct a user if $displayurlis 开发者_运维问答equal to bit.ly, goo.gl,or owl.ly.It\'s not working.Is there anything wrong with the IF statement below?

I'm trying to re-direct a user if $displayurl is 开发者_运维问答equal to bit.ly, goo.gl, or owl.ly. It's not working. Is there anything wrong with the IF statement below?

$site1 = 'http://' . $cleanurl;

$displayurl = parse_url($site1, PHP_URL_HOST);


if ($displayurl == array(bit.ly, goo.gl, owl.ly))
{

   session_write_close();
   header("Location:http://www.domain.com/directory/file.php");
   exit;

}


you have to use this code:

$domain = array("bit.ly", "goo.gl", "owl.ly");
if (in_array($displayurl, $domain)) {
   session_write_close();
   header("Location:http://www.domain.com/directory/file.php");
   exit;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消