http://codegrrl.com/forums/index.php?showtopic=13407
I was just wondering how this javascript works, and whether something is supposed to show up before the submit button? Nothing is showing up for me
Here's my process.php page, I'm not sure if the javascript code is in the right place or not...
CODE
<?php
if (!isset($_POST['spamtest']) || $_POST['spamtest'] != "retrobella") {
echo "<p>JavaScript must be enabled to comment here due to spam restrictions in place.</p>";
exit;
}
if (isset($_POST['submit_comment'])) {
if (empty($_POST['name']) || empty($_POST['email']) || empty($_POST['comment'])) {
die("You have forgotten to fill in one of the required fields! Please make sure you submit a name, e-mail address and comment.");
}
$entry = htmlspecialchars(strip_tags($_POST['entry']));
$timestamp = htmlspecialchars(strip_tags($_POST['timestamp']));
$name = htmlspecialchars(strip_tags($_POST['name']));
$email = htmlspecialchars(strip_tags($_POST['email']));
$url = htmlspecialchars(strip_tags($_POST['url']));
$comment = htmlspecialchars(strip_tags($_POST['comment']));
$comment = nl2br($comment);
if (!get_magic_quotes_gpc()) {
$name = addslashes($name);
$url = addslashes($url);
$comment = addslashes($comment);
}
if (!eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {
die("The e-mail address you submitted does not appear to be valid. Please go back and correct it.");
}
mysql_connect ('localhost', 'rhiface1_blog', 'aurora');
mysql_select_db ('rhiface1_blog');
$result = mysql_query("INSERT INTO php_blog_comments (entry, timestamp, name, email, url, comment) VALUES ('$entry','$timestamp','$name','$email','$url','$comment')");
header("Location: single.php?id=" . $entry);
}
else {
die("Error: you cannot access this page directly.");
}
?>