Location: PHPKode > projects > petitforum > petitforum/message.php
<? include ("connecte.php");
?>
<FORM method="post">
<?
	if (($message) && ($connecte!=""))
    {
    /* uncomment the next two lines to strip out html from input */
    $name = $connecte;
    $message = strip_tags($message);
	$sujet = strip_tags($sujet);
	$nom_jour =   array("dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi",);
	$nom_mois  =  array("","janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","decembre");
	$num_jour = date(  "w");
	$num_mois = date(  "m");
	$test = substr($num_mois,0,1);
	if ($test ==   "0") {
	    $num = substr($num_mois,1,1);
	    $num_mois = $num;
    }
	$annee    = date(  "Y");
	$n = date(  "d");
	$jour = $nom_jour[$num_jour];
	$mois = $nom_mois[$num_mois];
	$message = wordwrap($message,109);
	$message = htmlentities(str_replace("\\","",$message),ENT_QUOTES);
	$message = nl2br($message);
	$sujet = htmlentities(str_replace("\\","",$sujet),ENT_QUOTES);
    $heure = date("h:i a");
	/* le caractere :: est utilisé pour séparer les champs d'un message dans la liste des messages */
	$sujet = ereg_replace("::", "", $sujet);
    $message = "<p id=\"entete\"><b>$sujet</b><i> de</i><B> $name</B><i> le $jour $n $mois $annee, $heure</i></p><p id=\"message\">$message</p>";
    $fp=fopen("nbtopics.txt","r+"); 
	$numb=fgets($fp,10); 
	fseek($fp,0); 
	$numb++; 
	fputs($fp,$numb); 
	fclose($fp);
	$numb=(string)$numb.".php";
	$messageliste = "$numb::$sujet::$name::$jour $n $mois $annee, $heure\n";
    $fp = fopen ("forum.liste.txt", "a");
    fwrite ($fp, $messageliste);
    fclose ($fp);
	$fp = fopen("topics/".$numb.".comment","w");
    fwrite ($fp, $message);
	fclose ($fp);
	$fp = fopen("topics/".$numb.".txt","w");
    fwrite ($fp, "0");
	fclose ($fp);
	$fp = fopen("topics/".$numb,"w");
	fwrite ($fp,"<? include(\"topic.php\"); ?>");
	fclose($fp);
}
$fd=@fopen("forum.liste.txt","r");
if (!$fd) die("Impossible d'ouvrir le fichier");
$i=0;
while (!feof($fd)) {
	$lignee = fgets($fd, 4096);
	$ligne[$i]=explode("::",$lignee);	
	$i++;
}
fclose($fd);
$i--;
echo "<div class=\"ombre\">";
echo "<div class=\"section\">";
echo "<table><tr><td width=\"50%\">Sujet</td><td width=\"25%\">Lanc&eacute; par</td><td width=\"25%\">date</td><td>R&eacute;ponses</td></tr><tr><td colspan=\"4\"><hr></td></tr>";
while ($i>0){
	$i--;
    $fp=fopen("topics/".$ligne[$i][0].".txt","r"); 
	$numb=fgets($fp,10); 
	fseek($fp,0); 
	fclose($fp);
	echo "<tr><td><a href=\"topics/".$ligne[$i][0]."\">".$ligne[$i][1]."</a></td><td><p id=\"p4\">".$ligne[$i][2]."</p></td><td><p id=\"p4\">".$ligne[$i][3]."</p></td><td><p id=\"p4\">".$numb."</p></td></tr>";
}
echo "</table>";
echo "</div>";
echo "</div>";
if ($connecte!=""){
	echo "<div class=\"ombre\"><div class=\"section\">";
	echo "<p><b> Nouveau sujet :</b>";
	echo "<input name=\"sujet\" type=\"text\" size=\"55\">&nbsp;<input name=\"submit\" type=\"submit\" value=\"Envoyer\">";
    echo "<br><b>Message :</b><br>";
    echo "<textarea name=\"message\" cols=\"73\" rows=\"5\"></textarea>";
  	echo "</p></div></div>";
}
?>
</FORM>
<p align="center">
  <font size=-2>2002 - petitforum</font> 
  <!-- BEGIN PHPDOTCOM.COM RATE CODE (c) 2002 http://www.PHPdotcom.com -->
<form method="POST" action="http://www.PHPdotcom.com/listings/rate.php">
<input type="hidden" name="action" value="rate">
<input type="hidden" name="listid" value="10">
<table cellspacing=1 cellpadding=0 border=0 bgColor="#000000">
<tr>
<td>
<table cellspacing=1 cellpadding=2 border=0 bgColor="#FFFFFF">
<tr>
<td bgColor="#E4E4E4" align="center"><font color="#000000" face="arial" size=2><b>Rate Our Program</font><br><font size=1 face="arial"><a href="http://www.PHPdotcom.com"><font color="#FF0000">@ PHPdotcom.com!</font></a></b></td>
</tr>
<tr>
<td bgColor="#FFFFFF" align="center"><font color="#000000" face="arial" size=1>
<select name="rating" style="font-size=11px">
<option value="5">A+ (Excellent)
<option value="4.5">A
<option value="4.25">A-
<option value="3.75">B+ (Very Good)
<option value="3.5">B
<option value="3.25">B-
<option value="2.75">C+ (Good)
<option value="2.5">C
<option value="2.25">C-
<option value="1.75">D+ (Poor)
<option value="1.5">D
<option value="1.25">D-
</select>
</td>
</tr>
<tr>
<td bgColor="#D2D2D2" align="center"><font size=2 face="arial"><input type="submit" value="Send my Vote" style="font-size: 12px"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<!-- END PHPDOTCOM.COM RATE CODE (c) 2002 http://www.PHPdotcom.com -->
</p>
</body>
</html>
Return current item: petitforum