×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: purwa astawa
Added: May 16, 2014 3:55 AM
Views: 18
Tags: no tags
  1. <?php
  2. $iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
  3. $android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
  4. $palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
  5. $berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
  6. $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
  7.  
  8. if ($iphone || $android || $palmpre || $ipod || $berry == true)
  9. {
  10.     echo "<script>window.location='http://m.site.com'</script>";
  11.  }
  12. ?>