PHP mendeteksi sistem operasi

Bookmark and Share
dibawah ini adalah contoh code php untuk membuat pendeteksi OS anda




if(ereg("windows NT 5.1",$_SERVER["HTTP_USER_AGENT"])){

          $os = "windows exsperience(XP)";



}elseif(ereg("windows",$_SERVER["HTTP_USER_AGENT"])){

          $os = "windows";
}elseif(ereg("windows7",$_SERVER["HTTP_USER_AGENT"])){

          $os = "windows7";

}elseif(ereg("Mac",$_SERVER["HTTP_USER_AGENT"]))

                      || (ereg("PPC",$_SERVER["HTTP_USER_AGENT:])){

          $os = "MacOs";



}elseif(ereg("Linux",$_SERVER["HTTP_USER_AGENT"])){

          $os = "linux";

}elseif(ereg("FreeBsd",$_SERVER["HTTP_USER_AGENT"])){

          $os = "FreeBsd";

}elseif(ereg("SunOs",$_SERVER["HTTP_USER_AGENT"])){

          $os = "SunOs";

}elseif(ereg("IRIX",$_SERVER["HTTP_USER_AGENT"])){

          $os = "IRIX";



}elseif(ereg("BeOS",$_SERVER["HTTP_USER_AGENT"])){

          $os = "BeOS";

}elseif(ereg("OS/2",$_SERVER["HTTP_USER_AGENT"])){

          $os = "OS/2";

}elseif(ereg("AIX",$_SERVER["HTTP_USER_AGENT"])){

          $os = "AIX";

}else{

           $os = "Belum dikenal";

}

echo"
Sistem operasi anda adalah : ".$os;

?>

Artikel Lain Mister Ngayal