<?php

require_once('recaptchalib.php');

// Get a key from https://www.google.com/recaptcha/admin/create
$publickey = "6Lf-AcwSAAAAAI0d0j-UOrq16vWEqMLOUOobnMJ7";
$privatekey = "6Lf-AcwSAAAAAD7oRs1fmIVGmQmG787B2OBaoHhv";

# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;

# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if ($resp->is_valid) {
echo "You got it! Your message will be posted in a few minutes. Thank You!";
$name = $_POST['name'];
$blog = $_POST['message'];
$sql = mysql_query("INSERT INTO tnow_blog (name, message) VALUES ('$name', '$blog')") or die (mysql_error());
mail( "info@tommynow.com", "Blog Post",
"Name: $name Message: $blog");
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
?>
<br /><input class="button" type="submit" name="submit" value="POST VIDEO" />
</p>
</p>
</form>
<hr />
<p>&nbsp;</p>
<p>
<?php
echo "<table width='100%' cellpadding='7' cellspacing='0'>";
while($row = mysql_fetch_assoc($tnowblog))
{
echo"<tr><td></td></tr><tr>
<td background='bg2.png'>

 

<div align='left'>

<table width='550' border='0' cellspacing='5' cellpadding='5'>
<tr>
<th scope='col' valign='top'>
".$row['name']."<br />".$row['Date']."</th>
<th scope='col' valign='top'>".$row['message']."</th>
</tr>
</table>

 

</div>
</td></tr>";
}
echo "</table><br>";
?>