begin process at 2010 03 19 02:47:56
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Réseau & Internet

 > OPERATING SYSTEM DETECTION

OPERATING SYSTEM DETECTION


 Information sur la source

Note :
9 / 10 - par 2 personnes
9,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Réseau & Internet Classé sous :systeme, exploitation, infos, tracking, suivie Niveau :Débutant Date de création :18/03/2009 Vu :2 402

Auteur : tex73

Ecrire un message privé
Ce membre participe au partage de revenus publicitaires
Commentaire sur cette source (11)
Ajouter un commentaire et/ou une note


 Description

une fonction qui peut s'averer utile lors du tracking de vos visiteurs en vos indiquant le systeme d'exploitation de ces derniers.

Source

  • /* return Operating System */
  • function operating_system_detection(){
  • if ( isset( $_SERVER ) ) {
  • $agent = $_SERVER['HTTP_USER_AGENT'] ;
  • }
  • else {
  • global $HTTP_SERVER_VARS ;
  • if ( isset( $HTTP_SERVER_VARS ) ) {
  • $agent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ;
  • }
  • else {
  • global $HTTP_USER_AGENT ;
  • $agent = $HTTP_USER_AGENT ;
  • }
  • }
  • $ros[] = array('Windows XP', 'Windows XP');
  • $ros[] = array('Windows NT 5.1|Windows NT5.1)', 'Windows XP');
  • $ros[] = array('Windows 2000', 'Windows 2000');
  • $ros[] = array('Windows NT 5.0', 'Windows 2000');
  • $ros[] = array('Windows NT 4.0|WinNT4.0', 'Windows NT');
  • $ros[] = array('Windows NT 5.2', 'Windows Server 2003');
  • $ros[] = array('Windows NT 6.0', 'Windows Vista');
  • $ros[] = array('Windows CE', 'Windows CE');
  • $ros[] = array('(media center pc).([0-9]{1,2}\.[0-9]{1,2})', 'Windows Media Center');
  • $ros[] = array('(win)([0-9]{1,2}\.[0-9x]{1,2})', 'Windows');
  • $ros[] = array('(win)([0-9]{2})', 'Windows');
  • $ros[] = array('(windows)([0-9x]{2})', 'Windows');
  • // Doesn't seem like these are necessary...not totally sure though..
  • //$ros[] = array('(winnt)([0-9]{1,2}\.[0-9]{1,2}){0,1}', 'Windows NT');
  • //$ros[] = array('(windows nt)(([0-9]{1,2}\.[0-9]{1,2}){0,1})', 'Windows NT'); // fix by bg
  • $ros[] = array('Windows ME', 'Windows ME');
  • $ros[] = array('Win 9x 4.90', 'Windows ME');
  • $ros[] = array('Windows 98|Win98', 'Windows 98');
  • $ros[] = array('Windows 95', 'Windows 95');
  • $ros[] = array('(windows)([0-9]{1,2}\.[0-9]{1,2})', 'Windows');
  • $ros[] = array('win32', 'Windows');
  • $ros[] = array('(java)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})', 'Java');
  • $ros[] = array('(Solaris)([0-9]{1,2}\.[0-9x]{1,2}){0,1}', 'Solaris');
  • $ros[] = array('dos x86', 'DOS');
  • $ros[] = array('unix', 'Unix');
  • $ros[] = array('Mac OS X', 'Mac OS X');
  • $ros[] = array('Mac_PowerPC', 'Macintosh PowerPC');
  • $ros[] = array('(mac|Macintosh)', 'Mac OS');
  • $ros[] = array('(sunos)([0-9]{1,2}\.[0-9]{1,2}){0,1}', 'SunOS');
  • $ros[] = array('(beos)([0-9]{1,2}\.[0-9]{1,2}){0,1}', 'BeOS');
  • $ros[] = array('(risc os)([0-9]{1,2}\.[0-9]{1,2})', 'RISC OS');
  • $ros[] = array('os/2', 'OS/2');
  • $ros[] = array('freebsd', 'FreeBSD');
  • $ros[] = array('openbsd', 'OpenBSD');
  • $ros[] = array('netbsd', 'NetBSD');
  • $ros[] = array('irix', 'IRIX');
  • $ros[] = array('plan9', 'Plan9');
  • $ros[] = array('osf', 'OSF');
  • $ros[] = array('aix', 'AIX');
  • $ros[] = array('GNU Hurd', 'GNU Hurd');
  • $ros[] = array('(fedora)', 'Linux - Fedora');
  • $ros[] = array('(kubuntu)', 'Linux - Kubuntu');
  • $ros[] = array('(ubuntu)', 'Linux - Ubuntu');
  • $ros[] = array('(debian)', 'Linux - Debian');
  • $ros[] = array('(CentOS)', 'Linux - CentOS');
  • $ros[] = array('(Mandriva).([0-9]{1,3}(\.[0-9]{1,3})?(\.[0-9]{1,3})?)', 'Linux - Mandriva');
  • $ros[] = array('(SUSE).([0-9]{1,3}(\.[0-9]{1,3})?(\.[0-9]{1,3})?)', 'Linux - SUSE');
  • $ros[] = array('(Dropline)', 'Linux - Slackware (Dropline GNOME)');
  • $ros[] = array('(ASPLinux)', 'Linux - ASPLinux');
  • $ros[] = array('(Red Hat)', 'Linux - Red Hat');
  • // Loads of Linux machines will be detected as unix.
  • // Actually, all of the linux machines I've checked have the 'X11' in the User Agent.
  • //$ros[] = array('X11', 'Unix');
  • $ros[] = array('(linux)', 'Linux');
  • $ros[] = array('(amigaos)([0-9]{1,2}\.[0-9]{1,2})', 'AmigaOS');
  • $ros[] = array('amiga-aweb', 'AmigaOS');
  • $ros[] = array('amiga', 'Amiga');
  • $ros[] = array('AvantGo', 'PalmOS');
  • //$ros[] = array('(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1}-([0-9]{1,2}) i([0-9]{1})86){1}', 'Linux');
  • //$ros[] = array('(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1} i([0-9]{1}86)){1}', 'Linux');
  • //$ros[] = array('(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1})', 'Linux');
  • $ros[] = array('[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3})', 'Linux');
  • $ros[] = array('(webtv)/([0-9]{1,2}\.[0-9]{1,2})', 'WebTV');
  • $ros[] = array('Dreamcast', 'Dreamcast OS');
  • $ros[] = array('GetRight', 'Windows');
  • $ros[] = array('go!zilla', 'Windows');
  • $ros[] = array('gozilla', 'Windows');
  • $ros[] = array('gulliver', 'Windows');
  • $ros[] = array('ia archiver', 'Windows');
  • $ros[] = array('NetPositive', 'Windows');
  • $ros[] = array('mass downloader', 'Windows');
  • $ros[] = array('microsoft', 'Windows');
  • $ros[] = array('offline explorer', 'Windows');
  • $ros[] = array('teleport', 'Windows');
  • $ros[] = array('web downloader', 'Windows');
  • $ros[] = array('webcapture', 'Windows');
  • $ros[] = array('webcollage', 'Windows');
  • $ros[] = array('webcopier', 'Windows');
  • $ros[] = array('webstripper', 'Windows');
  • $ros[] = array('webzip', 'Windows');
  • $ros[] = array('wget', 'Windows');
  • $ros[] = array('Java', 'Unknown');
  • $ros[] = array('flashget', 'Windows');
  • // delete next line if the script show not the right OS
  • //$ros[] = array('(PHP)/([0-9]{1,2}.[0-9]{1,2})', 'PHP');
  • $ros[] = array('MS FrontPage', 'Windows');
  • $ros[] = array('(msproxy)/([0-9]{1,2}.[0-9]{1,2})', 'Windows');
  • $ros[] = array('(msie)([0-9]{1,2}.[0-9]{1,2})', 'Windows');
  • $ros[] = array('libwww-perl', 'Unix');
  • $ros[] = array('UP.Browser', 'Windows CE');
  • $ros[] = array('NetAnts', 'Windows');
  • $file = count ( $ros );
  • $os = '';
  • for ( $n=0 ; $n<$file ; $n++ ){
  • if ( eregi ( $ros[$n][0] , $agent, $name ) ){
  • $os = @$ros[$n][1].' '.@$name[2];
  • break;
  • }
  • }
  • return trim ( $os );
  • }
/* return Operating System */
	function operating_system_detection(){
		if ( isset( $_SERVER ) ) {
		$agent  = $_SERVER['HTTP_USER_AGENT'] ;
	}
	else {
		global $HTTP_SERVER_VARS ;
		if ( isset( $HTTP_SERVER_VARS ) ) {
			$agent  = $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ;
		}
		else {
			global $HTTP_USER_AGENT ;
			$agent  = $HTTP_USER_AGENT ;
		}
	}
		$ros[] = array('Windows XP',                                                 'Windows XP');
        $ros[] = array('Windows NT 5.1|Windows NT5.1)',                              'Windows XP');
   
        $ros[] = array('Windows 2000',                                               'Windows 2000');
        $ros[] = array('Windows NT 5.0',                                             'Windows 2000');
        $ros[] = array('Windows NT 4.0|WinNT4.0',                                    'Windows NT');
   
        $ros[] = array('Windows NT 5.2',                                             'Windows Server 2003');
        $ros[] = array('Windows NT 6.0',                                             'Windows Vista');
   
        $ros[] = array('Windows CE',                                                 'Windows CE');
        $ros[] = array('(media center pc).([0-9]{1,2}\.[0-9]{1,2})',                 'Windows Media Center');
   
        $ros[] = array('(win)([0-9]{1,2}\.[0-9x]{1,2})',                             'Windows');
        $ros[] = array('(win)([0-9]{2})',                                            'Windows');
        $ros[] = array('(windows)([0-9x]{2})',                                       'Windows');
   
        // Doesn't seem like these are necessary...not totally sure though.. 
        //$ros[] = array('(winnt)([0-9]{1,2}\.[0-9]{1,2}){0,1}',                       'Windows NT');
        //$ros[] = array('(windows nt)(([0-9]{1,2}\.[0-9]{1,2}){0,1})',                'Windows NT'); // fix by bg   
   
        $ros[] = array('Windows ME',                                                 'Windows ME');
        $ros[] = array('Win 9x 4.90',                                                'Windows ME');
        $ros[] = array('Windows 98|Win98',                                           'Windows 98');
        $ros[] = array('Windows 95',                                                 'Windows 95');
        $ros[] = array('(windows)([0-9]{1,2}\.[0-9]{1,2})',                          'Windows');
        $ros[] = array('win32',                                                      'Windows');
   
        $ros[] = array('(java)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})',                 'Java');
        $ros[] = array('(Solaris)([0-9]{1,2}\.[0-9x]{1,2}){0,1}',                    'Solaris');
        $ros[] = array('dos x86',                                                    'DOS');
        $ros[] = array('unix',                                                       'Unix');
   
        $ros[] = array('Mac OS X',                                                   'Mac OS X');
        $ros[] = array('Mac_PowerPC',                                                'Macintosh PowerPC');
        $ros[] = array('(mac|Macintosh)',                                            'Mac OS');
   
        $ros[] = array('(sunos)([0-9]{1,2}\.[0-9]{1,2}){0,1}',                       'SunOS');
        $ros[] = array('(beos)([0-9]{1,2}\.[0-9]{1,2}){0,1}',                        'BeOS');
        $ros[] = array('(risc os)([0-9]{1,2}\.[0-9]{1,2})',                          'RISC OS');
        $ros[] = array('os/2',                                                       'OS/2');
        $ros[] = array('freebsd',                                                    'FreeBSD');
        $ros[] = array('openbsd',                                                    'OpenBSD');
        $ros[] = array('netbsd',                                                     'NetBSD');
        $ros[] = array('irix',                                                       'IRIX');
        $ros[] = array('plan9',                                                      'Plan9');
        $ros[] = array('osf',                                                        'OSF');
        $ros[] = array('aix',                                                        'AIX');
        $ros[] = array('GNU Hurd',                                                   'GNU Hurd');
   

        $ros[] = array('(fedora)',                                                   'Linux - Fedora');
        $ros[] = array('(kubuntu)',                                                  'Linux - Kubuntu');
        $ros[] = array('(ubuntu)',                                                   'Linux - Ubuntu');
        $ros[] = array('(debian)',                                                   'Linux - Debian');
        $ros[] = array('(CentOS)',                                                   'Linux - CentOS');
        $ros[] = array('(Mandriva).([0-9]{1,3}(\.[0-9]{1,3})?(\.[0-9]{1,3})?)',      'Linux - Mandriva');
        $ros[] = array('(SUSE).([0-9]{1,3}(\.[0-9]{1,3})?(\.[0-9]{1,3})?)',          'Linux - SUSE');
        $ros[] = array('(Dropline)',                                                 'Linux - Slackware (Dropline GNOME)');
        $ros[] = array('(ASPLinux)',                                                 'Linux - ASPLinux');
        $ros[] = array('(Red Hat)',                                                  'Linux - Red Hat');
   
        // Loads of Linux machines will be detected as unix.
        // Actually, all of the linux machines I've checked have the 'X11' in the User Agent.
        //$ros[] = array('X11',                                                        'Unix');
        
        $ros[] = array('(linux)',                                                    'Linux');
   
        $ros[] = array('(amigaos)([0-9]{1,2}\.[0-9]{1,2})',                          'AmigaOS');
        $ros[] = array('amiga-aweb',                                                 'AmigaOS');
        $ros[] = array('amiga',                                                      'Amiga');
        $ros[] = array('AvantGo',                                                    'PalmOS');   
   
        //$ros[] = array('(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1}-([0-9]{1,2}) i([0-9]{1})86){1}', 'Linux');
        //$ros[] = array('(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1} i([0-9]{1}86)){1}',                                                                                                  'Linux');
        //$ros[] = array('(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1})',                                                                                                                   'Linux');
        $ros[] = array('[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3})',                        'Linux');
   
        $ros[] = array('(webtv)/([0-9]{1,2}\.[0-9]{1,2})',                           'WebTV');
        $ros[] = array('Dreamcast',                                                  'Dreamcast OS');
        $ros[] = array('GetRight',                                                   'Windows');
        $ros[] = array('go!zilla',                                                   'Windows');
        $ros[] = array('gozilla',                                                    'Windows');
        $ros[] = array('gulliver',                                                   'Windows');
        $ros[] = array('ia archiver',                                                'Windows');
        $ros[] = array('NetPositive',                                                'Windows');
        $ros[] = array('mass downloader',                                            'Windows');
        $ros[] = array('microsoft',                                                  'Windows');
        $ros[] = array('offline explorer',                                           'Windows');
        $ros[] = array('teleport',                                                   'Windows');
        $ros[] = array('web downloader',                                             'Windows');
        $ros[] = array('webcapture',                                                 'Windows');
        $ros[] = array('webcollage',                                                 'Windows');
        $ros[] = array('webcopier',                                                  'Windows');
        $ros[] = array('webstripper',                                                'Windows');
        $ros[] = array('webzip',                                                     'Windows');
        $ros[] = array('wget',                                                       'Windows');
        $ros[] = array('Java',                                                       'Unknown');
        $ros[] = array('flashget',                                                   'Windows');

        // delete next line if the script show not the right OS
        //$ros[] = array('(PHP)/([0-9]{1,2}.[0-9]{1,2})',                              'PHP');
   
        $ros[] = array('MS FrontPage',                                               'Windows');
        $ros[] = array('(msproxy)/([0-9]{1,2}.[0-9]{1,2})',                          'Windows');
        $ros[] = array('(msie)([0-9]{1,2}.[0-9]{1,2})',                              'Windows');
        $ros[] = array('libwww-perl',                                                'Unix');
        $ros[] = array('UP.Browser',                                                 'Windows CE');
        $ros[] = array('NetAnts',                                                    'Windows');

        $file = count ( $ros );
        $os   = '';

        for ( $n=0 ; $n<$file ; $n++ ){
        	if ( eregi ( $ros[$n][0] , $agent, $name ) ){
        		$os = @$ros[$n][1].' '.@$name[2];
        		break;
            }
        }

    return trim ( $os );
  } 

 Conclusion

bonne lecture


 Sources du même auteur

Source avec Zip RSS_WRITER
Source avec Zip RSSREADER 2.0
Source avec Zip TESTEUR DE MOTS DE PASSE
Source avec Zip CAPTCHA WARRIOR 1.0.1: LE SYSTEME DE CAPTCHA TOTALEMENT ADMI...
VÉRIFIER SI VOS PARTENAIRES ONT GARDÉ VOS LIENS SUR LEUR SIT...

 Sources de la même categorie

SONDAGE - VOTE - POLL (AVEC MYSQL) par hornet_bzz
Source avec Zip Source avec une capture CRAYONPRO EST UN CMS SIMPLE EN PHP ET MYSQL - INSTALLATION E... par crayoncie
Source avec Zip Source avec une capture LISTENGEN GÉNÉRATEUR DE FICHIER PLAYLIST par AGG
Source avec Zip IP CALCULATOR par X_Cli
Source avec Zip Source avec une capture WHOIS DOMAIN CLASS : LOOKUP & AVAIBILITY par aKheNathOn

 Sources en rapport avec celle ci

CLASS MOTEUR DE TEMPLATE PHP5 par choy
Source avec Zip SYSTÈME DE PROVERBE par elliotg
DETERMINER SYSTEME D'EXPLOITATION (OS) D'UN VISITEUR par yuki24
Source avec Zip Source avec une capture INFOS LIB par Mini92
AFFICHER DES INFORMATIONS CONCERNANT LE VISITEUR par spidermario

Commentaires et avis

Commentaire de rambc le 23/03/2009 09:43:04

Salut,
pourrais-tu mettre un petit ZIP ?

Commentaire de LeFauve42 le 23/03/2009 10:14:40 8/10

Sympa, mais il en manque ;o)

Serieusement, ta liste est pas mal complete. Je suis epate d'y trouver la Dreamcast, mais il manque (entre autres) Contiki (pour le C64).

Quelle source as-tu utilise pour la liste ?

En voici deux autres au cas ou :
http://www.zytrax.com/tech/web/browser_ids.htm
http://www.useragentstring.com/pages/useragentstring.php

Commentaire de Renfield le 23/03/2009 13:42:01 administrateur CS

un Zip, Rambc ?

ton presse-papier est cassé ?

non, sans rire... il n'y a qu'une fonction. Tu peux sans doute la placer dans ton editeur de texte favori, et enregistrer ce fichier...

Commentaire de tex73 le 29/03/2009 11:09:37

MERCI à tous pour vos compliments.
à toi LEFAUVE42 merci pour ces liens. je les visiterai tre prochainement pour d'eventuelles mise à jour.

Commentaire de rambc le 29/03/2009 12:56:30

Une petite amélioration possible serait d'avoir accès juste à une info. générale du type LinuX, Windows, Mac sans trop entrer dans les détails.
On peut imaginer un mode de fonctionnement complet et un autre light.

Qu'en penses-tu TEX73 ?

PS : un zip permet d'enregistrer directement ton code dans un dossier de scripts très utiles. Et oui je suis un gros flemmard...

Commentaire de griffondorr le 03/04/2009 11:34:15 10/10

cool comme sources ;)

Commentaire de DAM74 le 13/01/2010 01:23:15

Merci de  mettre le code en fichier zip

Commentaire de Renfield le 13/01/2010 04:31:20 administrateur CS

pour 140 lignes ?
quel interet ?

Commentaire de DAM74 le 13/01/2010 15:37:20

meme pour 40 lignes ceci est plus facile

Commentaire de DAM74 le 13/01/2010 15:39:45

super comme idée ton script

Commentaire de LeFauve42 le 13/01/2010 16:14:12

Si tu as 5 minutes, tu pourrais peut-etre:
- Ajouter Vista
- Utiliser preg_match au lieu de eregi (pour eviter les warnings en PHP5.3)

Je n'ai pas teste, mais ca ndevrait donner un truc comme ca pour la ligne 130 :
         if ( preg_match('/'.$ros[$n][0].'/i' , $agent, $name ) ){

Sinon, je n'avais pas remarque mais ton $name[2] n'est pas toujours defini puisque tes regex n'ont pas tous des parantheses capturantes...

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

DONNER DES INFOS SUR LE VISITEUR [ par kindool ] Bonjour, je recherche tout type de code php donnant des infos sur le visiteur du site, si vous en connaissez, merci de me répondre :)genre d'infos rec Avoir des infos sur un user [ par Yuleesize ] Ehh bjr. En fait j'aimerait bien savoir komment on fé pour avoir des infos sur l'user... Comme par ex l'host... l'os... le navigateur... etc... En fai Forum : comment ca marche ? [ par BSide ] BSideBonjour,pouvez-vous m'expliquer comment fonctionne un forum ?Plus précisément : je souhaite afficher sous forme de tableau le contenu d'une BD ma récuperer des infos sur un site web [ par nunor ] Bonjour,Je débute en PHP.Je souhaiterais savoir s'il est possible de récupérer dans une base de données différentes informations. Ces informations son récuperer des infos sur un site web [ par nunor ] Bonjour,Je débute en PHP.Je souhaiterais savoir s'il est possible de récupérer dans une base de données différentes informations. Ces informations son vider le contenu d'un fichier [ par Clonk ] Bonjour,Ne pouvant pas utiliser de BDD, je dois me contenter d'un fichier texte pour mes référencements, le problème est que, si j'arrive à écrire et Get et un systeme de navig [ par zakaria74 ] Bonjour, Aidez-moi SVP car je suis un débutant, j'ai un fichier un site : www.monsite.com Le menu de mon site se presente comme suit : Accueil = index Probleme variable FORM [ par Clonk ] bonjour,voilà mon 'petit' probleme:j'ai un formulaire de modification, je recupere les infos d'un fichier texte et puor certaines infos, il se peut qu Télécharger un CSV et en Extraire les Infos [ par jdaviaud ] Ben voila mon problème, je cherche à faire un script qui dialogue avec E-gold.com pour ceux qui connaissent.A un moment il me propose donc de téléchar


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mars 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,139 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales