Mobile Browser Identification
Posted: Fri May 13, 2011 3:53 pm
one question! how can i combine this to lines so thei wil work togeder?
for the browser identity, i have a functions.php file witch has the browser name like so:
for the browser identity, i have a functions.php file witch has the browser name like so:
$pre = $_SERVER['HTTP_USER_AGENT']; if(strpos($pre, "Firefox")!=0) $navegador = "Firefox"; else if(strpos($pre, "AppleWebKit/533.19.4")!=0) $navegador = "Safari"; else if(strpos($pre, "AppleWebKit/534.24")!=0) $navegador = "Chrome"; else if(strpos($pre, "MSIE 9.0")!=0) $navegador = "Internet Explorer 9"; else if(strpos($pre, "MSIE 8.0")!=0) $navegador = "Internet Explorer 8"; else if(strpos($pre, "MIDP-2.1")!=0) $navegador = "BlackBerry 8520"; else if(strpos($pre, "AppleWebKit/530.17")!=0) $navegador = "Samsung Galaxy 3"; else if(strpos($pre, "AppleWebKit/533.1")!=0) $navegador = "HTC Desire"; else if(strpos($pre, "MIDP-2.0")!=0) $navegador = "Samsung GT-S3550"; else $navegador = "Unknown";and the index.php file witch displayes everithing like so:
$pre = $_SERVER['HTTP_USER_AGENT']; if(strpos($pre, "Firefox")!=0) echo"<img src='img/firefox.jpg' width='250' height='250' />"; else if(strpos($pre, "AppleWebKit/534.24")!=0) echo "<img src='img/chrome.jpg' width='250' height='250' />"; else if(strpos($pre, "AppleWebKit/533.19.4")!=0) echo "<img src='img/safari.jpg' width='250' height='250' />"; else if(strpos($pre, "MIDP-2.1")!=0) echo "<img src='img/blackberry.JPG' width='150' height='150' />"; else if(strpos($pre, "MSIE 8.0")!=0) echo "<img src='img/ie.jpg' width='250' height='250' />"; else if(strpos($pre, "MSIE 9.0")!=0) echo "<img src='img/ie.jpg' width='250' height='250' />"; else if(strpos($pre, "AppleWebKit/530.17")!=0) echo "<img src='img/samsung.jpg' width='150' height='150' />"; else if(strpos($pre, "AppleWebKit/533.1")!=0) echo "<img src='img/htc.jpg' width='150' height='150' />"; else if(strpos($pre, "MIDP-2.0")!=0) echo "<img src='img/samsung.jpg' width='150' height='150' />"; else echo"Unknown";how could i get the same functionality but in one file?