<?php include "../include/validsession.inc"; include "../include/opendb.inc"; include "../include/fonction.inc"; $SQLval = ""; $SQLcha = ""; $SQLUp = ""; //************** $Code = $_POST["code"]; //**********recuperer les valeurs****** $SQLcha = $SQLcha." Nom , "; $SQLval = $SQLval."'".Mod_addslashes($_POST["Nom"])."' , "; $SQLUp = $SQLUp . " Nom ='".Mod_addslashes($_POST["Nom"])."' , "; $SQLcha = $SQLcha." Description , "; $SQLval = $SQLval."'".Mod_addslashes($_POST["Description"])."' , "; $SQLUp = $SQLUp . " Description ='".Mod_addslashes($_POST["Description"])."' , " ; $SQLcha = $SQLcha." Statut , "; $SQLval = $SQLval."'".Mod_addslashes($_POST["Statut"])."' , "; $SQLUp = $SQLUp . " Statut ='".Mod_addslashes($_POST["Statut"])."' , " ; $SQLcha = $SQLcha . " DateA , "; $SQLval = $SQLval . "'" . date('y-m-j h:i:s') . "' , "; $SQLUp = $SQLUp . " DateM ='".date('y-m-j h:i:s')."' , " ; if (empty($Code) ) { $strSql = "SELECT CodeTypeA from typeactivites where Nom = '".Mod_addslashes($_POST["Nom"])."'"; $rsQueryR = mysql_query($strSql); mysql_error(); if ($row = mysql_fetch_assoc($rsQueryR)) { $CodeTypeA = $row["CodeTypeA"]; mysql_free_result($rsQueryR); Header("Location: TypeActivite.php?code=". $CodeTypeA ."&exist=1"); exit; } } //'*********SQL Insert dans la table membre *************** if ( isset($Code) && !empty($Code) ) { $Sql="update typeactivites set ".substr($SQLUp, 0, strlen($SQLUp) - 2)." where CodeTypeA = " .$Code .""; $rsQuery = mysql_query($Sql); mysql_error(); Header("Location: RechercheTypeA.php?".$_COOKIE['lienOutils'].""); exit; }else{ $Sql="Insert into typeactivites (". substr($SQLcha, 0, strlen($SQLcha) - 2).") VALUES (". substr($SQLval, 0,strlen($SQLval) - 2).")"; $rsQuery = mysql_query($Sql); mysql_error(); Header("Location: RechercheTypeA.php?".$_COOKIE['lienOutils'].""); exit; } ?>