I have an existing web site to which I want to add code that invokves a sub-directory (for browsing from a mobile device). Here is the top of the existing "index.php" file:
<?php
session_start();
$title = '';
$sidebar = '';
$body = '';
$header = 'default';I am attempting to modify this to detect a "mobile browser" (from various examples that I have found here and there on the 'net) but I am having a fundamental PHP logic problem (apparently). Here's what I modified the top of the "index.php" file to:
$mobile_browser = '0';
if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
$mobile_browser++;
}with mode that finally ends like this:
if($mobile_browser>0) {
// do something
header('Location: mobi/index.html');
}
else {
// do something else
session_start();ANy IDEAS? (Mahalo plenty ... KevInKauai)