<?php
session_start();  //donner un nom utilisateur
include_once("../../cgi-php/connect.php");
connect_office()
	or exit ();
	
$sid=session_id();
$jour=date("d-m-Y");
$fichier = fopen ('http://www.1info.com/1computer/info.html', "r");
while ($str = fread ($fichier, 16)) {
        $html .=$str;
}
fclose ($fichier);

if ($_GET['code'] == "")
     $code = "0";
else
	$code=$_GET['code'];
	
$res = mysql_query ("SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(start_info), '%d-%m-%Y'), FROM_UNIXTIME(UNIX_TIMESTAMP(end_info), '%d-%m-%Y'), type_info, group_info, level_info, lieu_info, libelle_info, link_info, rem_info, title_info
       FROM info
       WHERE type_info LIKE '$code'
       ORDER BY group_info, start_info ");

if (!$res)
	print("Requete Failed");
else {
$qte=mysql_num_rows($res);
$info="<table><tr>\n";
$info.="<td>Name&nbsp;+Link&nbsp;Lien</td>";
$info.="<td>Info&nbsp;Remarque</td>";
$info.="<td>Start</td>";
$info.="<td>End</td>";
$info.="<td>Lieu</td></tr>";
while ($row  =  mysql_fetch_row($res)) {
   $cpt++; //compte le nombre de lignes
   $ligne = ($cpt % 2)
                //? "#EEEEEE"
                //  : "#FFFFFF";
                  ? "ligne1"
                  : "ligne2";
				  
  if($row[4] == 0){
        $info.='<tr class="'.$ligne.'">';
        $info.="<td bgcolor='#ff9900' colspan=\"5\" align=\"center\" valign=\"middle\">\n";
        //open_titre(b8c8ff,150);
        $info.="$row[5]\n";
        //close_titre(b8c8ff);
        $info.="</td></tr>\n";
      }
  else {
     $info.='<tr class="'.$ligne.'">';
	  $info.="<td><a href=\"http://$row[7]\" target=\"_blank\" title=\"$row[9]\">$row[8]</a></td>\n";//nom
	  $info.="<td>$row[6]</td>\n";//libelle
	  $info.="<td>$row[0]</td>\n";//date debut
	  $info.="<td>$row[1]</td>\n";//date fin
	  $info.="<td>$row[5]</td>\n";//lieu
     $info.="</tr>\n";
    }
}
$info.="</table>";
$html = ereg_replace ("{INFO}", "$info", $html);
echo $html;
}
mysql_free_result($res);
?>
