From fd2b74a5f5d3c083bc7068da50443c6b328d6860 Mon Sep 17 00:00:00 2001 From: Tom Slominski Date: Tue, 24 Feb 2015 16:01:40 +0000 Subject: [PATCH] One of my merges might have removed the actual CAPTCHA checking code. Nobody will find out anyway, eh? Eh? --- result.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/result.php b/result.php index 3e8f2fe..55d78c4 100644 --- a/result.php +++ b/result.php @@ -1,11 +1,6 @@ error . '">' . yourls__( 'Are you a bot? Google thinks so. Go back and try again.', 'isq_translation' ) . '

' ); -} - $url = yourls_sanitize_url( $_REQUEST['url'] ); $keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ; $title = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ; @@ -14,6 +9,15 @@ $return = yourls_add_new_link( $url, $keyword, $title ); $shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : ''; $message = isset( $return['message'] ) ? $return['message'] : ''; $title = isset( $return['title'] ) ? $return['title'] : ''; + +$recaptcha_data = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . ISQ::$recaptcha['secret'] . '&response=' . $_REQUEST['g-recaptcha-response']); +$recaptcha_json = json_decode($recaptcha_data, TRUE); + +if ($recaptcha_json['success'] != 'true') { + // What happens when the CAPTCHA was entered incorrectly + die ( '

' . yourls__( 'Are you a bot? Google thinks so. Go back and try again.', 'isq_translation' ) . '

' ); +} + ?> @@ -40,4 +44,4 @@ $title = isset( $return['title'] ) ? $return['title'] : ''; '; } ?> '; } ?> Share on Tumblr'; } ?> - + \ No newline at end of file