Tengo un sistema de mensajes, donde la gente deja su opinión sobre un tema. Lo que quisiera hacer, si se puede, es que solo se pueda escribir un mensaje por nick y por IP, es decir que cuando el nick "GERO" haya escrito un mensaje nadie más pueda escribir un mensaje con este nick. Al mismo tiempo también limitar un mensaje por IP, así se evita que alguien pueda escribir varios mensajes.
Si alguien sabe hacerlo y quiere ayudarme. Gracias.
Os pongo el código del sistema de mensajes:
Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Documento sin título</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<form action="<? echo $PHP_SELF?>" method="POST" class="text">
<table border="0" width="580">
<tr>
<td align="left" class="text">
<b>Autor:</b> <input type="text" name="autor" size="20" class="inp" />
<br />
<br />
<b>E-mail:</b> <input type="text" name="email" size="20" class="inp" /> <b>Web:</b> <input type="text" name="web" size="20" class="inp" />
<br />
<br />
<center>
<textarea cols="70" rows="5" name="opinio" wrap="virtual" class="inp">
</textarea>
<br />
<br />
<input type="submit" value=" Enviar opinió! " class="boto" />
</center>
</td>
</tr>
</table>
</form>
<?
$fitxer = "missatges.txt" ;
if(isset($opinio)&&isset($autor)) {
$autor = "<table border=\"0\" width=\"580\"> <tr> <td class=\"text\" align=\"left\"><b>$autor diu:</b></td></tr></table>\n" ;
$emailweb = "<table border=\"0\" width=\"580\"> <tr> <td width=\"15\"></td><td align=\"left\"><a href=\"mailto:$email\">email</a> <a href=\"$web\" target=\"_blank\">Web</a> </td> </tr> </table>\n" ;
$opinio = ereg_replace("\n","<br />",$opinio) ;
$opinio = "<table border=\"0\" width=\"580\" cellpadding=\"8\"> <tr> <td width=\"10\"></td> <td align=\"left\" class=\"borap\">$opinio</td></tr> </table>\n" ;
$opinio = stripslashes($opinio);
$fp = fopen($fitxer,"a");
fwrite($fp,$autor);
fwrite($fp,$emailweb);
fwrite($fp,$opinio);
fwrite($fp,"<br />");
fclose($fp) ;
}
?>
<p class="text"><b>Opinions ja escrites:</b> </p>
<? readFile($fitxer) ?>
</center>
</BODY>
</HTML>
Y aquí os pongo el link: http://www.boladedrac.net/missatges.php