PHP is being used now, but no detection has worked thus far. I took a look at it (i dont have any knowleged of PHP) to see if I can spot some conditional error, but I dont know...
Approach 1 is used as a call function in the index.html file whils Approach 2 is index.php.
any help would be kick ass.
Approach 1:
- Code: Select all
<?php
function DetectBrowser() {
$mobileBrowser= false; // set mobile browser as false till we can prove otherwise
$sumaho= false;
$keitai= false;
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$newPage= "http://www.kitagawa-hirataka.com/s";
$oldPage= "http://www.kitagawa-hirataka.com/m";
$mainPage= "http://www.kitagawa-hirataka.com/m";
if(eregi("DoCoMo",$user_agent)){$keitai=true; }
if(eregi("UP\.Browser",$user_agent)){$keitai=true; }
if(eregi("J-PHONE",$user_agent)){$keitai=true; }
if(eregi("Vodafone",$user_agent)){$keitai=true; }
if(eregi("SoftBank",$user_agent)){$keitai=true; }
if(eregi("J-EMULATOR",$user_agent)){$keitai=true; }
if (eregi('ipod',$user_agent)||eregi('iphone',$user_agent)) {$sumaho=true; }//end iphone check
if (eregi('opera mini',$user_agent)) {$sumaho=true; }//end opera check
if (eregi('android',$user_agent)) {$sumaho=true; }//end android check
if ($sumaho) {header('Location: '.$newPage); } //end smartphone check redirect
if ($keitai) {header('Location: '.$oldPage); } //end keitai check redirect
if (($keitai=false) && ($sumaho=false)) {header('Location: '.$mainPage); } //end keitai check redirect
}//end detect browser function
?>
Approach 2
- Code: Select all
$docomo = "./m/index.html"; //ƒhƒRƒ‚‚Ìê‡
$au = "./m/index.html"; //‚‚•‚Ìê‡
$softbank = "./m/index.html"; //ƒ\ƒtƒgƒoƒ“ƒN‚Ìê‡
$msie = "top.html"; //‚h‚d‚Ìê‡
$Netscape = "top.html"; //Netscape‚Ìê‡
$opera = "top.html"; //Opera‚Ìê‡
$firefox = "top.html"; //Firefox‚Ìê‡
$pc = "top.html"; //ã‹L‹@ŽíˆÈŠO
/////////////////////////////////////////£‰Šúˆ—I’[£
/////////////////////////////////////////¥Œg‘Ñ”»•Ê¥
if(isset($_SERVER['HTTP_USER_AGENT'])){
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if(eregi("DoCoMo",$user_agent)){header("Location: $docomo");}
elseif(eregi("UP\.Browser",$user_agent)){header("Location: $au");}
elseif(eregi("J-PHONE",$user_agent)){header("Location: $softbank");}
elseif(eregi("Vodafone",$user_agent)){header("Location: $softbank");}
elseif(eregi("SoftBank",$user_agent)){header("Location: $softbank");}
elseif(eregi("J-EMULATOR",$user_agent)){header("Location: $softbank");}
elseif(eregi("MSIE",$user_agent)){header("Location: $msie");}
elseif(eregi("Netscape",$user_agent)){header("Location: $netscape");}
elseif(eregi("Opera",$user_agent)){header("Location: $opera");}
elseif(eregi("Firefox",$user_agent)){header("Location: $firefox");}
else{header("Location: $pc");}
}else{
print <<<END
<html><body>
HTTP_USER_AGENT Error<br /><br />
ƒ†[ƒU[ƒG[ƒWƒFƒ“ƒg‚ª“Ç‚Ýž‚ß‚Ü‚¹‚ñ‚Å‚µ‚½B<br />
</body></html>
END;
}