fork download
  1. <?php
  2. $user_agents = array(
  3. "midp", "j2me", "iphone", "avantg", "docomo", "novarra", "palmos",
  4. "palmsource", "240x320", "opwv", "chtml", "pda", "windows\ ce", "mmp\/",
  5. "blackberry", "mib\/", "symbian", "wireless", "nokia", "hand", "mobi",
  6. "phone", "cdm", "up\.b", "audio", "sie\-", "sec\-", "samsung", "htc",
  7. "mot\-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "nec",
  8. "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover",
  9. "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal",
  10. "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "\d\d\di", "moto",
  11. "ipad", "android", "ipod", "webos");
  12.  
  13. $agent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; MAAU)";
  14.  
  15. foreach ($user_agents as $user_string) {
  16. if (preg_match("/" . $user_string . "/i", strtolower($agent)))
  17. echo "hit";
  18. }
  19.  
  20. ?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
 hit