< ?php
$index=´index.php´;
include ´connect.php´;
if ( $_POST){
$name = htmlentities($_POST[´name´]);
$mail = htmlentities($_POST[´mail´]);
$msg = htmlentities($_POST[´msg´]);
$date = date(´Y-m-d´);
$req = " INSERT INTO ldo VALUES ( ´´, ´$name´, ´$mail´, ´$msg´, ´$date´)";
mysql_query($req) or die(mysql_error());
}
$npp = 5; //Messages par pages
$ans = mysql_query(´SELECT COUNT(*) FROM ldo´);
$data = mysql_fetch_array($ans);
$num = $data[0];
$start = $_GET[´var´];
if ( !$start)
$start = 0;
if ( $start > = $num)
$start = floor($num/$npp) * $npp;
$req = ´SELECT name, mail, body, date FROM ldo ORDER BY date DESC LIMIT ´.$start.´,´.$npp;
$ans = mysql_query($req);
while ( $msg = mysql_fetch_array($ans)) {
echo´<b>Ajouter un commentaire</b><br>
<form name="form_ldo" method="POST" action=´.$index.´?to=ldo>
<table width="100%" cellpadding="6" cellspacing="0" border="0" align="center">
< tr>
< td width="232" align="right">Nom:
< input type="text" name="name" size="24"></input>
< /td>
< td width="50%" rowspan="4" align="right" valign="top">
< div align="left">´;
echo ´<table width="100%" border="0" align="center" cellpadding="3" cellspacing="0">
< tr>
<td bgcolor="#AAAAAA" colspan="2">Par < a
href="mailto:´.$msg[´mail´].´">´.$msg[´name´].´"><
/a></td>
</tr>
<tr>
<td colspan="2" bgcolor="#BBBBBB">´.$msg[´body´].´</td>
</tr>
</table>´;
echo ´</div></td>
< /tr>
< tr>
< td align="right">Mail:
< input type="text" name="mail" size="24"></input>
< /td>
< /tr>
< tr>
< td width="50%" align="right">
< textarea name="msg" cols="27" rows="8"></textarea></td>
< /tr>
< tr>
< td align="right"><input type="submit" value="Envoyer"></input>
< /td>
< /tr></table></form>´;
?>