Initial commit
[2ch-be.git] / dev-test / old_dev / test.php
blob0d32dcbc6a554c38652945e8e57ecd85ff852d6d
1 <?php
3 function detect_device($value){
4 $breaker = 2;
5 echo $iPod = preg_match("/iPod/i", $value);
6 echo $iPhone = preg_match("/iPhone/i", $value);
7 // echo $iPhone.'xxx'
8 echo $iPad = preg_match("/iPad/i", $value);
9 // $Android = stripos($value,"Android");
10 echo $webOS = (preg_match("/Safari/i",$value)) ? 2 : 0;
11 //do something with this information
12 $finalBreaker = $breaker+$webOS+$iPhone+$iPod+$iPad;
13 echo "<br> finalBreaker: ".$finalBreaker."<br>";
14 // $value = array(3);
15 // echo ".xx";
16 if($finalBreaker==3){
17 return "DONTDISPLAY";
18 }else{
19 return "PLSDISPLAY";
22 echo " Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D257 <br>";
23 // echo $_SERVER['REMOTE_ADDR']."<br>";
24 // echo detect_device("Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) Safari/537.51.2 (KHTML, like Gecko) Mobile/11D257)")."<br>";
25 if(detect_device("Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D257") == "PLSDISPLAY"){
26 // if(detect_device($_SERVER['HTTP_USER_AGENT']) == "PLSDISPLAY"){
27 echo "PLSDISPLAY";
28 }else{
29 echo "dont display";