芝麻web文件管理V1.00
编辑当前文件:/home/asmplong/www/addAvis.php.tar
home/asmplong/www/php/addAvis.php 0000666 00000003633 15017130631 0013021 0 ustar 00 "; } else { $nom = $_POST["nom"]; } // EMAIL if (empty($_POST["lieu"])) { $errorMSG .= "Veuillez saisir un lieu
"; } else { $lieu = $_POST["lieu"]; } // EMAIL if (empty($_POST["rating"])) { $errorMSG .= "Veuillez attribuer une note
"; } else { $rating = $_POST["rating"]; } // MESSAGE if (empty($_POST["message"])) { $errorMSG .= "Veuillez saisir un message
"; } else { $message = addslashes($_POST["message"]); } $EmailTo = $config_email; $Subject = "Avis à valider - [SITE DOMOTEC]"; $ref = rand(10000, 99999); $sql_verif_id = "SELECT id FROM avis WHERE id='$id'"; $req_verif_id = mysqli_query($connect,$sql_verif_id); while(mysqli_fetch_array($req_verif_id) == TRUE) { $ref = rand(10000, 99999); } // Ajout en BDD $sql_insert = "INSERT INTO avis SET id='$ref', titre ='$nom', description='$lieu', categ ='$rating', contenu ='$message', date=NOW()"; $req_insert = mysqli_query($connect,$sql_insert); if($req_insert) { // prepare email body text $Body = ""; $Body .= "Nom : "; $Body .= $nom; $Body .= "\n"; $Body .= "Lieu : "; $Body .= $lieu; $Body .= "\n"; $Body .= "Note :"; $Body .= $rating; $Body .= "/5 \n"; $Body .= "Avis : \n"; $Body .= $message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, utf8_decode($Body), "From: ".$config_email); // redirect to success page if ($success && $errorMSG == ""){ echo "success"; }else{ if($errorMSG == ""){ echo "Un problème est survenu"; } else { echo $errorMSG; } } } ?>