/* Nom du fichier: app_connect.php Description: Initialisation de la connection à la base de données */ // Initialisation de la connection à la base de données $connexion = @mysql_connect("localhost","suterweb","NzzTzH7") or die("ERREUR: Impossible de localiser le serveur de base de données"); @mysql_select_db("suterinox_db", $connexion) or die("ERREUR: Impossible de localiser la base de données"); ?> $domain = "http://".$_SERVER['HTTP_HOST']; $lg = substr($_SERVER['REQUEST_URI'],1,2); $lg = ($lg == '') ? 'fr' : $lg; $urlHTML = substr($_SERVER['REQUEST_URI'],4); $urlName = str_replace(".html", "", $urlHTML); $basepath = $domain."/".$lg."/"; $theUrl = 'pages_url_'.$lg; $theTitle = 'pages_title_'.$lg; $theContent1 = 'pages_content_1_'.$lg; $theContent2 = 'pages_content_2_'.$lg; $theContent3 = 'pages_content_3_'.$lg; function label ($arg,$lg){ $sqlLabel = "SELECT ".$lg." FROM tb_labels WHERE name = '".$arg."';"; $resultLabel = mysql_query($sqlLabel) or die("ERREUR3: La requête n'est pas valide: ".mysql_error()); $rowLabel = mysql_fetch_object($resultLabel); return $rowLabel->$lg; } ?> function fct_doDate($date) { $date_year = substr($date, 0, 4); $date_month = substr($date, 4, 2); $date_day = substr($date, 6, 2); $date = $date_day."/".$date_month."/".$date_year; $date = ($date == "//")? $date('d/m/2015') : $date; return $date; } function fct_undoDate($date) { $date_year = substr($date, 6, 4); $date_month = substr($date, 3, 2); $date_day = substr($date, 0, 2); $date = $date_year.$date_month.$date_day; return $date; } ?> $sql = "SELECT * FROM tb_pages WHERE ".$theUrl." = '".$urlName."';"; $result = mysql_query($sql) or die("ERREUR2: La requête n'est pas valide: ".mysql_error()); $row = mysql_fetch_object($result); $nav = ""; $all_act = ""; $sql = "SELECT * FROM tb_pages WHERE pages_id != 1 ORDER BY pages_menu ASC;"; $result_pages = mysql_query($sql) or die("ERREUR: La requête n'est pas valide: ".mysql_error()); while($row_p = mysql_fetch_object($result_pages)){ if ($row_p->$theTitle != ""){ if ($urlName == $row_p->$theUrl){ $nav .= "
"; }else{ $nav .= " "; } $ContactURL = ($row_p->pages_id == 6)? "/".$row_p->$theUrl : $ContactURL; if($row_p->pages_id == 2) $presentation = $basepath.$row_p->$theUrl.'.html'; if($row_p->pages_id == 3) $nautisme = $basepath.$row_p->$theUrl.'.html'; if($row_p->pages_id == 4) $caravane = $basepath.$row_p->$theUrl.'.html'; if($row_p->pages_id == 5) $brasserie = $basepath.$row_p->$theUrl.'.html'; $ContactContent3 = ($row_p->pages_id == 6)? $row_p->$theContent3 : $ContactContent3; } } ?>
|