<?php

// 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");


include_once("../inc/config.inc.php");
include_once("../inc/fic_age.inc.php");
include_once("../inc/fic_hum.inc.php");
include_once("../inc/fic_cli.inc.php");
include_once("../inc/fic_do.inc.php");
include_once("../inc/fic_droits.inc.php");
include_once("../inc/fic_mque.inc.php");
include_once("../inc/fic_st.inc.php");
include_once("../inc/fic_rel.inc.php");
include_once("../inc/fic_tec.inc.php");
include_once("../inc/fic_txt.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_log.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_mail.inc.php");
include_once("../inc/func_txt.inc.php");
include_once("../inc/func_txtcm.inc.php");
include_once("../classes/phpmailer/class.phpmailer.php");
include_once("../classes/phpmailer/class.smtp.php");
include_once("../inc/mail.inc.php");
include_once("../classes/ezSQL/shared/ez_sql_core.php");
include_once("../classes/ezSQL/mysqli/ez_sql_mysqli.php");
include_once("../inc/func_sql.inc.php");
Archivelog(@$_SESSION["code_log"]);
// Variables Formulaire
fix_magic_quotes();
$_POST = clean_str($_POST);

$titre = @$_POST["titre"];
$td = @$_POST["td"];

$coderel = str_majuscules(@$_POST["coderel"]);
$code = str_majuscules(@$_POST["code"]);
$daterel = datetomysql(@$_POST["daterelf"]);
if (@$_POST["dateoutf"] <> "")
    $dateout = datetomysql(@$_POST["dateoutf"]);
else
    $dateout = "";
$codecli = str_majuscules(@$_POST["codecli"]);
$codeage = str_majuscules(@$_POST["codeage"]);
$site = str_majuscules(@$_POST["site"]);
$codetec = str_majuscules(@$_POST["codetec"]);
$codecat = str_majuscules(@$_POST["codecat"]);
$codema = str_majuscules(@$_POST["codema"]);
$modele = str_majuscules(@$_POST["modele"]);
$ns = str_majuscules(@$_POST["ns"]);
$codeet = str_majuscules(@$_POST["codeet"]);
$coderlic = "";
if (count($_POST["rlic_choisi"]) <> 0) {
    for ($i = 0; $i < count($_POST["rlic_choisi"]); $i++) {
        $coderlic .= $_POST["rlic_choisi"][$i] . "-";
    }
}
if ($coderlic != "")
    $coderlic = substr($coderlic, 0, strlen($coderlic) - 1);
$empl = @$_POST["empl"];

$codep = @$_POST["codep"];
// Si le codage produit théorique n'a pas été changé, on incrémente la Numérotation dans le dossier principal
// Sinon, on ne fait rien
$row = lit_enr_rel($coderel);
$num = $row["rel_num"] + 1;
$rpdt_codep_calcule = $row["rel_rnum"] . sprintf("%'04s", $num);
if ($codep == $rpdt_codep_calcule) {
    $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);
    $rech = "UPDATE `" . TBREL;
    $rech .= "` SET `rel_num`='" . $num . "'";
    $db->query($rech);
    $db->disconnect();
}

if (@$_POST["dateachf"] <> "")
    $dateach = datetomysql(@$_POST["dateachf"]);
else
    $dateach = "";
if (@$_POST["datefgarf"] <> "")
    $datefgar = datetomysql(@$_POST["datefgarf"]);
else
    $datefgar = "";
$gars = intval(@$_POST["gars"]);
$prop = intval(@$_POST["prop"]);

