HEX
Server: LiteSpeed
System: Linux melbournecleaninggroup 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: www-data (33)
PHP: 7.3.33-1+focal
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/html/wp-content/plugins/dologin/src/captcha.cls.php
<?php
/**
 * Captcha class
 *
 * @since 1.6
 */
namespace dologin;
defined( 'WPINC' ) || exit;

class Captcha extends Instance {
	/**
	 * Display recaptcha
	 *
	 * @since  1.6
	 */
	public function show() {
		wp_register_script( 'dologin_google_api', 'https://www.google.com/recaptcha/api.js', array(), null );
		wp_enqueue_script( 'dologin_google_api' );

		echo '<div class="g-recaptcha dologin-captcha" data-sitekey="' . Conf::val( 'gg_pub_key' ) . '"></div>';
	}

	/**
	 * Validate recaptcha
	 *
	 * @since  1.6
	 */
	public function authenticate() {
		// Validate
		if ( empty( $_POST[ 'g-recaptcha-response' ] ) ) {
			throw new \Exception( 'captcha_missing' );
		}

		$url = 'https://www.google.com/recaptcha/api/siteverify';
		$data = array(
			'secret' 	=> Conf::val( 'gg_priv_key' ),
			'response' 	=> $_POST[ 'g-recaptcha-response' ],
			'remoteip' => IP::me(),
		);

		$res = wp_remote_post( $url, array( 'body' => $data, 'timeout' => 15, 'sslverify' => false ) );

		if ( is_wp_error( $res ) ) {
			$error_message = $res->get_error_message();
			throw new \Exception( $error_message );
		}

		$res = json_decode( $res[ 'body' ], true );

		if ( empty( $res[ 'success' ] ) ) {
			$err_code = ! empty( $res[ 'error-codes' ][ 0 ] ) ? $res[ 'error-codes' ][ 0 ] : 'error' ;

			throw new \Exception( $err_code );
		}

		defined( 'debug' ) && debug( '✅ passed' );
	}
}