jeg klippede lidt i min code fra eksperten
i toppen af din index.php på
http://vlavla.dk ligger du denne code ind (utested)
<?php
require_once("browser_selector.php");
$browserstr=browser_selector();
$os=$browserstr['os'];
if($os==='mobile'){ header('Location: http://mobil.vlavla.dk'); exit;}
?>
man kunne evt ligge resultatet af browser_selector() i en session, så resultatet er tilgængelig på tværs af alle sider
browser_selector.php (utested)
<?php
function browser_selector($ua=null) {
$ua = ($ua) ? $ua : $_SERVER['HTTP_USER_AGENT'];
$ua = strtolower($ua);
$g = 'gecko';
$w = 'webkit';
$s = 'safari';
$ff = 'firefox';
$b = array();
$browser="";
$browserversion="unknown";
$os="";
// platform
if(strstr($ua, 'j2me')) {
$os = 'mobile';
} else if(strstr($ua, 'android')) {
$os = 'mobile';
} else if(strstr($ua, 'mobile')) {
$os = 'mobile';
} else if(strstr($ua, 'iphone')) {
$os = 'mobile';
} else if(strstr($ua, 'iemobile')) {
$os = 'mobile';
} else if(strstr($ua, 'ipod')) {
$os = 'ipod';
} else if(strstr($ua, 'mac')) {
$os = 'mac';
} else if(strstr($ua, 'darwin')) {
$os = 'mac';
} else if(strstr($ua, 'webtv')) {
$os = 'webtv';
} else if(strstr($ua, 'win')) {
$os = 'win';
} else if(strstr($ua, 'freebsd')) {
$os = 'freebsd';
} else if(strstr($ua, 'x11') || strstr($ua, 'linux')) {
$os = 'linux';
}
// browser
if(!preg_match('/opera|webtv/i', $ua) && preg_match('/msie\s(\d)/', $ua, $array)) {
$browser = 'ie'; $browserversion=$array[1];
}
else if(preg_match('/firefox\/(\d+)/', $ua, $array)) {
$browser = $ff; $browserversion=$array[1];
}
else if(strstr($ua, 'gecko/')) {
$browser = $g;
}
else if(preg_match('/opera(\s|\/)(\d+)/', $ua, $array)) {
$browser = 'opera'; $$browserversion=$array[2];
}
else if(strstr($ua, 'konqueror')) {
$browser = 'konqueror';
}
else if(strstr($ua, 'chrome')) {
$browser = $w . ' ' . $s . ' chrome';
}
else if(strstr($ua, 'iron')) {
$browser = $w . ' ' . $s . ' iron';
}
else if(strstr($ua, 'applewebkit/')) {
$tmp = (preg_match('/version\/(\d+)/i', $ua, $array)) ? 1 : 0;
if($tmp){
$browser = $w . ' ' . $s . ' ' . $s;
$browserversion=$array[1];
}
else{
$browser = $w . ' ' . $s;
}
}
else if(strstr($ua, 'mozilla/')) {
$browser = $g;
}
$b['browser']=$browser;
$b['browserversion']=$browserversion;
$b['os']=$os;
return $b;
}
?>
coden til af finde browser kan du fjerne hvis du ikke har behov for at kende browseren