if (isset($_POST['captcha']) && $_POST['captcha'] == $_SESSION['captcha'])
That is what is used to check if the captcha is present and has been correctly filled.
And if you want to check things then right at the very top of sp-post.php before anything else should work.