<?php
/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Version 0.9.9

Copyright (C) 2006-2009  Sylvain FATOME
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation; 
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program
(in the directory docs); 
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
Boston, MA  02110-1301, USA.

Contact : galawa@free.fr

Web : http://smitst.homelinux.com
****************************************************************************************/

session_start(); 
if (!isset($_SESSION["lng"])) $_SESSION["lng"]="fr";
include_once("../lng/".$_SESSION["lng"].".inc.php"); // Paramètres de language
include_once("../inc/config.inc.php");
include_once("../inc/func_log.inc.php");
if (CheckURLLog(FALSE)==FALSE) header("Location: ../index.php");
if (CheckNivLog("9")==FALSE) header("Location: ../index.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_txt.inc.php");
include_once("../inc/lst.inc.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<title>SMI - <?PHP echo $title_esp_prive; ?> : <?PHP echo $title_flog_lst; ?></title>

<!-- Feuille de style pour les affichages courants -->
<link href="../css/smi.css" rel="stylesheet" type="text/css">

<!-- Feuille de style & Script pour le menu -->
<script language="JavaScript" src="../jscript/coolmenus/coolmenus4.js"></script>

<!-- Scripts Javascript pour fenêtres -->
<script language="JavaScript" src="../jscript/fen.js"></script>

<!-- Définition Javascript pour calendrier popup -->
  <!-- Feuille de Style -->
  <link rel="stylesheet" type="text/css" media="all" href="../jscript/jscal/skins/aqua/theme.css" title="Aqua" />

  <!-- Script Javascript Principal -->
  <script type="text/javascript" src="../jscript/jscal/calendar.js"></script>

  <!-- Choix du langage -->
  <script type="text/javascript" src="../jscript/jscal/lang/calendar-<?PHP echo $_SESSION["lng"]; ?>.js"></script>

  <!-- the following script defines the Calendar.setup helper function, which makes
       adding a calendar a matter of 1 or 2 lines of code. -->
  <script type="text/javascript" src="../jscript/jscal/calendar-setup.js"></script>
<!-- Fin de la définition Javascript pour calendrier popup -->

<!-- Scripts Javascript pour contrôle de formulaire -->
<script	type="text/javascript" src="../jscript/vform/vform.js"></script>

<script language="javascript">
<!--
var tab_champ=new Array(
	"nom:date1f ; format:date ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_dtedeb); ?> ; masque:<?PHP echo $datemsql; ?> ; stok:frmok ; stbad:frmbad",
	"nom:date2f ; format:date ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_dtefin); ?> ; masque:<?PHP echo $datemsql; ?> ; stok:frmok ; stbad:frmbad");
//-->
</script>

<!-- Scripts Javascript de validation des formulaires -->
<script	type="text/javascript" src="../jscript/verif_form.js"></script>

<!-- Scripts Javascript divers -->
<script language="JavaScript" src="../jscript/divers.js"></script>

</head>

<body onLoad="metFocus();">

<?php 
include_once("../inc/entete.inc.php"); 
?>
<p align="center"><span class="titrepage"><?PHP echo $titlein_flog_lst; ?></span></p>
<?PHP
$fic_imp = "flog_lsti.php";

$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
mysql_select_db(DBNAME);

// Détermination du nombre total d'enregistrements
$rech = cree_strrechlstflog();
$rech .= crestr_triord($flog_titre_col,"ficlog_date",FALSE,$limitlog);
	 
$rs = mysql_query($rech) or die(mysql_error());
$numrows = mysql_num_rows($rs); // Nombre de résultats à la requête

// *** Pagination d'entête
pagine_lst($numrows,$limit);

if($numrows == 0)
{
	retpp();
}
 else
{
	include_once("../inc/formr.inc.php"); 

	$rech = cree_strrechlstflog();
	$rech .= crestr_triord($flog_titre_col,"ficlog_date",TRUE,$limitlog);

	$rs = mysql_query($rech) or die(mysql_error());

	// *** Pagination de pied
	pagine_lst($numrows,$limit);
	
	// *** Affichage de la table
	echo "<span class=\"annot_petit_it\">".$txt_lnk_clic_ip."</span>";
	echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";     
	
	// Création entête
	titlst($flog_titre_col);
	
	$i = 0;
		
	while ($row = mysql_fetch_assoc($rs)) 
	{         
		// Création de l'entête de ligne (TR)
		creetrlst($i);
		
		echo "<td align=\"center\">".formatedate($row["ficlog_date"])."</td>\n";
		echo "<td align=\"center\">".$row["ficlog_heure"]."</td>\n";
		echo "<td align=\"center\">";
		echo "<a href=\"javascript:;\" onclick=\"javascript:; fen_det_ip('".$row["ficlog_ip"]."');\">".$row["ficlog_ip"]."</a>";
		echo "</td>\n";
		echo "<td>".$row["ficlog_ref"]."</td>\n";
		echo "<td>".$row["ficlog_fic"]."</td>\n";
		echo "<td align=\"center\">";
		echo $typ_flog[intval($row["ficlog_type"])];
		echo "</td>\n";
	
		echo "</tr>\n";
		
		$i++;    
	}  
	echo "</table>\n";
	// *** Fin affichage de la table
	
	mysql_free_result($rs);
	mysql_close($conn);  
	
	// *** Pagination de pied
	pagine_lst($numrows,$limit);
			
	$taille_piedla="";
	include_once("../inc/piedla.inc.php"); 
}

if ($numrows>0)
{
?>
<!-- Permet de purger des logs sur une fourchette de dates -->
<form name="log_purge" id="log_purge" method="post" action="flog_enr.php?td=del">
<p align="center" class="titre_gras_soul">PURGE DES LOGS</p>
<table width="400"  border="0" align="center">
<tr>
<td width="30" class="rubfrm" id="f_date1f" align="right"><?PHP echo $txt_div_fromMAJ; ?>...</td>
<td>
	<input name="date1f" type="text" id="date1f" size="10" maxlength="10" readonly="1">
	<img src="../img/calendar.png" align="absmiddle" id="f_img_date1f" title="<?PHP echo $alt_chxdate; ?>">
	<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
</td>
<td width="30" class="rubfrm" id="f_date2f" align="right"><?PHP echo $txt_div_toMAJ; ?>...</td>
<td>
	<input name="date2f" type="text" id="date2f" size="10" maxlength="10" readonly="1">
	<img src="../img/calendar.png" align="absmiddle" id="f_img_date2f" title="<?PHP echo $alt_chxdate; ?>">
	<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
</td>
</tr>
</table>
<p align="center">
<input name="purge" type="button" class="bton_std" id="purge" value="<?PHP echo $but_purger; ?>" onClick="verif_flogs(log_purge,tab_champ,'','',this.value);">
<input name="purge" type="button" class="bton_std" id="purge" value="<?PHP echo $but_purgertt; ?>" onClick="verif_flogs(log_purge,tab_champ,'','',this.value);">
</p>
</form>

<script type="text/javascript">
<!--
Calendar.setup({
inputField     :    "date1f",     // id of the input field
ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
button         :    "f_img_date1f",  // trigger for the calendar (button ID)
align          :    "Ll",           // alignment (defaults to "Bl")
electric	   :	false,
singleClick    :    true
});
Calendar.setup({
inputField     :    "date2f",     // id of the input field
ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
button         :    "f_img_date2f",  // trigger for the calendar (button ID)
align          :    "Ll",           // alignment (defaults to "Bl")
electric	   :	false,
singleClick    :    true
});
//-->
</script>

<?php 
}
include_once("pied.php");
?>
