Location: PHPKode > scripts > Mobile Device Detector > code.php
<?php

/** ************************************************************
 * @author ABHIJEET PATIL (http://www.itshacked.com/)
 * @copyright 2011 InverseSoft INC www.inversesoft.com
 ***************************************************************
 * @content PHP mobile browser detector
 * Version: 1.0 [June 19,2011]
                     GPL Licence Agreement
------------------------------------------------------------------

Only 5$ For Commercial use contact developer at hide@address.com

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the InverseSoft either version 1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
License for more details.

LICENCE - http://creativecommons.org/licenses/by-nc-sa/2.5/in/deed.en
-------------------------------------------------------------------

Installation

1. Extraxt file.
2. upload file to your webserver using ftp client
3. open code.php file and copy code and paste that code on your site where you want to include news.
4. Report bugs errors hide@address.com

--------------------------------------------------------------------
Copyright (C) 2011 InverseSoft [http://www.inversesoft.com]
*/

$var[0] = 'Mozilla/4.7222';
$var[1] = 'Mozilla/3.0';
$var[2] = 'AvantGo';
$var[3] = 'ProxiNet';
$var[4] = 'Danger hiptop 1.0';
$var[5] = 'DoCoMo/';
$var[6] = 'Google CHTML Proxy/';
$var[7] = 'UP.Browser/';
$var[8] = 'SEMC-Browser/';
$var[9] = 'J-PHONE/';
$var[10] = 'PDXGW/';
$var[11] = 'ASTEL/';
$var[12] = 'Mozilla/1.22';
$var[13] = 'Handspring';
$var[14] = 'Windows CE';
$var[15] = 'PPC';
$var[16] = 'Mozilla/2.0';
$var[17] = 'Blazer/';
$var[18] = 'Palm';
$var[19] = 'WebPro/';
$var[20] = 'EPOC32-WTL/';
$var[21] = 'Tungsten';
$var[22] = 'Netfront/';
$var[23] = 'Mobile Content Viewer/';
$var[24] = 'PDA';
$var[25] = 'MMP/2.0';
$var[26] = 'Embedix/';
$var[27] = 'Qtopia/';
$var[28] = 'Xiino/';
$var[29] = 'BlackBerry';
$var[30] = 'Gecko/20031007';
$var[31] = 'MOT-';
$var[32] = 'UP.Link/';
$var[33] = 'Smartphone';
$var[34] = 'portalmmm/';
$var[35] = 'Nokia';
$var[36] = 'Symbian';
$var[37] = 'AppleWebKit/413';
$var[38] = 'UPG1 UP/';
$var[39] = 'RegKing';
$var[40] = 'STNC-WTL/';
$var[41] = 'J2ME';
$var[42] = 'Opera Mini/';
$var[43] = 'SEC-';
$var[44] = 'ReqwirelessWeb/';
$var[45] = 'AU-MIC/';
$var[46] = 'Sharp';
$var[47] = 'SIE-';
$var[48] = 'SonyEricsson';
$var[49] = 'Elaine/';
$var[50] = 'SAMSUNG-';
$var[51] = 'Panasonic';
$var[52] = 'Siemens';
$var[53] = 'Sony';
$var[54] = 'Verizon';
$var[55] = 'Cingular';
$var[56] = 'Sprint';
$var[57] = 'AT&T';
$var[58] = 'Nextel';
$var[59] = 'Pocket PC';
$var[60] = 'T-Mobile';	
$var[61] = 'Orange';
$var[62] = 'Casio';
$var[63] = 'HTC';
$var[64] = 'Motorola';
$var[65] = 'Samsung';
$var[66] = 'NEC';
$var[67] = 'SPICE-X1';
$var[68] = 'MAUI';
$var[69] = 'Nokia6820';
$var[70] = 'LG';
$var[80] = 'Mozilla/5.0 (en-us) AppleWebKit';
$var[81] = 'Mozilla/5.0 (SymbianOS';
$var[82] = 'BlackBerry';
$var[83] = 'SIE:';
$var[84] = 'HTC:';
$var[85] = 'Android SDK';
$var[86] = 'Mozilla/5.0 (Linux; U; Android';
$var[87] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile';
$var[88] = 'LGE';
$var[89] = 'Mozilla/5.0 (webOS';
$var[90] = 'Opera/9.50 (J2ME';
$var[91] = 'SonyEricsson';
$var[92] = 'BOLT';
$var[93] = 'YahooSeeker/M1A1-R2D2';
$var[94] = 'Lava-A9/S016';
$var[95] = 'Opera/9.80 ';

$result = count($var);

for ($i=0;$i<$result;$i++)
{	
	$ausg = stristr($text, $var[$i]);
    
    if(strlen($ausg)>0)
	{
	   
       // WAP PAGE GOES HERE
       
       } else {
        
        // WEB PAGE GOES HERE
       }
?>
Return current item: Mobile Device Detector