ReCaptcha ERROR

  • Glaceorck
    Likes 0

    Problem Description

    Erreur lors de la création du compte, veuillez réessayer plus tard please help me !


  • Sonar Systems admin
    Likes 1

    Error creating account on Google ReCAPTCHA?

  • Glaceorck
    Likes 0

    yes, when I make the button register he tells me to try again later could you help me?

     

    html :

    <!DOCTYPE html>
    <html>
    <head>
    <script src='https://www.google.com/recaptcha/api.js'></script>
    </head>
    <body>
    <form action="" method="POST">
        <div class="field">
            <label for="username">Nom d'utilisateur</label>
            <input type="text" name="username" id="username" value="<?php echo Sonar\Input::Get( "username", $_POST ); ?>" />
        </div>
        
        <div class="field">
            <label for="password">Choisir un mot de passe</label>
            <input type="password" name="password" id="password" />
        </div>
        
        <div class="field">
            <label for="password_again">SVP confirmer le mot de passe</label>
            <input type="password" name="password_again" id="password_again" />
        </div>
        
        <div class="field">
            <label for="email_address">Entrer une adresse email mofo</label>
            <input type="email" name="email_address" id="email_address" value="<?php echo Sonar\Input::Get( "email_address", $_POST ); ?>" />
        </div>
        
        <input type="hidden" name="token" value="<?php echo Sonar\Token::Generate( ); ?>" />
        <input type="submit" name="Register" id="Register" value="S'inscrire" />
        <input type="submit" name="Google" id="Google" value="Google" />
        <input type="submit" name="Facebook" id="Facebook" value="Facebook" />
        
    <div class="g-recaptcha" data-sitekey="6LeiilcUAAAAAJQ1E267YmBbVK8hHrJ0Rh4E—uD"></div></form>

     

    php :

     

    <?php
     
    Sonar\Misc::ChangeWebsiteTitle( "Register" );
     
    $user = new Sonar\User( );
    $recaptcha = new Sonar\ReCAPTCHA( );
     
    if ( $user->IsLoggedIn( ) )
    {
    Sonar\Redirect::To( "home/index" );
    }
     
    if ( Sonar\Input::Exists( "post" ) )
    {
        if ( Sonar\Token::Check( Sonar\Input::Get( "token", $_POST ) ) )
        {       
            if ( Sonar\Input::Get( "Register", $_POST ) )
            {
                $validate = new Sonar\Validate( );
                $validation = $validate->Check( $_POST, array(
                    'username' => array(
                        'required' => true,
                        'min' => 2,
                        'max' => 32,
                        'unique' => Sonar\Config::Get( "users/usersTableName" ),
                        'numeric' => false,
                        'email' => false
                    ),
                    'password' => array(
                        'required' => true,
                        'min' => 6,
                        'max' => 32,
                        'matches' => 'password_again'
                    ),
                    'password_again' => array(
                        'required' => true
                    ),
                    'email_address' => array(
                        'required' => true,
                        'email' => true,
                        'min' => 2,
                        'max' => 32,
                        'unique' => Sonar\Config::Get( "users/usersTableName" )
                    )
                ), array(
                    "Username",
                    "Password",
                    "Password Confirmation",
                    "Email Address"
                ) );
     
                if ( $validation->Passed( ) )
                {
                    if ( $recaptcha->Check( ) && $recaptcha->Passed( ) )
                    {
                        try
                        {
                            $username = Sonar\Input::Get( "username", $_POST );
                            $emailAddress = Sonar\Input::Get( "email_address", $_POST );
                            $salt = Sonar\Hash::Salt( 128 );
     
                            $email = new Sonar\Email( );
     
                            $email = $email->Send(
                                array(
                                    array( $emailAddress, $username )
                                ),
                                array( "support@sonarsystems.co.uk", "Sonar Systems" ), 
                                array( "support@sonarsystems.co.uk", "Sonar Systems" ), 
                                "Activation Email", 
                                "_ActivationTemplate.php", 
                                true,
                                array( 
                                    "&&activationURL&&" => Sonar\Config::Get( "website/domainName" ).Sonar\Config::Get( "website/root" )."/home/activate/".$salt."/".$username
                                )
                            );
     
                            if ( $email )
                            {
                                echo "Account created, please check your emails for an activation email.";
                                
                                $user->Create( array(
                                    "privilege" => 'user',
                                    "username" => $username,
                                    "password" => password_hash( Sonar\Input::Get( "password", $_POST ), PASSWORD_DEFAULT ),
                                    "email_address" => $emailAddress,
                                    "salt" => $salt,
                                    "joined" => time( )
                                ) );
                                
                                Sonar\Session::Flash( "home", "You have been registered, please check your email for an activation email." );
                                Sonar\Redirect::To( "home" );
                            }
                            else
                            {
                                echo "Error creating account please try again later.";
                            }
                        }
                        catch ( Exception $error )
                        {
                            echo "Error has occured creating your account, please try again later.";
                        }
                    }
                    else
                    {
                        foreach( $recaptcha->Errors( ) as $error )
                        {
                            echo $error."<br />";
                        }
                    }
                }
                else
                {
                    foreach( $validation->Errors( ) as $error )
                    {
                        echo $error."<br />";
                    }
                }
            }
            else
            {
                if ( Sonar\Input::Get( "Google", $_POST ) )
                {
                    $user->HybridAuth( )->Authenticate( "Google" );
                }
                else if ( Sonar\Input::get( "Facebook", $_POST ) )
                {
                    $user->HybridAuth( )->Authenticate( "Facebook" );
                }
            }
        }
    }
     
    ?>
     
    help ??.

  • Sonar Systems admin
    Likes 1

    Do you get any errors/warnings in the console.

  • Glaceorck
    Likes 0

    Yes , I habe a error in the console : This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see https://goo.gl/zmWq3m.

     

  • Sonar Systems admin
    Likes 0

    What content is on the page?

  • Glaceorck
    Likes 0

    Warning: file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in on line 50

    yet g put the email the password the name and confirmation

     

     

     

    <?php
    /**
     * This is a PHP library that handles calling reCAPTCHA.
     *
     * @copyright Copyright (c) 2015, Google Inc.
     * @link      http://www.google.com/recaptcha
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */

    namespace ReCaptcha\RequestMethod;

    use ReCaptcha\RequestMethod;
    use ReCaptcha\RequestParameters;

    class Post implements RequestMethod
    {
        const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';

        public function submit(RequestParameters $params)
        {
            
            $peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name';
            $options = array(
                'http' => array(
                    'header' => "Content-type: application/x-www-form-urlencoded\r\n",
                    'method' => 'POST',
                    'content' => $params->toQueryString(),
                    'verify_peer' => true,
                    $peer_key => 'www.google.com',
                ),
            );
            $context = stream_context_create($options);
            return file_get_contents(self::SITE_VERIFY_URL, true, $context);
        }
    }

     

    help me !!

  • Sonar Systems admin
    Likes 0

    Is this using our PHP Web Framework?

Login to reply