0) { close_db($conn); header($redirect); exit(); } } else { close_db($conn); header("Location: ./"); exit(); } if(!empty($post_arr['user_name'])) { $user_name = $post_arr['user_name']; } else { $user_name = "Anonymous"; } $comment_msg = ""; if(!empty($post_arr['user_email'])) { if(!is_valid_email($post_arr['user_email'])) { $comment_msg .= "Please enter a valid email address.
"; } } if(empty($post_arr['user_comment'])) { $comment_msg .= "Please enter your comment.
"; } else { if( !allowed_as_comment($post_arr['user_comment']) ) { //error_log("Rejecting comment: ".print_r($post_arr, true)); $comment_msg .= "Comment not allowed.
"; } } if(empty($comment_msg)) { /* if(!isset($post_arr['captcha']) || strtolower($post_arr['captcha']) != $_SESSION['captcha']) { $comment_msg .= "Please enter the text in the image."; } else */ $comment_msg .= check_recaptcha($post_arr["recaptcha_challenge_field"], $post_arr["recaptcha_response_field"]); if(empty($comment_msg)) { $query = "INSERT INTO comment (idphone, user_name, email, comment, ip, date_added) VALUES(".$idphone.", '".addslashes($post_arr['user_name'])."', '".addslashes($post_arr['user_email'])."', '". addslashes($post_arr['user_comment'])."', ".$ip_number.", NOW())"; $result = mysql_query($query, $conn); if($result) { $query = "UPDATE phone SET comments_no=comments_no+1 WHERE idphone=".$idphone; mysql_query($query, $conn); $user_comment = $post_arr['user_comment']; $user_comment .= "\r\n\r\nName: ".$user_name."\r\n"; $user_comment .= "Email address: ".$post_arr['user_email']."\r\n"; $user_comment .= "IP address: ".$_SERVER['REMOTE_ADDR']."\r\n\r\n"; $user_comment .= "Admin link: ".SITE_ADDRESS."admin/comments.php?comment_type=phone&idphone=".$idphone."\r\n"; $user_comment .= "Front end link: ".SITE_ADDRESS.$phoneNameID."_user_opinions_".$idphone.".htm"; send_email(ADMIN_EMAIL_ADDRESS, "New comment on phone: ".$phone_full_name, $user_comment, ADMIN_EMAIL_ADDRESS, SITE_NAME); // $post_arr = array(); close_db($conn); // $msg = "Your opinion was successfuly submitted."; header($redirect); exit(); } else { $comment_msg .= "Your opinion could not be submitted for now. Please try again later."; } } } else // if(!isset($post_arr['captcha']) || strtolower($post_arr['captcha']) != $_SESSION['captcha']) { /* $comment_msg .= "Please enter the text in the image."; */ $comment_msg .= "Please enter the two validation words."; } } } } else { close_db($conn); header("Location: ./"); exit(); } $query = "SELECT idphone, name, phone.device_type_id, comments_no FROM phone WHERE idbrand = ".$phone['idbrand']." AND published = '1' ORDER BY phone.date_published DESC LIMIT 10"; //ORDER BY new DESC, name $result = mysql_query($query, $conn); if($result) { while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $brand_phones[] = $row; } } else { close_db($conn); header("Location: ./"); exit(); } if($phone['reviews'] > 0) { $query = "SELECT idreview, review_title FROM review WHERE idphone=".$idphone." AND published='1'"; $result = mysql_query($query, $conn); if($result) { while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $reviews[$row['idreview']] = $row['review_title']; } } } $brands_menu = db_get_brands_main($conn); close_db($conn); $current_idbrand = $phone['idbrand']; $html_meta_title = $phone_full_name." - Post your opinion"; $html_meta_desc = "Post your comment about ".$device_title; $html_meta_keywords = $phone_full_name.",".$phone['brand'].",".$phone['name'].",post opinion,post comment"; include_once("./include/header.inc.php"); ?>