Des drapeaux en fonction des IP

Bonjour à tous!!

Alors voila dans index.php?mod=stats&ac=ip

je propose d'afficher le drapeau du pays du visiteur en fonction de son IP


Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1. <?php
  2. // ---------------------------------------------------------------
  3. // KwsPHP kOoGar Web System
  4. // $Id: ip.php 726 2008-06-02 20:59:42Z foupoudave.devpwsphp $
  5. // ---------------------------------------------------------------
  6. // Mise a jour : 27/09/06 par Jack
  7. // ---------------------------------------------------------------
  8.  
  9. if (!(defined('__KWS__'))) {die ('Erreur d\'appel de fichier.');}
  10.  
  11. if (get_grade()<GRD_MODOG)
  12. {
  13.     ZoneReserve();
  14. }
  15. else
  16. {
  17.     bloc_head('Adresse IP des Visiteurs');
  18.     echo '<table border="1" summary="IP des visiteurs" style="margin:auto;">
  19.         <tr bgcolor="'.$col1.'" style="text-align:center;">
  20.             <th>ID</th>
  21.             <th>Pseudo</th>
  22.             <th>IP</th>
  23.             <th>Pages vues</th>
  24.             <th>Temps de connexion</th>
  25.             <th>D&eacute;but de connexion</th>
  26.             <th>Fin de connexion</th>
  27.             <th>Pays</th>
  28.         </tr>';
  29.  
  30.         $ip_req = reqmysql('
  31.             SELECT
  32.             
  33.                   `visiteurs`.`tpsdebut`,
  34.                         `visiteurs`.`tpsfin`,
  35.                         `visiteurs`.`pseudo`,
  36.                         `visiteurs`.`ip`,
  37.                         `visiteurs`.`pages`,
  38.                         `users`.`id`            AS uid
  39.             FROM `visiteurs`
  40.             LEFT JOIN `users`
  41.                 ON        `visiteurs`.`pseudo` = `users`.`pseudo`
  42.             WHERE        `visiteurs`.`pseudo` != "stats_jour"
  43.             ORDER BY    `tpsfin` ASC
  44.         ');
  45.  
  46.         while($ip_req1=mysql_fetch_object($ip_req))
  47.         {
  48.             echo '<tr style="text-align:center;">
  49.                 <td class="row1">'.(empty($ip_req1->ip) ? 'No-ip' : ax($ip_req1->ip)).'</td>
  50.                 <td class="row1"><a href="./index.php?mod=espace_membre&amp;ac=profil&amp;id='.ax($ip_req1->uid).'" target="_blank">'.ax($ip_req1->pseudo).'</a></td>
  51.                 <td class="row1"><a href="http://network-tools.com/default.asp?host='.(empty($ip_req1->ip) ? 'No-ip' : ax($ip_req1->ip)).'" target="_blank">'.(empty($ip_req1->ip) ? 'No-ip' : ax($ip_req1->ip)).'</a></td>
  52.                 <td class="row1">'.ax($ip_req1->pages).'</td>
  53.                 <td class="row1">';
  54.                     $duree = $ip_req1->tpsfin-$ip_req1->tpsdebut;
  55.                     if ($duree < 3600)
  56.                     {
  57.                         echo '00h '.date('i\m\n s\s',$duree);
  58.                     }
  59.                     else
  60.                     {
  61.                         echo date('H\h i\m\n s\s',$duree);
  62.                     }
  63.                 echo '</td>
  64.                 <td class="row1">'.date("d/m/y \à H:i:s",$ip_req1->tpsdebut).'</td>
  65.                 <td class="row1">'.date("d/m/y \à H:i:s",$ip_req1->tpsfin).'</td>';
  66.             
  67.                     {
  68.                 echo '<td class="row1"><a href="http://geotool.servehttp.com/?ip='.(empty($ip_req1->ip) ? 'No-ip' : ax($ip_req1->ip)).'" target="_blank"><IMG SRC="http://api.hostip.info/flag.php?ip='.$ip_req1->ip.' width="100" height="30" "></td>';
  69.                     }
  70.  
  71.                 
  72.         }
  73.         
  74.         
  75.     echo '</table>';
  76.     close_table();
  77.     $aff_drt=1;
  78. }
  79. ?>



Cela fonctionne nickel avec mozilla mais pas correctement avec Internet explorer je ne sais pas pourquoi
Si vous avez une idée



Sujet écrit par pelluche le lundi 6 avril 2009 à 21:13

[ Imprimer ] - [ Fermer la fenêtre ]