seat183 Posted June 25, 2015 Share Posted June 25, 2015 I am trying to remove this and I am a total newbie to PHP. If anyone could point me to the way to delete this from my register and forgot password link this would be great. </script> {% if account %} {% else %} <div id="registerbutton" class="grid_4 alpha omega"></div> <div id="register" class="grid_4 alpha omega"> <form method="POST" action="register.php"> <span id="grid_5" class="signup_text"><b>Username</b> (4-32 characters)</span> <input type="text" name="register_username" class="signup_input" value="{{ post.register_username }}" /> <div class="grid_4 alpha omega"> <span id="grid_5" class="signup_text"><b>Password</b> (min 6 characters)</span> <input type="password" class="signup_input" name="register_password" value="" /> </div> <div class="grid_4 alpha omega"> <span id="grid_5" class="signup_text"><b>Repeat Password</b> </span> <input type="password" class="signup_input" name="repeat_password" value="" /> </div> <div class="grid_4 alpha omega"> <span id="grid_5" class="signup_text"><b>Email Address</b> (must be valid)</span> <input type="text" class="signup_input" name="email" value="{{ post.email }}" /> </div> <div style="clear:both"></div> <div id="recaptcha_widget" style="position:relative;"> <div id="recaptcha_image" style="clear:both;display:block;position:relative;z-index:99;top:66px;left:10px"></div> <!--<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div> <span class="recaptcha_only_if_image">Enter the words above:</span> <span class="recaptcha_only_if_audio">Enter the numbers you hear:</span> <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" /> <div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div> <div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div> <div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div> <div> <a href="javascript:Recaptcha.showhelp()">Help</a></div> </div>--> <script type="text/javascript" src="http://www.google.com/recaptcha/api/KEYHERE"></script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=KEYHERE" height="300" width="300" frameborder="0"></iframe> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"> </noscript> </div> <div class="grid_6 alpha omega"> <input type="checkbox" class="grid_1" name="agree" value="1" {% if post.agree %}checked="checked"{% endif %} /> I agree to the <a href="guide.php?id=1">Terms of Service</a> <br />and <a href="guide.php?id=2">Privacy Policy</a> </div> <div class="grid_4"> <br /> <input type="submit" name="register" class="signup_submit" value=" "/> {% if registration_errors %} {% for error in registration_errors %} <br /> <span id="grid_1" class="error_message">{{ error }} </span><br /> {% endfor %} {% endif %} </div> </form> </div> {% endif %} {% endblock rightbar %} I'VE put my public keys in both the above ere it says Keys HERE but it would work and just refreshes the captcha when I click Register. Is there anyway I can totally remove this from the above w ehere it does not even need the captcha? Thanking anyone if they help. Quote Link to comment https://forums.phpfreaks.com/topic/297019-removing-recaptcha-from-registration/ Share on other sites More sharing options...
iarp Posted June 25, 2015 Share Posted June 25, 2015 (edited) Where is the code for the receiving end? Removing it from the display will not remove its requirement to be filled out. We need to see register.php to tell you what code needs to be removed. Edited June 25, 2015 by iarp Quote Link to comment https://forums.phpfreaks.com/topic/297019-removing-recaptcha-from-registration/#findComment-1514901 Share on other sites More sharing options...
fastsol Posted June 25, 2015 Share Posted June 25, 2015 For the code you did post, this is what needs to be removed. <div id="recaptcha_widget" style="position:relative;"> <div id="recaptcha_image" style="clear:both;display:block;position:relative;z-index:99;top:66px;left:10px"></div> <!--<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div> <span class="recaptcha_only_if_image">Enter the words above:</span> <span class="recaptcha_only_if_audio">Enter the numbers you hear:</span> <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" /> <div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div> <div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div> <div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div> <div> <a href="javascript:Recaptcha.showhelp()">Help</a></div> </div>--> <script type="text/javascript" src="http://www.google.com/recaptcha/api/KEYHERE"></script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=KEYHERE" height="300" width="300" frameborder="0"></iframe> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"> </noscript> </div> There will be other code in the processing page for the form that also needs to be removed. Post that code here and we can look at it. Quote Link to comment https://forums.phpfreaks.com/topic/297019-removing-recaptcha-from-registration/#findComment-1514913 Share on other sites More sharing options...
seat183 Posted June 26, 2015 Author Share Posted June 26, 2015 Where is the code for the receiving end? Removing it from the display will not remove its requirement to be filled out. We need to see register.php to tell you what code needs to be removed. For the code you did post, this is what needs to be removed. <div id="recaptcha_widget" style="position:relative;"> <div id="recaptcha_image" style="clear:both;display:block;position:relative;z-index:99;top:66px;left:10px"></div> <!--<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div> <span class="recaptcha_only_if_image">Enter the words above:</span> <span class="recaptcha_only_if_audio">Enter the numbers you hear:</span> <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" /> <div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div> <div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div> <div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div> <div> <a href="javascript:Recaptcha.showhelp()">Help</a></div> </div>--> <script type="text/javascript" src="http://www.google.com/recaptcha/api/KEYHERE"></script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=KEYHERE" height="300" width="300" frameborder="0"></iframe> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"> </noscript> </div> There will be other code in the processing page for the form that also needs to be removed. Post that code here and we can look at it. Many thanks for the reply, everyone. here is the register.php I have tried myself but just end up getting a syntax error. <?php require_once('../include/init.php'); // Prepare the errors array $_errors = array(); // Registration if (Tools::getValue('register')) { require_once(APP_DIR.'lib/reCAPTCHA/recaptchalib.php'); $captcha = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], Tools::getValue("recaptcha_challenge_field"), Tools::getValue("recaptcha_response_field")); if (!Tools::getValue('agree')) { $_errors []= 'Error #RG0010: '.FRONT_ERROR_RG0010; } elseif (!$captcha->is_valid) { $_errors []= 'Error #RG0015: '.FRONT_ERROR_RG0015; } else { // Initialize a new user... $account = new Account(); $_errors = $account->registration(Tools::getValue('register_username'), Tools::getValue('register_password'), Tools::getValue('repeat_password'), Tools::getValue('email')); // Register the user if there were no errors in initializing an account if (!sizeof($_errors)) { if (!$activation_token = $account->register()) $_errors []= 'Error #RG0009: '.FRONT_ERROR_RG0009; if ($ref = $session->referral) Referral::add($ref, $account->id); } } if (sizeof($_errors)) { $template = $twig->loadTemplate('index.html'); $template->display(array( 'registration_errors' => $_errors, 'recaptcha' => recaptcha_get_html(RECAPTCHA_PUBLIC_KEY), 'goto' => 'registration', 'post' => $_POST)); exit(); } else { Tools::redirect('register.php?send_activation&token='.$activation_token); } } else // Account activation if (Tools::getValue('activate', 'null') != 'null' or Tools::getValue('send_activation', 'null') != 'null') { $_errors = array(); // Initialize the activation $activation = Activation::getByField(array('token' => Tools::getValue('token'))); if (!($activation->id)) $_errors []= 'Error #RG0011: '.FRONT_ERROR_RG0011; else { $account = new Account($activation->id_account); if (!$account->id) Error::get()->report('ACT0003', 'UserID#'.$activation->id_account.' ActivationID#'.$activation->id, CRITICAL_ERROR); } $success = false; // Send activation key if (Tools::getValue('send_activation', 'null') != 'null') { if (!Mail::send($account->email, 'activation', array('activation_token' => $activation->token, 'activation_code' => $activation->getCode(), 'account' => $account))) { Error::get()->report('MAIL0001', 'UserID#'.$account->id, NOTICE_ERROR); $_errors []= 'Error #RG0013: '.FRONT_ERROR_RG0013; } else $success = true; } // Check activation key if (Tools::getValue('activate', 'null') != 'null' and Tools::getValue('activation_code', 'null') != 'null') { $activation_code = Tools::getValue('activation_code'); if ($activation_code != $activation->getCode()) { $_errors []= 'Error #RG0012: '.FRONT_ERROR_RG0012; } elseif(!$activation->success($account)) { // Activation failed $_errors []= 'Error #RG0014: '.FRONT_ERROR_RG0014; } else { // Display successfull activation prompt and mail the welcome message if (!Mail::send($account->email, 'welcome', array('account' => $account))) Error::get()->report('MAIL0003', 'UserID#'.$account->id, NOTICE_ERROR); $template = $twig->loadTemplate('activate.html'); $template->display(array( 'success' => true)); exit(); } } $template = $twig->loadTemplate('activate.html'); $template->display(array( 'activation_errors' => $_errors, 'activation_success_send' => $success, 'post' => $_POST, 'activation_token' => $activation->token, 'email' => $account->email)); exit(); } else Tools::redirect('/'); // An unknown request to this file ?> Quote Link to comment https://forums.phpfreaks.com/topic/297019-removing-recaptcha-from-registration/#findComment-1514989 Share on other sites More sharing options...
fastsol Posted June 26, 2015 Share Posted June 26, 2015 I removed the code that has to do with the captcha. Looks like you'll probably need to edit the template index.html according to what items are being sent to it in the $twig->loadTemplate. <?php require_once('../include/init.php'); // Prepare the errors array $_errors = array(); // Registration if (Tools::getValue('register')) { if (!Tools::getValue('agree')) { $_errors []= 'Error #RG0010: '.FRONT_ERROR_RG0010; } else { // Initialize a new user... $account = new Account(); $_errors = $account->registration(Tools::getValue('register_username'), Tools::getValue('register_password'), Tools::getValue('repeat_password'), Tools::getValue('email')); // Register the user if there were no errors in initializing an account if (!sizeof($_errors)) { if (!$activation_token = $account->register()) $_errors []= 'Error #RG0009: '.FRONT_ERROR_RG0009; if ($ref = $session->referral) Referral::add($ref, $account->id); } } if (sizeof($_errors)) { $template = $twig->loadTemplate('index.html'); $template->display(array( 'registration_errors' => $_errors, 'goto' => 'registration', 'post' => $_POST)); exit(); } else { Tools::redirect('register.php?send_activation&token='.$activation_token); } } else // Account activation if (Tools::getValue('activate', 'null') != 'null' or Tools::getValue('send_activation', 'null') != 'null') { $_errors = array(); // Initialize the activation $activation = Activation::getByField(array('token' => Tools::getValue('token'))); if (!($activation->id)) $_errors []= 'Error #RG0011: '.FRONT_ERROR_RG0011; else { $account = new Account($activation->id_account); if (!$account->id) Error::get()->report('ACT0003', 'UserID#'.$activation->id_account.' ActivationID#'.$activation->id, CRITICAL_ERROR); } $success = false; // Send activation key if (Tools::getValue('send_activation', 'null') != 'null') { if (!Mail::send($account->email, 'activation', array('activation_token' => $activation->token, 'activation_code' => $activation->getCode(), 'account' => $account))) { Error::get()->report('MAIL0001', 'UserID#'.$account->id, NOTICE_ERROR); $_errors []= 'Error #RG0013: '.FRONT_ERROR_RG0013; } else $success = true; } // Check activation key if (Tools::getValue('activate', 'null') != 'null' and Tools::getValue('activation_code', 'null') != 'null') { $activation_code = Tools::getValue('activation_code'); if ($activation_code != $activation->getCode()) { $_errors []= 'Error #RG0012: '.FRONT_ERROR_RG0012; } elseif(!$activation->success($account)) { // Activation failed $_errors []= 'Error #RG0014: '.FRONT_ERROR_RG0014; } else { // Display successfull activation prompt and mail the welcome message if (!Mail::send($account->email, 'welcome', array('account' => $account))) Error::get()->report('MAIL0003', 'UserID#'.$account->id, NOTICE_ERROR); $template = $twig->loadTemplate('activate.html'); $template->display(array( 'success' => true)); exit(); } } $template = $twig->loadTemplate('activate.html'); $template->display(array( 'activation_errors' => $_errors, 'activation_success_send' => $success, 'post' => $_POST, 'activation_token' => $activation->token, 'email' => $account->email)); exit(); } else Tools::redirect('/'); // An unknown request to this file ?> You can post the index.html template too if you can't figure it out. Quote Link to comment https://forums.phpfreaks.com/topic/297019-removing-recaptcha-from-registration/#findComment-1515003 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.