2020-11-29 11:25:34 +01:00
< ? php
/*
Name : goldbook . php
Author : NicoSoft
Création : 14 / 08 / 01
MAJ : 23 / 09 / 01
*/
include_once " include/standard.inc.php " ;
extract ( $_POST );
2024-02-12 20:46:07 +01:00
if ( isset ( $GoldbookFile ) && $GoldbookFile != " " ) {
$GoldbookFile = " default " ;
}
2020-11-29 11:25:34 +01:00
$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 */
2024-02-12 20:46:07 +01:00
//echo "?modulepage=goldbook'>\n";
echo " /livre.html'> \n " ;
2020-11-29 11:25:34 +01:00
2024-02-12 20:46:07 +01:00
echo " <div class='center'><table border='0'><tr><td>
2020-11-29 11:25:34 +01:00
< 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 " ;
2024-02-12 20:46:07 +01:00
// <hr></td></tr>\n";
2020-11-29 11:25:34 +01:00
unset ( $File );
// si le fichier n'existe pas, on le crée:
2024-02-12 20:46:07 +01:00
if ( ! ( file_exists ( " modules/goldbook/ $GoldbookFile .csv " ))) {
$goldbook = fopen ( " modules/goldbook/ $GoldbookFile .csv " , " w+ " );
fclose ( $goldbook );
2020-11-29 11:25:34 +01:00
}
// ajout des messages
2024-02-12 20:46:07 +01:00
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 \n X-Mailer: PHP/ " . phpversion ());
//unlink("$GoldbookFile.dat");
}
2020-11-29 11:25:34 +01:00
}
// lecture des messages
2024-02-12 20:46:07 +01:00
$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 ]);
2020-11-29 11:25:34 +01:00
}
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
2024-02-12 20:46:07 +01:00
if (( ! isset ( $NbMaxPost )) || ( $NbMaxPost > $Cpt )) {
$NbMaxPost = $Cpt ;
2020-11-29 11:25:34 +01:00
}
// affichage des messages
echo " <hr /><div class='left'> " ;
2024-02-12 20:46:07 +01:00
if ( $NbMaxPost ) {
for ( $i = 0 ; $i <= $NbMaxPost - 1 ; $i ++ ) {
if ( $VisitorName [ $i ] == " " ) {
$VisitorName [ $i ] = " Anonyme " ;
}
2020-11-29 11:25:34 +01:00
2024-02-12 20:46:07 +01:00
if ( $VisitorEmail [ $i ] != " " ) {
$Visiteur = " <a href='mailto: " . $VisitorEmail [ $i ] . " '> " . $VisitorName [ $i ] . " </a> " ;
} else {
$Visiteur = $VisitorName [ $i ];
}
2020-11-29 11:25:34 +01:00
2024-02-12 20:46:07 +01:00
echo " <i>Posté le " . $VisitorDate [ $i ] . " à " . $VisitorTime [ $i ] . " par <b> " . $Visiteur . " </b></i>:
2020-11-29 11:25:34 +01:00
< br /> « " . $VisitorMessage[$i] . " » < br /> " ;
2024-02-12 20:46:07 +01:00
if ( $i != ( $NbMaxPost - 1 )) {
echo " <hr /> " ;
}
}
2020-11-29 11:25:34 +01:00
}
echo " </div> " ;
$footerbox = 0 ;
//$footerboxtext = "Retour au menu";
//$footerlien = "/";