<?php session_start(); //pub $pub = ""; //Inclusion des ID SQL include_once "modele/connexionsql.php"; //Inclusion des fonctions relatives aux membres include_once "modele/fonctionsdb.php"; //Test si maintenance if (returnValueFromParam("maintenanceMode") == "true") { header("Location: maintenance.php"); } if (isset($_GET["pseudo"]) and !empty($_GET["pseudo"])) { $user = getUserByPseudo($_GET["pseudo"]); if (!empty($user)) { $title = "Profil de " . $user["pseudo"]; } else { $title = "Profil inexistant"; } //Gravatar $url = get_gravatar($user["mail"]); //Select comms $nbcomms = selectComms($user["pseudo"]); //Select posts $nbposts = selectPosts($user["pseudo"]); //Select comms G $nbcommstempG = selectCommsGlobal(); //comms autres $nbcommsG = $nbcommstempG - $nbcomms; //Select posts G
//Affichage "Bienvenue, pseudo" + déco $menu = true; } else { //Affichage co $menu = false; } $title = "Bienvenue chez vincent !"; //Gestion carrousel $carrouselShow = returnValueFromParam("carrousel"); $tagShow = returnValueFromParam("tagcloud"); $img1 = returnValueFromParam("img1"); $img2 = returnValueFromParam("img2"); $img3 = returnValueFromParam("img3"); $link1 = returnValueFromParam("link1"); $link2 = returnValueFromParam("link2"); $link3 = returnValueFromParam("link3"); //Get categories + listing tag cloud $cats = AffichageNomsCat(); foreach ($cats as $cle => $cat) { $cats["cle"]["id"] = $cat["id"]; $cats["cle"]["nom"] = htmlspecialchars($cat["nom"]); } //Inclusion vue index include_once "vue/index.php"; ?> <!-- //BBCODE-like $billets["cle"]["contenu"] = preg_replace("#\[alert=(success|info|warning|danger)\](.+)\[/alert\]#isU","<div class=\"alert alert-$1\" role=\"alert\">$2</div>",$billet["contenu"]); //bold $billets["cle"]["contenu"] = preg_replace("#\[b\](.+)\[/b\]#isU","<strong>$1</strong>",$billet["contenu"]); //bold $billets["cle"]["contenu"] = preg_replace("#\[i\](.+)\[/i\]#isU","<em>$1</em>",$billet["contenu"]); //italic $billets["cle"]["contenu"] = preg_replace("#\[color=(blue|red|green|\#[a-z0-9]{6})\](.+)\[/color\]#isU","<span style=\"color: $1\">$2</strong>",$billet["contenu"]); //color
controleur/maintenance.php par Vincent AUBRIOT Availible @ https://github.com/vincent38/-blog/ */ session_start(); //pub $pub = ""; //Inclusion connexionBDD include_once "modele/connexionsql.php"; //Inclusion fonctions SQL include_once "modele/fonctionsdb.php"; //Test si non maintenance if (returnValueFromParam("maintenanceMode") == "false") { header("Location: index.php"); } //Get maintenance message $status = returnValueFromParam("maintenanceMessage"); //Connexion/déconnexion if (isset($_SESSION["pseudo"])) { //Affichage "Bienvenue, pseudo" + déco $menu = true; } else { //Affichage co $menu = false; } //Connexion/déconnexion if (isset($_SESSION["pseudo"])) { //Affichage "Bienvenue, pseudo" + déco $menu = true; } else { //Affichage co $menu = false;
Availible @ https://github.com/vincent38/-blog/ Contient : Formulaire de contact + traitement Inclus dans : controleur/contact.php --> <?php //Ajout du header commun include_once "includes/header.php"; if ($contactForm == "false") { ?> <h2 style="text-align: center">Formulaire de contact désactivé !</h2> <p>Suite à une décision de l'administrateur, le formulaire a été désactivé.<br />En attendant, vous pouvez nous contacter par mail à l'adresse suivante : <a href="mailto://<?php echo returnValueFromParam("emailContact"); ?> "><?php echo returnValueFromParam("emailContact"); ?> </a></p> <br /><?php include_once "includes/footer.php"; die; } if (isset($sendingMailStatus)) { echo "<div class='alert " . $niveauAlerte . "'>" . $sendingMailStatus . "</div>"; } ?> <form method="post" action="contact.php"> <h2 style="text-align: center;">Nous contacter</h2> <div class="form-group"> <label for="mail">Votre mail : </label><input type="email" name="mail" id="mail" class="form-control"/> </div>
setParam("contact", "true"); } else { setParam("contact", "false"); } $outputContact = "Les paramètres du formulaire de contact ont été définis dans la BDD."; } //Maintenance POST if (isset($_POST["confirmmtce"])) { setParam("maintenanceMessage", $_POST["mtceTxt"]); if (isset($_POST["mtceShow"])) { setParam("maintenanceMode", "true"); } else { setParam("maintenanceMode", "false"); } $outputMaintenance = "Les paramètres de maintenance ont été définis dans la BDD."; } //Gestion carrousel + tag + contact $carrouselShow = returnValueFromParam("carrousel"); $tagShow = returnValueFromParam("tagcloud"); $contactForm = returnValueFromParam("contact"); $formEmail = returnValueFromParam("emailContact"); $img1 = returnValueFromParam("img1"); $img2 = returnValueFromParam("img2"); $img3 = returnValueFromParam("img3"); $link1 = returnValueFromParam("link1"); $link2 = returnValueFromParam("link2"); $link3 = returnValueFromParam("link3"); //Gestion maintenance $mtceShow = returnValueFromParam("maintenanceMode"); $mtceTxt = returnValueFromParam("maintenanceMessage"); include_once "vue/admin.php";
//Inclusion des ID SQL include_once "modele/connexionsql.php"; //Inclusion des fonctions relatives aux membres include_once "modele/fonctionsdb.php"; include_once "apivariables.php"; //Test if form == true $contactForm = returnValueFromParam("contact"); if (isset($_POST["mail"]) and isset($_POST["message"]) and isset($_POST["g-recaptcha-response"])) { $niveauAlerte = "alert-success"; $sendingMailStatus = "Statut : "; if ($_POST["g-recaptcha-response"] == true) { if (preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\\.[a-z]{2,10}\$#", $_POST["mail"])) { $mail = $_POST['mail']; $content = $_POST["message"]; $from = "From: {$mail}\r\nReturn-path: {$mail}"; $to = returnValueFromParam("contact"); mail($to, "Nouveau message envoyé depuis le formulaire", $content, $from); $sendingMailStatus = $sendingMailStatus . "[OK] - Email envoyé, merci pour votre message :D !"; } else { $sendingMailStatus = $sendingMailStatus . "[ERREUR] - Adresse mail invalide !"; $niveauAlerte = "alert-danger"; } } else { $sendingMailStatus = $sendingMailStatus . "[ERREUR] - Captcha invalide !"; $niveauAlerte = "alert-danger"; } } //Connexion/déconnexion if (isset($_SESSION["pseudo"])) { //Affichage "Bienvenue, pseudo" + déco $menu = true;