50) $error = "Maximum name length is 50 characters."; elseif(strlen($comment) == 0) $error = "Please enter your comments."; elseif(strlen($comment) > 500) $error = "Maximum comment length is 500 characters."; elseif($_SESSION["captcha"] != $_POST['captcha']) $error = "Your confirmation text does not match, only enter the black characters."; echo "The error was: " .$error; if(strlen($error) == 0) { $ip = $REMOTE_ADDR; $insert_comment = mysql_query("INSERT INTO comments (name, comment, recipeid, dateadded, userip) VALUES ('".mysql_real_escape_string ($yourname)."', '".mysql_real_escape_string($comment)."', ".$id.", NOW(), '".mysql_real_escape_string($ip)."')"); echo "MYSQL QUERY = " . "INSERT INTO comments (name, comment, recipeid, dateadded, userip) VALUES ('".mysql_real_escape_string($yourname)."', '".mysql_real_escape_string($comment)."', ".$id.", NOW(), '".mysql_real_escape_string($ip)."')"; $hideform = TRUE; if(strlen($vote) > 0) { $lookup_field = "votestar".$vote; $get_values = mysql_query("SELECT votestar1, votestar2, votestar3, votestar4, votestar5 FROM recipes WHERE id = ".$id." LIMIT 1"); $votestar1 = mysql_result($get_values, 0, votestar1); $votestar2 = mysql_result($get_values, 0, votestar2); $votestar3 = mysql_result($get_values, 0, votestar3); $votestar4 = mysql_result($get_values, 0, votestar4); $votestar5 = mysql_result($get_values, 0, votestar5); if($vote == 1) $votestar1 = $votestar1+1; elseif($vote == 2) $votestar2 = $votestar2+1; elseif($vote == 3) $votestar3 = $votestar3+1; elseif($vote == 4) $votestar4 = $votestar4+1; elseif($vote == 5) $votestar5 = $votestar5+1; $total = ($votestar1 * 1)+($votestar2 * 2)+($votestar3 * 3)+($votestar4 * 4)+($votestar5 * 5); $total = $total/($votestar1+$votestar2+$votestar3+$votestar4+$votestar5); $update_joke = mysql_query("UPDATE recipes SET ".$lookup_field." = ".$$lookup_field.", votestartotal = ".$total." WHERE id = ".$id." LIMIT 1"); } } } $temp = mysql_query("SELECT * FROM recipes WHERE id = ".$id." LIMIT 1"); $title = UCWords(mysql_result($temp, 0, title)); $category = mysql_result($temp, 0, category); $subcategory = mysql_result($temp, 0, category2); $recipe = mysql_result($temp, 0, recipe); $recipe = trim(str_replace(array("

", "

"), "", $recipe)); $votestartotal = mysql_result($temp, 0, votestartotal); $ptitle = "Recipe for ".$title; $pkeys = $title.", recipes,cooking,gourmet recipes,healthy recipe,chicken recipes,chili recipes"; $pdesc = $title." food recipe"; // get comments $get_comments = mysql_query("SELECT name, comment, recipeid, dateadded, userip FROM comments WHERE recipeid = ".$id." ORDER BY dateadded DESC"); include_once("header_view.php"); ?>
RECIPE FOR
0) { ?>
"; if(strlen($category) > 0) echo ""; if(strlen($subcategory) > 0) echo ""; //if(number_format($votestartotal, 0) == 0) $rating = "not yet rated"; //else $rating = number_format($votestartotal, 0)." stars"; echo ""; //echo ""; echo "
Title:$title
Category:".UCWords($category)."
Sub-Category:".UCWords($subcategory)."
Rating:".$rating.""; echo "
"; //echo "

"; echo $recipe."

"; ?>
 
"; echo ""; } echo "


".$date_com." - ".$row['name']."
\"".$row['comment']."\"

"; ?>
 
0) echo "
ERROR: ".$error."

"; ?>