From 5b70780eb304ed68645d48f06f65034499d7a515 Mon Sep 17 00:00:00 2001 From: Dylan Lloyd Date: Tue, 8 Mar 2011 02:34:53 -0500 Subject: [PATCH] Added form fields and started insert SQL I have NO idea how to get the recaptcha image to align right without floating it, which screws up everything else. Insert SQL still does not work, I'm thinking there should be a cms->insert method to sanitize the data. I was thinking about having a cms->sanitize method to abstract the htmlspecialchars() use etc. in case something changes but decided against it. Now using custom styling for the recaptcha, it already looks much cleaner, but still needs cleaning up. --- includes/style.css | 22 ++++++++++++--- index.php | 67 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 75 insertions(+), 14 deletions(-) diff --git a/includes/style.css b/includes/style.css index f4e7094..e7c97e0 100644 --- a/includes/style.css +++ b/includes/style.css @@ -169,13 +169,29 @@ pre { } #comments { - border-right:3px solid black; + border-right:1px solid black; padding-right:15px; } #comment { + padding-right:15px; + border-right:1px solid black; + margin-top:15px; + text-align:right; } -#recaptcha_widget_div { - float:right; +#comment input { + border:1px solid grey; +} + +#comment textarea { + border:1px solid grey; +} + +#comment .submit { + background:#FFF; + border:1px solid white; + color:blue; + cursor:pointer; + font-size:120%; } diff --git a/index.php b/index.php index 16a01ec..516089e 100644 --- a/index.php +++ b/index.php @@ -340,7 +340,14 @@ class note extends cms { $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { echo "The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"; - } + } else { + $sql = ("INSERT INTO comments (date_posted, author, + email, text, note + VALUES(NOW(), ?, ?, ?, ?, ?"); + echo htmlspecialchars($_POST['author']); + echo htmlspecialchars($_POST['email']); + echo htmlspecialchars($_POST['text']); + } } private function display_note() { @@ -365,12 +372,14 @@ class note extends cms { } private function write_navigation() { - echo "
"; - echo "
"; - echo "

"; - echo "notes/"; - echo "

"; - echo "
"; + echo << +
+

+ notes/ +

+
+END_OF_NAVIGATION; } private function display_comment_link() { @@ -399,13 +408,49 @@ END_OF_COMMENT; } private function display_comment_form() { + echo << +var RecaptchaOptions = { + theme : 'custom', + custom_theme_widget: 'recaptcha_widget' + }; + +END_CAPTCHA_STYLE; + require_once('includes/recaptchalib.php'); // Trailing slash is necessary for reloads to work $url = $this->url . "verify/"; - echo "
"; - require_once('includes/recaptchalib.php'); + echo ""; + echo << + +

comment:


+
+

name:


+
+

email:


+
+ + +
+
+
Incorrect please try again
+ enter the words above: + enter the numbers you hear: +
+ + + + + +

+
+FORM; echo recaptcha_get_html($this->recaptcha_publickey); - echo ""; - echo ""; + echo << + + +END_OF_FORM; } } -- 2.30.2