Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 07-11-2014, 11:00 AM
BurnOut BurnOut is offline
Contributing Member
 
Join Date: 10-29-11
Posts: 131
iTrader: 0 / 0%
Thumbs up Installing recaptcha to my inquiry form

I want to install recaptcha to my inquiry form and I need some help with the code.

I'm talking about this recaptcha - https://developers.google.com/recaptcha/docs/php?hl=de

I'm using Wordpress (with my own hosting).

Example page how that "send inquiry" button looks like - http://www.camarocarplace.com/cars/m...vrolet-camaro/

I already added that "recaptchalib.php" file to my theme files and I can access it from my wp panel>editor. However, I don't need to touch it, because I just need to have it there and I need to add that code (in that link, given below "quick start") where my inquiry form is.

As I understand, I need to add this code
Code:
require_once('recaptchalib.php'); $publickey = "your_public_key"; // you got this from the signup page echo recaptcha_get_html($publickey);
to the file where my inquiry form is.

I've found that file and here is the code for that inquiry form (this is the whole code from .php file:
Code:
<?php if($_POST) { $yourname = $_POST['inq_name']; $youremail = $_POST['inq_email']; $inq_phone = $_POST['inq_phone']; $frnd_comments = $_POST['inq_msg']; $pid = $_POST['pid']; $post_title = '<a href="'.get_permalink($post->ID).'">'.$post->post_title.'</a>'; $to_name = get_post_meta($post->ID,'name',true); $to_email = get_post_meta($post->ID,'email',true); if($to_email=='') { $to_email = get_option('admin_email'); } ///////Inquiry EMAIL START////// global $upload_folder_path; $clientdestinationfile = get_bloginfo( 'template_directory', 'false' )."/library/notification/send_inquiry.txt"; $message1 = file_get_contents($clientdestinationfile); $filecontent_arr1 = explode('[SUBJECT-STR]',$message1); $filecontent_arr2 = explode('[SUBJECT-END]',$filecontent_arr1[1]); $subject = $filecontent_arr2[0]. __(' for ').'"'.$post->post_title.'"'; $client_message = $filecontent_arr2[1]; $yourname_link = __('<br>From : ').$yourname.__('<br>Phone : ').$inq_phone.'<br><br>Sent from - <b><a href="'.get_option('siteurl').'">'.get_option('blogname').'</a></b>.'; /////////////customer email////////////// $search_array = array('[#$to_name#]','[#$post_title#]','[#$frnd_subject#]','[#$frnd_comments#]','[#$your_name#]'); $replace_array = array($to_name,$post_title,$frnd_subject,nl2br($frnd_comments),$yourname_link); $client_message = str_replace($search_array,$replace_array,$client_message); /* echo "From : $youremail Name : $yourname <br>"; echo "To : $to_email Name : $to_name <br>"; echo "Subject $subject <br>"; echo "$client_message"; exit;*/ if($to_email) { sendEmail($youremail,$yourname,$to_email,$to_name,$subject,$client_message,$extra=''); } //////Inquiry EMAIL END//////// $url = get_permalink($post->ID); if(strstr($url,'?')) { $url = $url."&send_inquiry=success"; }else { $url = $url."?send_inquiry=success"; } wp_redirect($url); } ?>
So, I need that captcha to this inquiry form. If you go to that URL above (camaro site) and click on "send inquiry" (red button on the right side), an inquiry form appears. That code above is of that form and I need to add this recaptcha to this form, so that this captcha must be resolved before people can click on "send" button or at least if that captcha isn't resolved correctly, they won't be able to send this form.

Any ideas how to make this work?

Last edited by BurnOut; 07-11-2014 at 11:10 AM.
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 07-12-2014, 05:43 AM
BurnOut BurnOut is offline
Contributing Member
 
Join Date: 10-29-11
Posts: 131
iTrader: 0 / 0%
Actually the popup form code is this
Code:
<form method="post" name="agt_mail_agent" id="agt_mail_agent" action="<?php echo get_permalink($post->ID); ?>" > <input type="hidden" name="pid" id="agt_mail_agent_pid" value="<?php echo $post->ID;?>" /> <input type="hidden" name="sendact" value="send_inqury" /> <h3><?php echo SEND_INQUIRY;?> </h3> <p id="inquiry_send_success" class="sucess_msg" style="display:none;"></p> <div class="row clearfix" ><label><?php _e('Your Name');?> : <span>*</span></label><input name="inq_name" id="agt_mail_name" type="text" /><span id="span_agt_mail_name"></span></div> <div class="row clearfix" ><label><?php _e('Email');?> : <span>*</span></label><input name="inq_email" id="agt_mail_email" type="text" /><span id="span_agt_mail_email"></span></div> <div class="row clearfix" ><label><?php _e('Contact Info');?> :</label><input name="inq_phone" id="agt_mail_phone" type="text" /></div> <div class="row clearfix" ><label><?php _e('Comments');?> : <span>*</span></label> <textarea name="inq_msg" id="agt_mail_msg" cols="" rows="" ><?php echo SEND_INQUIRY_SAMPLE_CONTENT;?></textarea> <span id="span_agt_mail_msg"></span> </div> <input name="Send" type="submit" value="<?php _e('Send');?>" class="button clearfix" /> </form>
That form above (in my first post) is the form where the data from the form is sent to.
 
Reply With Quote
  #3  
Old 07-14-2014, 01:11 AM
williamforrest williamforrest is offline
Contributing Member
 
Join Date: 12-01-13
Posts: 98
iTrader: 0 / 0%
you to go to the source file of that form, or if it is dynamically created you need to find that plugin and add the recaptcha line.
if it is a separte plugin, majority of form plugins has a feature that you can integrate captcha fields you just need to research on it..
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Google ReCaptcha - PHP syntax for else instructions Brazzell Marketing Coding Forum 1 01-07-2014 07:42 AM
Signature Inquiry joan.lopez V7N Forum Support 2 09-30-2009 06:21 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 02:21 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC