begin process at 2012 02 11 02:04:15
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Astuces

 > DETERMINER LE SYSTÈME D'EXPLOITATION D'UN VISITEUR

DETERMINER LE SYSTÈME D'EXPLOITATION D'UN VISITEUR


 Information sur la source

Note :
8,67 / 10 - par 3 personnes
8,67 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Astuces Niveau :Débutant Date de création :05/07/2003 Date de mise à jour :05/07/2003 20:23:52 Vu :4 269

Auteur : sunny

Ecrire un message privé
Commentaire sur cette source (6)
Ajouter un commentaire et/ou une note

 Description

Fonction avec en paramètre la variable $HTTP_USER_AGENT et renvoie une chaine contant le sytème d'exploitation.  

Source

  • // *********************************************
  • // EN paramètre la variable $HTTP_USER_AGENT
  • // Retourne le nom du sytème
  • //************************************************
  • function Os($monSysteme)
  • {
  • if (eregi("Windows NT 5.1",$monSysteme))
  • $systeme="Windows XP";
  • else if (eregi("Windows NT 5.0",$monSysteme))
  • $systeme="Windows 2000";
  • else if ((eregi("Windows NT 4.0",$monSysteme)) || (eregi("Windows NT",$monSysteme)))
  • $systeme="Windows NT";
  • else if ((eregi("Windows 98",$monSysteme)) and (eregi("9x",$monSysteme)))
  • $systeme="Windows ME";
  • else if ((eregi("Windows 98",$monSysteme)) || (eregi("Win98",$monSysteme)))
  • $systeme="Windows 98";
  • else if (eregi("Windows 95",$monSysteme))
  • $systeme="Windows 95";
  • else if (eregi("Mac",$monSysteme))
  • $systeme="Macintosh";
  • else if (eregi("Linux",$monSysteme))
  • $systeme="Linux";
  • else if (eregi("Apple",$monSysteme))
  • $systeme="Apple";
  • else if (eregi("FreeBSD",$monSysteme))
  • $systeme="FreeBSD";
  • else if (eregi("Unix",$monSysteme))
  • $systeme="Unix";
  • else
  • $systeme="Indeterminé";
  • return $systeme;
  • }
// *********************************************
//  EN paramètre la variable $HTTP_USER_AGENT
//  Retourne le nom du sytème
//************************************************
function Os($monSysteme)
{
	
	if (eregi("Windows NT 5.1",$monSysteme))
		$systeme="Windows XP";
	else if (eregi("Windows NT 5.0",$monSysteme))
		$systeme="Windows 2000";
	else if ((eregi("Windows NT 4.0",$monSysteme)) || (eregi("Windows NT",$monSysteme)))
		$systeme="Windows NT";
	else if ((eregi("Windows 98",$monSysteme)) and (eregi("9x",$monSysteme)))
		$systeme="Windows ME";
	else if ((eregi("Windows 98",$monSysteme)) || (eregi("Win98",$monSysteme)))
		$systeme="Windows 98";
	else if (eregi("Windows 95",$monSysteme))
		$systeme="Windows 95";
	else if (eregi("Mac",$monSysteme))
		$systeme="Macintosh";
	else if (eregi("Linux",$monSysteme))
		$systeme="Linux";
	else if (eregi("Apple",$monSysteme))
		$systeme="Apple";
	else if (eregi("FreeBSD",$monSysteme))
		$systeme="FreeBSD";
	else if (eregi("Unix",$monSysteme))
		$systeme="Unix";
	else
		$systeme="Indeterminé";
		
	return $systeme;	
} 



 Sources du même auteur

DETERMINER LE PAYS D'UN VISITEUR
DETERMINER LE NOM DU NAVIGATEUR ET LA VERSION

 Sources de la même categorie

Source avec Zip Source avec une capture GENERATEUR D'ONGLET DE NAVIGATION PHP par pos123
FORMATER UN LIEN YOUTUBE, DAILYMOTION OU VIMEO POUR L'UTILIS... par kgb93
Source avec Zip Source avec une capture PAGINATION + FICHIER CSS par profdi
Source avec Zip Source avec une capture SYSTEME D'AUTHENTIFICATION PHP AVEC PROTÉCTION KEYLOGGER par mtrix000
Source avec Zip Source avec une capture GENERATEUR DE BOUTONS DE PARTAGES POUR RESEAUX SOCIAUX par cod57

Commentaires et avis

Commentaire de Neozix le 21/08/2003 19:29:07

cool merci. et heu vive LinuX !!!

Commentaire de peoplehard le 11/02/2004 15:55:16

Ou aussi:

if (strstr($_SERVER["HTTP_USER_AGENT"], "Windows NT 5.1")) {    
echo "Windows XP";
}else{
if (strstr($_SERVER["HTTP_USER_AGENT"], "Windows NT 5.0")) {    
echo "Windows 2000";
if (strstr($_SERVER["HTTP_USER_AGENT"], "Windows 98")) {    
echo "Windows 98";
}else{
if (strstr($_SERVER["HTTP_USER_AGENT"], "Windows 95")) {    
echo "Windows 95";
}else{
if (strstr($_SERVER["HTTP_USER_AGENT"], "Linux")) {    
echo "Linux";
}else{
if (strstr($_SERVER["HTTP_USER_AGENT"], "Unix")) {    
echo "Unix";
}else{
if (strstr($_SERVER["HTTP_USER_AGENT"], "FreeBSD")) {    
echo "FreeBSD";
}else{
if (strstr($_SERVER["HTTP_USER_AGENT"], "Mac")) {    
echo "Macintosh";
}else{
if (strstr($_SERVER["HTTP_USER_AGENT"], "Apple")) {    
echo "Apple";
}
}
}
}
}
}
}
}
}

Commentaire de miata le 29/12/2006 13:38:50

if (strstr($_SERVER["HTTP_USER_AGENT"], "Windows NT 5.2")) {echo "Windows Server 2003";}
if (strstr($_SERVER["HTTP_USER_AGENT"], "Windows NT 6.0")) {echo "Windows Vista";}

Commentaire de webdeb le 09/04/2007 22:39:04

En plaçant les valeurs possibles dans un tableau ce serait quand même plus intelligent non ?

Commentaire de miata le 09/04/2007 23:17:26

Surement, ce n'est pas la premiere fois que l'on me le suggère ...
Mais comment on fait au fait ?

Commentaire de webdeb le 09/04/2007 23:59:32

regarde le chapitre des tableaux sur la doc officielle : http://fr.php.net/arrays

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

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 : 0,374 sec (4)

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