$util = @$_POST["util"];
$nomp = @$_POST["nomp"];
$gt = @$_POST["gt"];
$dom = @$_POST["dom"];
$login = @$_POST["login"];
$mdp = @$_POST["mdp"];
$mac = @$_POST["mac"];
$modeip = @$_POST["modeip"];
$sdhcp = intval(@$_POST["sdhcp"]);
$ip1 = @$_POST["ip1"];
$ip2 = @$_POST["ip2"];
$mdhcp = @$_POST["mdhcp"];
$ip = @$_POST["ip"];
$masq = @$_POST["masq"];
$pass = @$_POST["pass"];
$npm = @$_POST["npm"];
$npb = @$_POST["npb"];
$npc = @$_POST["npc"];
$snmp = intval(@$_POST["snmp"]);
$wol = intval(@$_POST["wol"]);
$sid = @$_POST["sid"];
$wep = @$_POST["wep"];
$codeta = str_majuscules(@$_POST["codeta"]);
$tma = str_majuscules(@$_POST["tma"]);
$codel = str_majuscules(@$_POST["codel"]);
$tser = intval(@$_POST["tser"]);
$tlien = @$_POST["tlien"];
$tlogin = @$_POST["tlogin"];
$tmdp = @$_POST["tmdp"];
$tae = intval(@$_POST["tae"]);
$tred = intval(@$_POST["tred"]);
$codem = str_majuscules(@$_POST["codem"]);
$mper = str_majuscules(@$_POST["mper"]);
$mtype = @$_POST["mtype"];
$mlogin = @$_POST["mlogin"];
$mmdp = @$_POST["mmdp"];
if (@$_POST["mdvalf"] <> "")
    $mdval = datetomysql(@$_POST["mdvalf"]);
else
    $mdval = "";
if (@$_POST["mdlmajf"] <> "")
    $mdlmaj = datetomysql(@$_POST["mdlmajf"]);
else
    $mdlmaj = "";
$mae = intval(@$_POST["mae"]);
$mred = intval(@$_POST["mred"]);

$nota = @$_POST["nota"];
$signataire = @$_POST["signataire"];

$codeuser = @$_SESSION["code_log"];

$retourliste = TRUE;
/*
if (@$_POST["enrimp"] == "Enregistrer & Imprimer") {
    $imprim = TRUE;
    $retourliste = FALSE;
}
*/

