Plan du site

planmap
",$tpl); $tplOk=""; foreach($tab as $k=>$v) { if ($tableau[$v]!="") { if ($GLOBALS['champs date'][$v]!="") { $tplOk.=transfoDate($tableau[$v]); } else { if ($GLOBALS['champs image'][$v]!="") { $tplOk.=""; } else { if ($v!="lieu" and $v!="pays") { $tplOk.=$tableau[$v]; } else { $tplOk.=""; } } } } else { $tplOk.=$v; } } $tplOk =str_replace("{liste_prest}",listePrestasFacture($tableau),$tplOk); return($tplOk); } function displaySQLTable($tab,$atsTab,$atsCel)//---- tab = tableau de tableaux { list($id,$t)=each($tab); $tabOk ="\n\n\t\n"; foreach($t as $k=>$v) { $tabOk.="\t\t\n"; } $tabOk.="\t\n"; foreach($tab as $k=>$v) { $tabOk.="\t\n"; foreach ($v as $val) { $tabOk.="\t\t\n"; } $tabOk.="\t\n"; } $tabOk.="
".$k."
".$val."
\n"; return($tabOk); } //--- SQL function connection() { $bd=mysql_connect($GLOBALS['serveur'],$GLOBALS['user'],$GLOBALS['pass']); mysql_select_db($GLOBALS['base'],$bd); } function inserer($tab,$table) { connection(); $req.="INSERT INTO ".$table." ("; foreach($tab as $k=>$v) { $req.=$k.","; } $req.=") VALUES ('"; foreach($tab as $k=>$v) { $req.=$v."','"; } $req.=")"; $req = str_replace(",)",")",$req); $req = str_replace(",')",")",$req); //echo $req."
"; if (mysql_query($req)) { return("Ajout effectué"); } else { return("Erreur :".mysql_error()); } } function modifier($tab,$table,$condition) { connection(); $req="UPDATE ".$table." SET "; foreach($tab as $k=>$v) { $req.=$k."='".$v."',"; } $req.=" WHERE ".$condition; $req = str_replace(", WHERE"," WHERE",$req); if (mysql_query($req)) { return("Enregistrement terminé..."); } else { return("Erreur :".mysql_error()); } } function select($table,$condition)//--- retourne un tableau de tableaux { connection(); $req = "SELECT * FROM ".$table." WHERE ".$condition; //echo $req."
".mysql_error()."
"; $res = mysql_query($req); $compteur=0; echo ""; return($resultat); } function select2($table,$condition)//--- retourne un tableau de tableaux { connection(); $req = "SELECT * FROM ".$table." WHERE ".$condition; //echo $req."
".mysql_error()."
"; $res = mysql_query($req); $compteur=0; while ($tab = mysql_fetch_assoc($res)) { $compteur++; $resultat[$compteur]=$tab; } return($resultat); } function selectDistinct($champ,$table,$condition)//--- retourne un tableau de tableaux { connection(); $req = "SELECT DISTINCT ".$champ." FROM ".$table." WHERE ".$condition; $res = mysql_query($req); //echo "
".$req."
".mysql_error(); $compteur=0; echo ""; return($resultat); } function supprimer($table,$condition) { connection(); $req = "DELETE FROM ".$table." WHERE ".$condition; //echo $req."
"; if (mysql_query($req)) { return(""); } else { //echo mysql_error(); return("Erreur :".mysql_error()); } } //--- ESPACE ACCES PRIVE function webLogin($login,$pass) { connection(); $req = "SELECT * FROM ".$GLOBALS['logTable']." WHERE ".$GLOBALS['loginField']."='".$login."' and ".$GLOBALS['passField']."='".$pass."'"; //echo $req; if($res=mysql_query($req)) { $compteur=0; return(mysql_fetch_assoc($res)); } else { return ("login ou mot de passe erroné"); } } function adminLogin($login,$pass) { connection(); $req = "SELECT * FROM web_admin WHERE login='".$login."' and pass='".$pass."'"; if($res=mysql_query($req)) { $compteur=0; $tab = mysql_fetch_assoc($res); return($tab); } else { return ("login ou mot de passe erroné"); } } function changePass($login,$ancien,$nouveau1,$nouveau2) { $req="SELECT * FROM ".$GLOBALS['logTable']." WHERE ".$GLOBALS['loginField']."='".$login."' and ".$GLOBALS['passField']."='".$ancien."'"; echo "