Re: module [mes infos]

ok je note mike007

Réponse ci-dessus posté le vendredi 09 novembre 2012 : 12:17



salut, j'ai mis ça pour le bloc.php


Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1. <?php
  2.  
  3. $bloc = "
  4.  
  5. <!-- Debut du Bloc -->
  6. <CENTER>
  7. <SCRIPT LANGUAGE=\"JavaScript\">
  8. document.write(\"<b>Addresse IP</b><br> $_SERVER[REMOTE_ADDR]\");
  9. document.write(\"<hr><b>Résolution</b><br>\" +screen.width+ \"x\" +screen.height+ \"x\" +window.screen.colorDepth);
  10.  
  11. document.write(\"<hr><b>Navigateur</b><br>\" +navigator.appName);
  12.  
  13. var ua = navigator.userAgent
  14. if (ua.indexOf(\"Linux\") > -1) name = \"Linux: The Best OS\";
  15. else if (ua.indexOf(\"PPC Mac OS X\") > -1) name = \"Mac OS >= X\";
  16. else if (ua.indexOf(\"Macintosh\")> -1) name =\"Mac OS <= 9\";
  17. else if (ua.indexOf(\"95\") > -1 && ua.indexOf(\"Win\") >-1) name=\"Windows 95\";
  18. else if (ua.indexOf(\"98\") > -1 && ua.indexOf(\"Win\") > -1) name=\"Windows 98\";
  19. else if (ua.indexOf(\"Windows NT 5.0\") > -1) name=\"Windows 2000\";
  20. else if (ua.indexOf(\"Windows NT 5.1\") > -1) name =\"Windows XP\";
  21. else if (ua.indexOf(\"Windows NT 6.0\") > -1) name =\"Windows Vista\";
  22. else if (ua.indexOf(\"Windows NT 6.1\") > -1) name =\"Windows Seven\";
  23. else if (ua.indexOf(\"Windows NT 6.2\") > -1) name =\"Windows 8\";
  24. else name  = \"Undeterminded OS\";
  25. document.write(\"<hr><b>Plateforme</b><br>\" +name);
  26. </script>
  27. </CENTER>
  28. <!-- Fin du Bloc -->";
  29. Bloc ($result_blocs->parametre1,$bloc) ;
  30. ?>




et ça dans admin.php



Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1. <?php
  2. if (!eregi("index.php", $_SERVER['PHP_SELF'])) {
  3.     die ("Vous n'avez pas l'autorisation d'accéder à ce fichier.");
  4. }
  5. $requete=mysql_query("SELECT * FROM `users` WHERE `users`.`pseudo`=\"$pseudo\"");
  6. $ligne = mysql_fetch_object($requete);
  7. if ($ligne->grade=4) {
  8.  
  9. $infos = "Nom : <a href=index.php?mod=admin&ac=param&id=$result_blocs->id onmouseover=aide(\"C'est&nbsp;le&nbsp;titre&nbsp;de&nbsp;la&nbsp;fenêtre.\"); onmouseout=aide(\"Cliquez&nbsp;sur&nbsp;un&nbsp;parametre&nbsp;pour&nbsp;le&nbsp;modifier\");>$result_blocs->parametre1 [Editer]</A><BR><BR>";
  10.  
  11. $informations = "<B>Nom</B> : MeZinfo<BR>
  12.                  <B>Type</B> : Bloc<BR>
  13.                  <B>Auteur</B> : b0b0</a><BR>
  14.                  <B>Version</B> : 1.0<BR>
  15.                  <BR>
  16.                  <B>Description</B> : Bloc d'informations Systeme" ;
  17.  
  18. $new = "<form action=modules/admin/new3.php>
  19.         Ajouter le bloc MeZinfo :
  20.         <BR><BR>Ce bloc affiches quelques infos sur votre pc (Résolution, Addresse IP, ...) .
  21.         <BR><BR>Nom de la fenetre : <input type=text value=MeZinfo name=parametre1 size=20 maxlength=30>
  22.         <BR><BR><input type=submit value='Ajouter le bloc'>
  23.         <input type=hidden name=emplacement value=$emplacement>
  24.         <input type=hidden name=module value=$module>
  25.         </form>" ;
  26.  
  27. $edit = "<form action=modules/admin/edit.php>
  28.         Bloc 'MeZinfo':
  29.         <BR><BR>Nom de la fenetre : <input type=text value=\"$parametre1\" name=parametre1 size=20 maxlength=30>
  30.         <BR><BR><input type=submit value='Valider'>
  31.         <input type=hidden name=id value=$id>
  32.         </form>" ;
  33. }
  34. ?>



pouvais vous me dire si c'est bon je ne suis pas persuadé du bon code

merci par avance de votre aide

Réponse ci-dessus posté le jeudi 13 décembre 2012 : 13:12




Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1. <?php
  2. function OS() {
  3.     $ua = $_SERVER['HTTP_USER_AGENT'];
  4.     $os = "Autre/Bot";
  5.     $os_arr = array(
  6.         // -- Windows Phone
  7.         'Windows Phone' => 'Windows Phone',
  8.         // -- Android
  9.         'Android' => 'Android',
  10.         // -- Windows
  11.         'Windows NT 6.2' => 'Windows 8',
  12.         'Windows NT 6.1' => 'Windows Seven',
  13.         'Windows NT 6.0' => 'Windows Vista',
  14.         'Windows NT 5.2' => 'Windows Server 2003',
  15.         'Windows NT 5.1' => 'Windows XP',
  16.         'Windows NT 5.0' => 'Windows 2000',
  17.         'Windows 2000' => 'Windows 2000',
  18.         'Windows CE' => 'Windows Mobile',
  19.         'Win 9x 4.90' => 'Windows Me.',
  20.         'Windows 98' => 'Windows 98',
  21.         'Windows 95' => 'Windows 95',
  22.         'Win95' => 'Windows 95',
  23.         'Windows NT' => 'Windows NT',
  24.         // -- Linux
  25.         'Ubuntu' => 'Linux Ubuntu',
  26.         'Fedora' => 'Linux Fedora',
  27.         'Linux' => 'Linux',
  28.         // -- Mac
  29.         'Macintosh' => 'Mac',
  30.         'Mac OS X' => 'Mac OS X',
  31.         'Mac_PowerPC' => 'Mac PowerPC',
  32.         'Mac' => 'Mac',
  33.         // -- Autres ...
  34.         'FreeBSD' => 'FreeBSD',
  35.         'Unix' => 'Unix',
  36.         'Playstation portable' => 'Playstation portable',
  37.         'Playstation 1' => 'Playstation 1',
  38.         'Playstation 2' => 'Playstation 2',
  39.         'Playstation 3' => 'Playstation 3',
  40.         'OpenSolaris' => 'SunOS',
  41.         'SunOS' => 'SunOS',
  42.         'Nintendo Wii' => 'Nintendo Wii',
  43.         'Googlebot' => 'Google Bot',
  44.         'Haiku' => 'Haiku',
  45.     );
  46.     $ua = strtolower($ua);
  47.     foreach($os_arr as $k => $v) {
  48.         if(preg_match("#".$k."#i", $ua)) {
  49.             $os = $v;
  50.             break;
  51.         }
  52.     }
  53.     return $os;
  54. }
  55.  
  56. function Navigateur() {
  57.     $u_agent = $_SERVER['HTTP_USER_AGENT'];
  58.     $bname = 'Autre/Bot';
  59.     $version = "";
  60.     if(preg_match('/MSIE/i', $u_agent) && !preg_match('/Opera/i', $u_agent)) {
  61.         $bname = 'Internet Explorer';
  62.         $ub = "MSIE";
  63.     } else if(preg_match('/Android/i', $u_agent)) {
  64.         $bname = 'Android';
  65.         $ub = "Android";
  66.     } else if(preg_match('/Firefox/i', $u_agent)) {
  67.         $bname = 'Mozilla Firefox';
  68.         $ub = "Firefox";
  69.     } else if(preg_match('/Chrome/i', $u_agent)) {
  70.         $bname = 'Google Chrome';
  71.         $ub = "Chrome";
  72.     } else if(preg_match('/Safari/i', $u_agent)) {
  73.         $bname = 'Apple Safari';
  74.         $ub = "Safari";
  75.     } else if(preg_match('/Opera/i', $u_agent)) {
  76.         $bname = 'Opera';
  77.         $ub = "Opera";
  78.     } else if(preg_match('/Netscape/i', $u_agent)) {
  79.         $bname = 'Netscape';
  80.         $ub = "Netscape";
  81.     } else if(preg_match('/Googlebot/i', $u_agent)) {
  82.         $bname = 'Googlebot';
  83.         $ub = "Googlebot";
  84.     }
  85.     $known = array('Version', $ub, 'other');
  86.     $pattern = '#(?<browser>'.join('|', $known).')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
  87.     if(!preg_match_all($pattern, $u_agent, $matches)) { }
  88.     $i = count($matches['browser']);
  89.     if($i !== 1) {
  90.         if(strripos($u_agent, "Version") < strripos($u_agent, $ub)) {
  91.             $version = $matches['version'][0];
  92.         } else {
  93.             $version = $matches['version'][1];
  94.         }
  95.     } else {
  96.         $version = $matches['version'][0];
  97.     }
  98.     if($version == null) {
  99.         $version = "";
  100.     }
  101.     return $bname." ".$version;
  102. }
  103.  
  104. $bloc = "
  105. <!-- Debut du Bloc -->
  106. <center>
  107. <script language='javascript'>
  108. document.write('<b>Addresse IP</b><br>".$_SERVER['REMOTE_ADDR']."');
  109. document.write('<hr><b>Résolution</b><br>' + screen.width + 'x' + screen.height + 'x' + window.screen.colorDepth);
  110. document.write('<hr><b>Navigateur</b><br>".Navigateur()."');
  111. document.write('<hr><b>Plateforme</b><br>".OS()."');
  112. </script>
  113. </center>
  114. <!-- Fin du Bloc -->";
  115. Bloc ($result_blocs->parametre1,$bloc) ;
  116. ?>
  117.  
  118.  


j'ai remplacé par ca cela me semble mieux, non ?


Réponse ci-dessus posté le lundi 24 décembre 2012 : 16:59



bonjour, j'ai un soucis sur le bloc.php du module mezinfos car j'ai une erreur sur la page d'accueil voici mon site http://www.blog.musicgroove.free.fr/


voici le code du bloc.php du module :


Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1. <?php
  2. function OS() {
  3.     $ua = $_SERVER['HTTP_USER_AGENT'];
  4.     $os = "Autre/Bot";
  5.     $os_arr = array(
  6.         // -- Windows Phone
  7.         'Windows Phone' => 'Windows Phone',
  8.         // -- Android
  9.         'Android' => 'Android',
  10.         // -- Windows
  11.         'Windows NT 6.2' => 'Windows 8',
  12.         'Windows NT 6.1' => 'Windows Seven',
  13.         'Windows NT 6.0' => 'Windows Vista',
  14.         'Windows NT 5.2' => 'Windows Server 2003',
  15.         'Windows NT 5.1' => 'Windows XP',
  16.         'Windows NT 5.0' => 'Windows 2000',
  17.         'Windows 2000' => 'Windows 2000',
  18.         'Windows CE' => 'Windows Mobile',
  19.         'Win 9x 4.90' => 'Windows Me.',
  20.         'Windows 98' => 'Windows 98',
  21.         'Windows 95' => 'Windows 95',
  22.         'Win95' => 'Windows 95',
  23.         'Windows NT' => 'Windows NT',
  24.         // -- Linux
  25.         'Ubuntu' => 'Linux Ubuntu',
  26.         'Fedora' => 'Linux Fedora',
  27.         'Linux' => 'Linux',
  28.         // -- Mac
  29.         'Macintosh' => 'Mac',
  30.         'Mac OS X' => 'Mac OS X',
  31.         'Mac_PowerPC' => 'Mac PowerPC',
  32.         'Mac' => 'Mac',
  33.         // -- Autres ...
  34.         'FreeBSD' => 'FreeBSD',
  35.         'Unix' => 'Unix',
  36.         'Playstation portable' => 'Playstation portable',
  37.         'Playstation 1' => 'Playstation 1',
  38.         'Playstation 2' => 'Playstation 2',
  39.         'Playstation 3' => 'Playstation 3',
  40.         'OpenSolaris' => 'SunOS',
  41.         'SunOS' => 'SunOS',
  42.         'Nintendo Wii' => 'Nintendo Wii',
  43.         'Googlebot' => 'Google Bot',
  44.         'Haiku' => 'Haiku',
  45.     );
  46.     $ua = strtolower($ua);
  47.     foreach($os_arr as $k => $v) {
  48.         if(preg_match("#".$k."#i", $ua)) {
  49.             $os = $v;
  50.             break;
  51.         }
  52.     }
  53.     return $os;
  54. }
  55.  
  56. function Navigateur() {
  57.     $u_agent = $_SERVER['HTTP_USER_AGENT'];
  58.     $bname = 'Autre/Bot';
  59.     $version = "";
  60.     if(preg_match('/MSIE/i', $u_agent) && !preg_match('/Opera/i', $u_agent)) {
  61.         $bname = 'Internet Explorer';
  62.         $ub = "MSIE";
  63.     } else if(preg_match('/Android/i', $u_agent)) {
  64.         $bname = 'Android';
  65.         $ub = "Android";
  66.     } else if(preg_match('/Firefox/i', $u_agent)) {
  67.         $bname = 'Mozilla Firefox';
  68.         $ub = "Firefox";
  69.     } else if(preg_match('/Chrome/i', $u_agent)) {
  70.         $bname = 'Google Chrome';
  71.         $ub = "Chrome";
  72.     } else if(preg_match('/Safari/i', $u_agent)) {
  73.         $bname = 'Apple Safari';
  74.         $ub = "Safari";
  75.     } else if(preg_match('/Opera/i', $u_agent)) {
  76.         $bname = 'Opera';
  77.         $ub = "Opera";
  78.     } else if(preg_match('/Netscape/i', $u_agent)) {
  79.         $bname = 'Netscape';
  80.         $ub = "Netscape";
  81.     } else if(preg_match('/Googlebot/i', $u_agent)) {
  82.         $bname = 'Googlebot';
  83.         $ub = "Googlebot";
  84.     }
  85.     $known = array('Version', $ub, 'other');
  86.     $pattern = '#(?<browser>'.join('|', $known).')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
  87.     //if(!preg_match_all($pattern, $u_agent, $matches)) { }
  88.     $i = count($matches['browser']);
  89.     if($i !== 1) {
  90.         //if(strripos($u_agent, "Version") < strripos($u_agent, $ub)) {
  91.             $version = $matches['version'][0];
  92.         } else {
  93.             $version = $matches['version'][1];
  94.         }
  95.     //} else {
  96.         //$version = $matches['version'][0];
  97.     //}
  98.     if($version == null) {
  99.         $version = "";
  100.     }
  101.     return $bname." ".$version;
  102. }
  103.  
  104. $bloc = "
  105. <!-- Debut du Bloc -->
  106. <center>
  107. <script language='javascript'>
  108. document.write('<b>Addresse IP</b><br>".$_SERVER['REMOTE_ADDR']."');
  109. document.write('<hr><b>Résolution</b><br>' + screen.width + 'x' + screen.height + 'x' + window.screen.colorDepth);
  110. document.write('<hr><b>Navigateur</b><br>".Navigateur()."');
  111. document.write('<hr><b>Plateforme</b><br>".OS()."');
  112. </script>
  113. </center>
  114. <!-- Fin du Bloc -->";
  115. Bloc ($result_blocs->parametre1,$bloc) ;
  116. ?>


Sujet écrit par Musicgroove le lundi 23 décembre 2013 à 20:15

[ Imprimer ] - [ Fermer la fenêtre ]