switch ($td) {
    // Ajout de la fiche relevé matériel
    case "add" :
        $coderm = crecode("RM", TRUE);

        $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);
        $rech = "INSERT INTO `" . TBRPDT . "`";
        $rech .= " (rpdt_datecrea,rpdt_codecrea,rpdt_datemod,rpdt_codemod,rpdt_coderel,rpdt_code,rpdt_daterel,rpdt_codecli,rpdt_codeage,";
        $rech .= "rpdt_codetec,rpdt_codecat,rpdt_codema,rpdt_modele,rpdt_ns,rpdt_codeet,rpdt_coderlic,rpdt_empl,rpdt_codep,rpdt_util,rpdt_nomp,";
        $rech .= "rpdt_gt,rpdt_dom,rpdt_login,rpdt_mdp,rpdt_mac,rpdt_modeip,rpdt_sdhcp,rpdt_ip1,rpdt_ip2,rpdt_mdhcp,rpdt_ip,rpdt_masq,rpdt_pass,rpdt_npm,rpdt_npb,rpdt_npc,rpdt_snmp,rpdt_wol,rpdt_sid,rpdt_wep,";
        $rech .= "rpdt_codeta,rpdt_tma,rpdt_codel,rpdt_tser,rpdt_tlien,rpdt_tlogin,rpdt_tmdp,rpdt_tae,rpdt_tred,";
        $rech .= "rpdt_codem,rpdt_mmode,rpdt_mper,rpdt_mlogin,rpdt_mmdp,rpdt_mdval,rpdt_mdlmaj,rpdt_mae,rpdt_mred,";
        $rech .= "rpdt_dateach,rpdt_fingar,rpdt_gars,rpdt_prop,rpdt_dateout,rpdt_nota,rpdt_signataire,rpdt_idsite)";
        $rech .= " VALUES";
        $rech .= " ('$datea','$codeuser','$datea','$codeuser','$coderel','$coderm','$daterel','$codecli','$codeage',";
        $rech .= "'$codetec','$codecat','$codema','".$db->escape($modele)."','".$db->escape($ns)."','$codeet','$coderlic','".$db->escape($empl)."','".$db->escape($codep)."','" . $db->escape($util) . "','" . $db->escape($nomp) . "',";
        $rech .= "'".$db->escape($gt)."','".$db->escape($dom)."','" . $db->escape($login) . "','" . $db->escape($mdp) . "','$mac','$modeip','$sdhcp','$ip1','$ip2','$mdhcp','$ip','$masq','$pass','".$db->escape($npm)."','".$db->escape($npb)."','".$db->escape($npc)."','$snmp','$wol','".$db->escape($sid)."','" . $db->escape($wep) . "',";
        $rech .= "'$codeta','$tma','$codel','$tser','".$db->escape($tlien)."','" . $db->escape($tlogin) . "','" . $db->escape($tmdp) . "','$tae','$tred',";
        $rech .= "'$codem','$mtype','$mper','" . $db->escape($mlogin) . "','" . $db->escape($mmdp) . "','$mdval','$mdlmaj','$mae','$mred',";
        $rech .= "'$dateach','$datefgar','$gars','$prop','$dateout','" . $db->escape($nota) . "','" . $db->escape($signataire) . "','$site')";
        $db->query($rech);

        // Ajout des connexions
        $rech = "SELECT * FROM `" . TBRPDT . "`  WHERE rpdt_code <> '" . $coderm . "' AND rpdt_dateout='0000-00-00'";
        $rech .= " AND rpdt_codecli='" . $codecli . "'";
        $rech .= " ORDER BY rpdt_code";
        $rows = $db->get_results($rech, ARRAY_A);
        if ($rows) {
            foreach ($rows as $row) {
                extract($row);
                $ctype = intval(@$_POST[$rpdt_code]);
                $rech2 = "";
                switch ($ctype) {
                    // Pas de connexion
                    case 0 :
                        break;

                    // connecté sur
                    case 1 :
                        // Le matériel est 'connecté sur' le produit
                        $rech2 = "INSERT INTO `" . TBCNX . "`";
                        $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                        $rech2 .= " VALUES";
                        $rech2 .= " ('$codeuser','$datea','$rpdt_code','$coderm','2')";
                        $db->query($rech2);
                        // Le produit est 'Contrôleur' du matériel
                        $rech2 = "INSERT INTO `" . TBCNX . "`";
                        $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                        $rech2 .= " VALUES";
                        $rech2 .= " ('$codeuser','$datea','$coderm','$rpdt_code','1')";
                        $db->query($rech2);
                        break;

                    // Contrôleur de
                    case 2 :
                        // Le matériel est 'Contrôleur' du produit
                        $rech2 = "INSERT INTO `" . TBCNX . "`";
                        $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                        $rech2 .= " VALUES";
                        $rech2 .= " ('$codeuser','$datea','$coderm','$rpdt_code','2')";
                        $db->query($rech2);
                        // Le produit est 'connecté sur' le matériel
                        $rech2 = "INSERT INTO `" . TBCNX . "`";
                        $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                        $rech2 .= " VALUES";
                        $rech2 .= " ('$codeuser','$datea','$rpdt_code','$coderm','1')";
                        $db->query($rech2);
                        break;

                    // Relié à
                    case 3 :
                        // Le matériel et le produit sont reliés
                        $rech2 = "INSERT INTO `" . TBCNX . "`";
                        $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                        $rech2 .= " VALUES";
                        $rech2 .= " ('$codeuser','$datea','$coderm','$rpdt_code','3')";
                        $db->query($rech2);
                        break;
                    default :
                        break;
                }
            }
        }

        $db->disconnect();

        $msg = _("Fiche ajoutée");

        // Envoi d'email vers l'agence
        if (@$_SESSION["niv_log"] <> 4)
            envoi_mail("", _("Ajout d'une fiche relevé matériel"), "rpdt", "cre", "xxx", "age", $coderm, "", "", FALSE);
        // Envoi d'email vers le centre de gestion
        envoi_mail("", _("Ajout d'une fiche relevé matériel"), "rpdt", "cre", "xxx", "cdg", $coderm, "", "", TRUE);
        break;

    // MAJ de la fiche relevé matériel
    case "edit" :
        $ok_maj = TRUE;

        if ($dateout <> "") {
            $exist_rpdt_in_rpbm_actif = exist_rpdt_in_rpbm_actif($code);
            if ($exist_rpdt_in_rpbm_actif == TRUE) {
                $ok_maj = FALSE;
                $retourliste = FALSE;
                if ($msg == "")
                    $msg = _("Cette fiche contient des problèmes déclarés et non solutionnés") . '<br />' . _("Supprimez la (les) déclaration(s) de problème concernée(s)");
                else
                    $msg .= '<br /><br />' . _("Cette fiche contient des problèmes déclarés et non solutionnés") . '<br />' . _("Supprimez la (les) déclaration(s) de problème concernée(s)");
            }
        }

        if ($ok_maj == TRUE) {
            // MAJ de la fiche relevé matériel
            $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);
            $rech = "UPDATE `" . TBRPDT;
            $rech .= "` SET `rpdt_datemod`='" . $datea . "', `rpdt_codemod`='" . $codeuser . "', `rpdt_coderel`='" . $coderel . "', `rpdt_code`='" . $code . "',";
            $rech .= " `rpdt_daterel`='" . $daterel . "', `rpdt_codecli`='" . $codecli . "', `rpdt_codeage`='" . $codeage . "', `rpdt_codetec`='" . $codetec . "',";
            $rech .= " `rpdt_codecat`='" . $codecat . "',`rpdt_codema`='" . $codema . "', `rpdt_modele`='" . $db->escape($modele) . "', `rpdt_ns`='" . $db->escape($ns) . "',";
            $rech .= " `rpdt_codeet`='" . $codeet . "', `rpdt_coderlic`='" . $coderlic . "', `rpdt_empl`='" . $db->escape($empl) . "',`rpdt_codep`='" . $db->escape($codep) . "',";
            $rech .= " `rpdt_util`='" . $db->escape($util) . "', `rpdt_nomp`='" . $db->escape($nomp) . "', `rpdt_gt`='" . $db->escape($gt) . "', `rpdt_dom`='" . $db->escape($dom) . "', `rpdt_login`='" . $db->escape($login) . "',";
            $rech .= " `rpdt_mdp`='" . $mdp . "', `rpdt_mac`='" . $mac . "', `rpdt_modeip`='" . $modeip . "', `rpdt_sdhcp`='" . $sdhcp . "',";
            $rech .= " `rpdt_ip1`='" . $ip1 . "', `rpdt_ip2`='" . $ip2 . "', `rpdt_mdhcp`='" . $mdhcp . "', `rpdt_ip`='" . $ip . "', `rpdt_masq`='" . $masq . "', `rpdt_pass`='" . $pass . "',";
            $rech .= " `rpdt_npm`='" . $db->escape($npm) . "',`rpdt_npb`='" . $db->escape($npb) . "',`rpdt_npc`='" . $db->escape($npc) . "',`rpdt_snmp`='" . $snmp . "',`rpdt_wol`='" . $wol . "',`rpdt_sid`='" . $db->escape($sid) . "',";
            $rech .= " `rpdt_wep`='" . $db->escape($wep) . "', `rpdt_codeta`='" . $codeta . "', `rpdt_tma`='" . $tma . "', `rpdt_codel`='" . $codel . "',`rpdt_tser`='" . $tser . "', `rpdt_tlien`='" . $db->escape($tlien) . "',";
            $rech .= " `rpdt_tlogin`='" . $db->escape($tlogin) . "', `rpdt_tmdp`='" . $db->escape($tmdp) . "', `rpdt_tae`='" . $tae . "', `rpdt_tred`='" . $tred . "',";
            $rech .= " `rpdt_codem`='" . $codem . "', `rpdt_mmode`='" . $mtype . "', `rpdt_mper`='" . $mper . "', `rpdt_mlogin`='" . $db->escape($mlogin) . "', `rpdt_mmdp`='" . $db->escape($mmdp) . "',";
            $rech .= " `rpdt_mdval`='" . $mdval . "', `rpdt_mdlmaj`='" . $mdlmaj . "', `rpdt_mae`='" . $mae . "', `rpdt_mred`='" . $mred . "',";
            $rech .= " `rpdt_dateach`='" . $dateach . "', `rpdt_fingar`='" . $datefgar . "', `rpdt_gars`='" . $gars . "', `rpdt_prop`='" . $prop . "',";
            $rech .= " `rpdt_dateout`='" . $dateout . "', `rpdt_nota`='" . $db->escape($nota) . "', `rpdt_signataire`='" . $db->escape($signataire) . "', `rpdt_idsite`='" . $site . "'";
            $rech .= " WHERE `rpdt_code` = '" . $db->escape($code) . "'";
            $db->query($rech);

            // Suppression des anciennes connexions
            $rech = "DELETE FROM `" . TBCNX . "`  WHERE cnx_p1 = '" . $code . "' OR cnx_p2 = '" . $db->escape($code) . "'";
            $db->query($rech);

            // On recrée les connexions
            $rech = "SELECT * FROM `" . TBRPDT . "`  WHERE rpdt_code <> '" . $db->escape($code) . "' AND rpdt_dateout='0000-00-00'";
            $rech .= " AND rpdt_codecli='" . $db->escape($codecli) . "'";
            $rech .= " ORDER BY rpdt_code";
            $rows = $db->get_results($rech, ARRAY_A);
            if ($rows) {
                foreach ($rows as $row) {
                    extract($row);
                    $ctype = intval(@$_POST[$rpdt_code]);
                    $rech2 = "";
                    switch ($ctype) {
                        // Pas de connexion
                        case 0 :
                            break;

                        // connecté sur
                        case 1 :
                            // Le matériel est 'connecté sur' le produit
                            $rech2 = "INSERT INTO `" . TBCNX . "`";
                            $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                            $rech2 .= " VALUES";
                            $rech2 .= " ('$codeuser','$datea','$rpdt_code','$code','2')";
                            $db->query($rech2);
                            // Le produit est 'Contrôleur' du matériel
                            $rech2 = "INSERT INTO `" . TBCNX . "`";
                            $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                            $rech2 .= " VALUES";
                            $rech2 .= " ('$codeuser','$datea','" . $db->escape($code) . "','$rpdt_code','1')";
                            $db->query($rech2);
                            break;

                        // Contrôleur de
                        case 2 :
                            // Le matériel est 'Contrôleur' du produit
                            $rech2 = "INSERT INTO `" . TBCNX . "`";
                            $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                            $rech2 .= " VALUES";
                            $rech2 .= " ('$codeuser','$datea','" . $db->escape($code) . "','$rpdt_code','2')";
                            $db->query($rech2);
                            // Le produit est 'connecté sur' le matériel
                            $rech2 = "INSERT INTO `" . TBCNX . "`";
                            $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                            $rech2 .= " VALUES";
                            $rech2 .= " ('$codeuser','$datea','$rpdt_code','" . $db->escape($code) . "','1')";
                            $db->query($rech2);
                            break;

                        // Installé dans
                        case 3 :
                            // Le matériel est 'installé dans' le produit
                            $rech2 = "INSERT INTO `" . TBCNX . "`";
                            $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                            $rech2 .= " VALUES";
                            $rech2 .= " ('$codeuser','$datea','$rpdt_code','" . $db->escape($code) . "','4')";
                            $db->query($rech2);
                            // Le produit est 'conteneur' du matériel
                            $rech2 = "INSERT INTO `" . TBCNX . "`";
                            $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                            $rech2 .= " VALUES";
                            $rech2 .= " ('$codeuser','$datea','" . $db->escape($code) . "','$rpdt_code','3')";
                            $db->query($rech2);
                            break;

                        // Conteneur de
                        case 4 :
                            // Le produit est 'conteneur' du matériel
                            $rech2 = "INSERT INTO `" . TBCNX . "`";
                            $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                            $rech2 .= " VALUES";
                            $rech2 .= " ('$codeuser','$datea','" . $db->escape($code) . "','$rpdt_code','4')";
                            $db->query($rech2);
                            // Le matériel est 'installé dans' le matériel
                            $rech2 = "INSERT INTO `" . TBCNX . "`";
                            $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                            $rech2 .= " VALUES";
                            $rech2 .= " ('$codeuser','$datea','$rpdt_code','" . $db->escape($code) . "','3')";
                            $db->query($rech2);
                            break;

                        // Relié à
                        case 5 :
                            // Le matériel et le produit sont reliés (dans les 2 sens)
                            $rech2 = "INSERT INTO `" . TBCNX . "`";
                            $rech2 .= " (cnx_codecrea,cnx_datecrea,cnx_p1,cnx_p2,cnx_type)";
                            $rech2 .= " VALUES";
                            $rech2 .= " ('$codeuser','$datea','" . $db->escape($code) . "','$rpdt_code','5')";
                            $db->query($rech);
                            break;
                        default :
                            break;
                    }
                }
            }

            $db->disconnect();

            $msg = _("Fiche modifiée");

            // Envoi d'email vers l'agence
            if (@$_SESSION["niv_log"] <> 4)
                envoi_mail("", _("Modification d'une fiche relevé matériel"), "rpdt", "mod", "xxx", "age", $code, "", "", FALSE);
            // Envoi d'email vers le centre de gestion
            envoi_mail("", _("Modification d'une fiche relevé matériel"), "rpdt", "mod", "xxx", "cdg", $code, "", "", TRUE);
        }
        break;

    // Suppression de la fiche relevé matériel
    case "del" :
        if (exist_rpdt_in_rpbm($code) == TRUE) {
            $retourliste = FALSE;
            $msg = _("Impossible de supprimer un relevé de matériel utilisé dans une déclaration de problème") . '<br />' . _("Choisissez plutôt de le sortir du parc...ou supprimez la déclaration de problème");
        } else {
            // SUPPRESSION de la fiche relevé matériel
            $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);
            $rech = "DELETE FROM `" . TBRPDT . "` WHERE `rpdt_code` = '" . $db->escape($code) . "'";
            $db->query($rech);

            // Suppression des anciennes connexions
            $rech = "DELETE FROM `" . TBCNX . "`  WHERE cnx_p1 = '" . $db->escape($code) . "' OR cnx_p2 = '" . $db->escape($code) . "'";
            $db->query($rech);

            $db->disconnect();
            $msg = _("Fiche supprimée");
        }
        break;

    default :
        break;
}
?>
<!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=UTF-8">
    <title>SMI - <?PHP echo _("ESPACE PRIVE"); ?> : <?PHP echo _("Fiche Relevé Matériel"); ?></title>

    <?PHP include_once("../inc/header.inc.php"); ?>

    <script type="text/javascript">
        <!--
        function init_all() {
            init_Body();
            Focus_first();
        }

        $(document).ready(function () {
            init_all();
        });
        //-->
    </script>

</head>
<body>
<?php include_once("../inc/entete.inc.php"); ?>
<p align="center"><span class="titrepage"><?PHP echo $titre ?></span></p>

<p align="center">&nbsp;</p>
<?PHP
if ($retourliste == FALSE) {
    exec_func_js("warn_txt('" . str_escape($msg) . "')");
    aff_ret_idx_man($td, "rel_maj.php?td=edit&cc=".$codecli."&cr=" . $coderel, _("Retour à la saisie"), FALSE);
} else
    pop_ret_auto($msg, 'ok', "rel_maj.php?td=edit&cc=".$codecli."&cr=" . $coderel);
include_once("pied.php");
?>
</body>
</html>