function addComment($name, $email, $humancheck, $text, $post_id) { $objResponse = new xajaxResponse(); if ($humancheck == $_SESSION['rand1'] + $_SESSION['rand2']) { $project7 = new editsee_App(); $project7->db->insert_comment($post_id, $name, $email, $text); if ($project7->get_config('es_email_comments') == '1') { mail($project7->get_user_email($project7->get_post_user($post_id)), 'New Comment on Post ' . $project7->get_post_title($post_id), $project7->get_config('es_main_url') . 'post/' . $post_id . '/#comments' . "\n" . $name . ' said:' . "\n" . $text); } $objResponse->assign('comments', 'innerHTML', $project7->get_comments($post_id)); $objResponse->script("document.getElementById('comment_name').value = '';\r\n\t\t\t\t\t\t\t document.getElementById('comment_email').value = '';\r\n\t\t\t\t\t\t\t document.getElementById('comment_humancheck').value = '';\r\n\t\t\t\t\t\t\t document.getElementById('comment_text').value = ''"); } else { $objResponse->alert("You did not answer the spam check question correctly."); } return $objResponse; }