Anyone know why the following code snippet isn't working?
<?php
function DetectTextBrowser() {
if (ereg("Lynx",$HTTP_USER_AGENT)) {
$TEXT_ONLY_BROWSER="yes";
} else if (ereg("links",$HTTP_USER_AGENT)) {
$TEXT_ONLY_BROWSER="yes";
} else if (ereg("emacs",$HTTP_USER_AGENT)) {
$TEXT_ONLY_BROWSER="yes";
} else if (ereg("w3m",$HTTP_USER_AGENT)) {
$TEXT_ONLY_BROWSER="yes";
} else if (ereg("wwwoffle",$HTTP_USER_AGENT)) {
$TEXT_ONLY_BROWSER="yes";
} else {
$TEXT_ONLY_BROWSER="no";
}
return "$TEXT_ONLY_BROWSER";
}
$ISITTEXT=DetectTextBrowser();
if (strstr($ISITTEXT,"yes")) {
echo "Text Only Browser";
} else if (strstr($ISITTEXT,"no")) {
echo "Graphical Browser";
} else {
echo "error";
}
echo "<P>$HTTP_USER_AGENT";
?>
No matter what- it returns graphical browser.
php 4.0.5 on Linux/Apache
Any suggestions appreciated