<?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
****************************************************************************************/


// Vérification des tentatives de hack
$pos=strpos($_SERVER['PHP_SELF'],"inc.php");
if ($pos===FALSE)
	$ok_inc=TRUE;
else
	$ok_inc=FALSE;
if ($ok_inc==FALSE) header("Location: ../index.php");

/*************************************************************/
/* Fonctions pour les accès aux différents fichiers dans SMI */
/*************************************************************/

function lst_icon_not_used($url_img,$url_lien)
{
	$used=FALSE;
	$connico = mysql_connect(DBHOST, DBUSER, DBPASS);
	mysql_select_db(DBNAME);
	$rechico = "SELECT * FROM " .TBSTA. ", ".TBLIEU. ", ".TBDOSC. ", ".TBDOSS.", ".TBDOSTA;
	$rechico.=" WHERE ".TBSTA.".statut_img = '$url_img' OR ".TBLIEU.".lieu_img = '$url_img'";
	$rechico.=" OR ".TBDOSC.".dosc_img = '$url_img' OR ".TBDOSS.".doss_img = '$url_img'";
	$rechico.=" OR ".TBDOSTA.".dosta_img = '$url_img'";
	$rsico = mysql_query($rechico) or die(mysql_error());
	if (mysql_num_rows($rsico) == 0)
	{
		echo "<a href=\"".$url_lien."\">";
		echo "<img src=\"".$url_img."\" border =\"0\">";
		echo " </a>";
	}
	mysql_free_result($rsico);
	mysql_close($connico);
	return $used;
}

?>