<?
/*
*********************************************************************
* File          : $RCSfile: read.php3,v $
* Version	: $Revision: 1.1.1.1 $
* Modified by	: $Author: jb $ ($Date: 2002/03/10 17:13:32 $)
*********************************************************************

        Page Principale pour l'administration des statistiques
             V.1.00 : 23-12-2001 : Mise en forme générale
*/
      require "conf.php";
      require "Archi.php";
      include "cadre.php";
      require "ErreurConnect.php";
      require "msg_french.inc.php3";

      // On vérifie avant d'afficher quoi que ce soit que la requete est valide
      // Connexion au serveur de BDD
      $connexion = jb_sql_connect(true);

      // On verifie que la page appellée contient bien le meme identifiant que la page enregistrée sur la base
      $requete=mysql_db_query($sql_bdd,"select pseudo from membre where id=\"$id\"",$connexion);
      // Si l'Id est différent -> Alors on affiche la page d'erreur
      $resultat = mysql_num_rows($requete);
      // On a terminé avec la connexion avec la base -> On ferme la connexion
      mysql_close($connexion);
      if($resultat ==0)
      {
          // Redirection vers la page d'erreur
          header("Location:$url_erreur");
      } // fin if(mysql_num_rows($requete)==0)
      else
      {
          // Sinon  On Affiche l'ossature du site
          $pOssature = new Archi ("HautAdmin.html","","");
          $pOssature->AffichePartieHaut(0,0);
        }?>

<link rel="stylesheet" href="style1.css">

<body bgcolor="#FFFFFF">
<table width="545" border="1" cellspacing="0" cellpadding="2" bordercolor="#636563" class="normal">
  <tr bordercolor="#666666">
    <td colspan="2" bgcolor="#666666" class="titre" height="60">
      <div align="center" class="titre"><font color="#FFFFFF">&gt;&gt; <? echo $msgAdminPanel ?>
        &lt;&lt; </font></div>
    </td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td colspan="3" bordercolor="#666666" height="200">
      <p align="right"><?
function AL_Date( ) {
  require "msg_french.inc.php3";
  echo $msgDaysArray[date("w")] ." ";
  echo date("j")." ";
  echo $msgMonthsArray[date("n")-1]." ".date("Y");
}

AL_Date( );
?> </p>
      <p align="left"> <span class="normal"><?
 $today = date("Y-m-d" , $reqdate);
 switch ($period) {
    case "jour":
        echo date("d " , $reqdate).$msgMonthsArray[date("n", $reqdate)-1].date(" Y" , $reqdate);
        break;
    case "semaine":
        $weeklowreqdate = ($reqdate-(86400*date("w" , $reqdate)));
        $weekhighreqdate = ($reqdate+(86400*(6-date("w" , $reqdate)) ));
        echo "<b>".$msgFrom."</b>".date("d " , $weeklowreqdate).$msgMonthsArray[date("n", $weeklowreqdate)-1].date(" Y" , $weeklowreqdate);
        echo " <b>".$msgTo."</b>".date("d " , $weekhighreqdate ).$msgMonthsArray[date("n", $weekhighreqdate)-1].date(" Y" , $weekhighreqdate);
        break;
    case "mois":
        echo $msgMonthsArray[date("n", $reqdate)-1].date(" Y", $reqdate);
       break;
 }

?></span><br>
        <?
# Read logs
 require "conf.php";

 $c = jb_sql_connect(true);
 $db = mysql_select_db($sql_bdd) or die($msgBaseConnectImpossible);

  $today = date("Y-m-d" , $reqdate);
  switch ($period) {
    case "jour":
        if ($stp!="") {
            $q_string = "SELECT * FROM $table WHERE DAYOFYEAR(date)=DAYOFYEAR(FROM_UNIXTIME($reqdate)) and $stp='$stp2' order by date DESC";
        } else
        $q_string = "SELECT * FROM $table WHERE DAYOFYEAR(date)=DAYOFYEAR(FROM_UNIXTIME($reqdate)) order by date DESC";
        $req = mysql_query ($q_string) or die ($msgSqlQuerryError);
        break;
    case "semaine":
        if ($stp!="") {
            $q_string = "SELECT * FROM $table WHERE WEEK(date)=WEEK(FROM_UNIXTIME('$reqdate')) AND $stp='$stp2' order by date DESC";
        } else
        $q_string = "SELECT * FROM $table WHERE WEEK(date)=WEEK(FROM_UNIXTIME('$reqdate')) order by date DESC";
        $req = mysql_query ($q_string) or die ($msgSqlQuerryError);
        break;
    case "mois":
        if ($stp!="") {
            $q_string = "SELECT * FROM $table WHERE MONTH(date)=MONTH(FROM_UNIXTIME('$reqdate')) AND $stp='$stp2' order by date DESC";
        } else
        $q_string = "SELECT * FROM $table WHERE MONTH(date)=MONTH(FROM_UNIXTIME('$reqdate')) order by date DESC";
        $req = mysql_query ($q_string) or die ($msgSqlQuerryError);
       break;
  }

  $nb_champs=mysql_num_fields($req);
  $nb_line=mysql_num_rows($req);

  printf ("$nb_line $msgRecords");
  if ($stp=="os" and $stp2=='???') echo " :$msgNotRecognizedOs";
  if ($stp=="wb" and $stp2=='???') echo " :$msgNotRecognizedWb";
  printf ("<br>");

  $i=0;
  echo "<table align=\"center\" width=\"650\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">";
  echo "<tr>";
  while($i<$nb_champs)
     {
     $nom_champs=mysql_field_name($req,$i);
     echo "<td bgcolor=\"#CCCCCC\"><div align=\"center\"><b>$nom_champs</b></div></td>";
     $i++;
     }
  echo "</tr>";


$i=0;
$j=0;
$sta = true;
while($j<$nb_line)
       {
       echo "<tr>";
       while($i<$nb_champs)
              {
              if ($sta) { $color = "#CCCCFF" ; } else { $color = "#FFFFCC" ;}
              $nom_champs=mysql_field_name($req,$i);
              $$nom_champs=mysql_result($req,$j,$nom_champs);
              if ( $nom_champs =="referer" ){
                 echo "<td bgcolor=\"$color\"><div align=\"left\">"."<a href=\"".$$nom_champs."\" target=\"_blank\">".$$nom_champs."</a>"."</div></td>";
              } else {
                 echo "<td bgcolor=\"$color\"><div align=\"left\">".$$nom_champs."</div></td>";
                }

              $i++;
              }
       echo "</tr>";
       $i=0;
       $j++;
       $sta = !$sta;
       }
  echo "</table>";
  mysql_close ($c);
?></p>
      <p align="center" class="verysmall">
        <? echo $msgStatBy ?> <a href="http://www.ezboo.com" target="_blank">ezBOO</a>
        <? echo $msgVersion ?> </p>
      </td>
  </tr>
</table>

</body>
</html>