114 lines
4.2 KiB
PHP
114 lines
4.2 KiB
PHP
<?php
|
|
|
|
/*
|
|
Name: goldbook.php
|
|
Author: NicoSoft
|
|
Création: 14/08/01
|
|
MAJ : 23/09/01
|
|
*/
|
|
|
|
include_once "include/standard.inc.php";
|
|
|
|
extract($_POST);
|
|
|
|
if (isset($GoldbookFile) && $GoldbookFile != "") {
|
|
$GoldbookFile = "default";
|
|
}
|
|
|
|
$Cpt = 0;
|
|
|
|
echo "<form method='post' action='";
|
|
/*if (isset($goldbooktype) && ($goldbooktype == "comment"))
|
|
{
|
|
echo "?modulepage=commentnews&File=$File&idnews=".$MyNews["index"]."&theme=$theme'>\n";
|
|
$modulepage = "commentnews";
|
|
$gbparam = "<input name='File' value='$File' type='hidden'>\n<input name='idnews' value='".$MyNews["index"]."' type='hidden'>";
|
|
}
|
|
else*/
|
|
//echo "?modulepage=goldbook'>\n";
|
|
echo "/livre.html'>\n";
|
|
|
|
echo "<div class='center'><table border='0'><tr><td>
|
|
<input type='hidden' name='param' value='postgb' />
|
|
<input name='GoldBookFile' value='".$GoldbookFile."' type='hidden' />
|
|
<i>Nom/Pseudo (facultatif)</i>:<input name=\"VName\" type='text' size='20' value=\"\" /></td><td>
|
|
<i>e-mail (facultatif)</i>:<input name=\"VEmail\" type='text' size='20' value=\"\" /></td></tr>
|
|
<tr><td><div class='center'><i>Message</i>:<textarea name='VMessage' cols='50' rows='12'></textarea></div></td></tr>
|
|
<!--".$gbparam."-->
|
|
<input name='piejacon' value='piejacon' class='piejacon' />
|
|
<tr><td class='right'><input name=\"Ecrire\" value='Ecrire' type='submit' /></td><td><input name=\"Effacer\" value=\"Effacer\" type=\"reset\" /></td></tr></table></div></form>
|
|
<h6><i>Notes</i>: Les balises HTML ne sont pas autorisés dans la boite de saisie. Les messages sont modérés, ils n'apparaitront donc pas immédiatement sur le livre d'or.</h6>\n";
|
|
// <hr></td></tr>\n";
|
|
unset($File);
|
|
// si le fichier n'existe pas, on le crée:
|
|
if (!(file_exists("modules/goldbook/$GoldbookFile.csv"))) {
|
|
$goldbook = fopen("modules/goldbook/$GoldbookFile.csv", "w+");
|
|
fclose($goldbook);
|
|
}
|
|
|
|
// ajout des messages
|
|
if ($param == "postgb") {
|
|
if ($VMessage != "" && isset($_POST['piejacon'])) {
|
|
$date = strftime("%d/%m/%Y", time());
|
|
$iheure = date("H:i");
|
|
$VMessage = ereg_replace("<", "<", $VMessage);
|
|
$VMessage = ereg_replace(">", ">", $VMessage);
|
|
$VMessage = parse_string(stripcslashes($VMessage));
|
|
$VMessage = ereg_replace("\n", "<br />", $VMessage);
|
|
$VMessage = ereg_replace("&", "&", $VMessage);
|
|
$gbline = sprintf("\"".$date."\",\"".$iheure."\",\"".htmlspecialchars($VName)."\",\"".$VEmail."\",\"".$VMessage."\"\n");
|
|
$goldbook = fopen("modules/goldbook/$GoldbookFile.csv", "a");
|
|
fwrite($goldbook, $gbline);
|
|
fclose($goldbook);
|
|
mail("n@tourmentine.com", "[TMA] post livre d'or ", $VMessage, "From: ".$VName." <".$VEmail.">\r\nX-Mailer: PHP/" . phpversion());
|
|
// mail("bernard@legaillart.com","[TMA] post livre d'or ",$VMessage,"From: ".$VName." <".$VEmail.">\r\nX-Mailer: PHP/" . phpversion());
|
|
//unlink("$GoldbookFile.dat");
|
|
}
|
|
}
|
|
|
|
// lecture des messages
|
|
$goldbook = fopen("modules/goldbook/$GoldbookFile.csv", "r");
|
|
|
|
while ($data = fgetcsv($goldbook, 1000, ",")) {
|
|
$VisitorDate[$Cpt] = $data[0];
|
|
$VisitorTime[$Cpt] = $data[1];
|
|
$VisitorName[$Cpt] = stripcslashes($data[2]);
|
|
$VisitorEmail[$Cpt] = $data[3];
|
|
$VisitorMessage[$Cpt++] = stripcslashes($data[4]);
|
|
}
|
|
|
|
fclose($goldbook);
|
|
unset($data);
|
|
unset($goldbook);
|
|
// si $NbMaxPost n'est pas défini, ou si il est plus grand que le nombre d'éléments, on l'ajuste à ce nombre
|
|
if ((!isset($NbMaxPost)) || ($NbMaxPost > $Cpt)) {
|
|
$NbMaxPost = $Cpt;
|
|
}
|
|
|
|
// affichage des messages
|
|
|
|
echo "<hr /><div class='left'>";
|
|
if ($NbMaxPost) {
|
|
for ($i = 0;$i <= $NbMaxPost - 1;$i++) {
|
|
if ($VisitorName[$i] == "") {
|
|
$VisitorName[$i] = "Anonyme";
|
|
}
|
|
|
|
if ($VisitorEmail[$i] != "") {
|
|
$Visiteur = "<a href='mailto:".$VisitorEmail[$i]."'>".$VisitorName[$i]."</a>";
|
|
} else {
|
|
$Visiteur = $VisitorName[$i];
|
|
}
|
|
|
|
echo "<i>Posté le ".$VisitorDate[$i]." à ".$VisitorTime[$i]." par <b>".$Visiteur."</b></i>:
|
|
<br />« ".$VisitorMessage[$i]." »<br/>";
|
|
|
|
if ($i != ($NbMaxPost - 1)) {
|
|
echo "<hr />";
|
|
}
|
|
}
|
|
}
|
|
echo "</div>";
|
|
$footerbox = 0;
|
|
//$footerboxtext = "Retour au menu";
|
|
//$footerlien = "/";
|