Changeset 2589865
- Timestamp:
- 08/27/2021 01:39:59 PM (5 years ago)
- File:
-
- 1 edited
-
humancaptcha/trunk/outerbridge-humancaptcha.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
humancaptcha/trunk/outerbridge-humancaptcha.php
r2546304 r2589865 5 5 Description: HumanCaptcha uses questions that require human logic to answer them and which machines cannot easily answer. 6 6 Author: Outerbridge 7 Version: 4. 0.07 Version: 4.1.0 8 8 Author URI: https://outerbridge.co.uk/ 9 9 Text Domain: humancaptcha … … 14 14 /** 15 15 * 16 * v4.1.0 210827 Fixed problem with comments form validation. Working with WP5.8 17 * 16 18 * v4.0.0 210611 Fixed session issue, thanks to @tmuk. Working with WP5.7 17 *18 19 * v3.1 200116 Improved foreign character handling 19 20 * v3.0 180105 Improved accessibility (thanks to Ondrej), moved admin menu to Settings, tidied admin page, added Settings link to Plugins page … … 40 41 */ 41 42 42 $obr_humancaptcha = new obr_humancaptcha;43 44 43 global $wpdb; 45 44 … … 53 52 54 53 // version 55 public $obr_humancaptcha_version = '4. 0.0';54 public $obr_humancaptcha_version = '4.1.0'; 56 55 57 56 function __construct(){ … … 70 69 add_action('admin_menu', array($this, 'obr_admin_menu')); 71 70 add_action('init', array($this, 'obr_init')); 72 add_action( 'wp_loaded', array( $this, 'obr_close_session' ), 30 );71 //add_action( 'wp_loaded', array( $this, 'obr_close_session' ), 30 ); 73 72 74 73 add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'obr_plugin_settings_link')); … … 186 185 global $user_ID; 187 186 if (!$user_ID){ 187 if (!session_id()){ 188 session_start(); 189 } 188 190 $selected = $this->obr_select_question(); 189 191 $question = $selected['question']; 190 192 $answer = $selected['answer']; 191 session_start(); 192 $_SESSION['obr_answer'] = md5(strtolower(trim($answer))); 193 $_SESSION[ 'obranswer' ] = md5( strtolower( trim( $answer ) ) ); 193 194 session_write_close(); 194 195 // use the comment-form-email class as it works better with 2011 … … 224 225 $question = $selected[ 'question' ]; 225 226 $answer = $selected[ 'answer' ]; 226 session_start(); 227 $_SESSION[ 'obr_answer' ] = md5( strtolower( trim( $answer ) ) ); 227 if ( !session_id() ) { 228 session_start(); 229 } 230 $_SESSION[ 'obranswer' ] = md5( strtolower( trim( $answer ) ) ); 228 231 session_write_close(); 229 232 $outputfield = '<p><label for="answer">' . stripslashes( $question ) . '</label><br /><input type="text" name="answer" id="answer" class="input" value="" size="25" tabindex="20" /></p>'; … … 257 260 $errors->add('obr_error', __('Error: please fill the required field (humancaptcha).', 'humancaptcha')); 258 261 } else { 259 $user_answer = md5(strtolower(trim($_POST['answer']))); 260 session_start(); 261 $obr_answer = strtolower(trim($_SESSION['obr_answer'])); 262 $useranswer = md5(strtolower(trim($_POST['answer']))); 263 if ( !session_id() ) { 264 session_start(); 265 } 266 $obranswer = strtolower(trim($_SESSION['obranswer'])); 262 267 session_write_close(); 263 if ($user _answer != $obr_answer){268 if ($useranswer != $obranswer){ 264 269 $errors->add('obr_error', __('Error: your answer to the humancaptcha question is incorrect.', 'humancaptcha')); 265 270 } … … 282 287 wp_die(__('Error: please fill the required field (humancaptcha).', 'humancaptcha')); 283 288 } 284 $user _answer = md5(strtolower(trim($_POST['answer'])));285 $obr _answer = strtolower(trim($_SESSION['obr_answer']));289 $useranswer = md5(strtolower(trim($_POST['answer']))); 290 $obranswer = strtolower(trim($_SESSION['obranswer'])); 286 291 session_write_close(); 287 if ($user _answer != $obr_answer){292 if ($useranswer != $obranswer){ 288 293 wp_die(__('Error: your answer to the humancaptcha question is incorrect. Use your browser\'s back button to try again.', 'humancaptcha')); 289 294 } … … 510 515 } 511 516 } 512 ?> 517 518 $obr_humancaptcha = new obr_humancaptcha; 519
Note: See TracChangeset
for help on using the changeset viewer.