Location: PHPKode > projects > Simple Comments > comments/addcomment.php
<? 
require("header.php");
require_once( 'config.php' );

mysql_connect($dbaddress,$dbuser,$dbpass);
@mysql_select_db($dbname) or die( "Unable to select database");
$query=" SELECT ip FROM banip";
$result=mysql_query($query);
$num=mysql_numrows($result); 
mysql_close();

$ip=getenv('REMOTE_ADDR');

$i=0;
while ($i < $num) {
$banip=mysql_result($result,$i,"ip");
$banned=$banip;
if ($banned==$ip) {
?>
<p align="center">
Sorry... but you have been banned from posting.
<? 
exit();
}

$i++;
}

?>
<form action="insertcomment.php" method="post">
<p align="center">
* Name: <br><input type="text" name="name"><br>
Email: <br><input type="text" name="email"><br>
(Email will not be shown.)<br><br>
* Message: <br><textarea name="message" cols="50" rows="10"></textarea><br><br>
<input type="Submit" value="Add Comment">
</form>
<br><br>
<a href="javascript: history.go(-1)">Back</a><br>
Return current item: Simple Comments