I have a recipe website.
I would like to have prevent the user to post 2 comments at the same time.
i alway get hte error, parse error at the part where i include my footer.
Please help. Here is my code:
<?php include("theader.php"); ?>
<?php
$sql_host = "localhost";
$sql_login = "*****";
$sql_psswd = "*****";
$sql_base = "*****";
$sql_table = "tbl_comments";
$recipeid = addslashes($_GET["recipeid"]);
$recipeid = htmlentities($recipeid);
$nickname = addslashes($_POST["nickname"]);
$nickname = htmlentities($nickname);
$comment = addslashes($_POST["comment"]);
$comment = htmlentities($comment);
$ip = getenv(remote_addr);
$date = date("Y-m-d");
$time = date("H:i");
$sql = "select * from tbl_comments where recipeid = $recipeid and ip = '$ip'";
$result = mysql_query($sql);
if ($myrow = mysql_fetch_array($result)) {
} else {
if ($nickname && $comment && $recipeid)
{ $db = mysql_connect($sql_host, $sql_login, $sql_psswd);
mysql_select_db($sql_base, $db);
$sql = "INSERT INTO $sql_table(recipeid, Number, Comment, Information, ip) VALUES('', '$recipeid', '$comment', '$nickname ($date @ $time)', '$ip')";
mysql_query($sql) or die("<font size=\"1\" face=\"Verdana\" color=\"#FF0000\">MySQL Error.</font>");
//mysql_close();
echo "<script>window.location = 'comments.php?recipeid=".$recipeid."'</script>";
}
?>
<?php include("tfooter.php"); ?>
Thank you all for your help