DMXzone reCAPTCHA Support Product Page

In progress

Doesn't seem to do anything at all. Form ignores it

Reported 02 Dec 2011 15:01:41
1
has this problem
02 Dec 2011 15:01:41 Bruce Wilkie posted:
Hi There.

I'm using it in conjunction with a 'tell a friend' form that uses SmartMailer (PHP). I've followed the simple installation video and when I saw that it wasn't working, I checked the forums and added the script mentioned at www.dmxzone.com/go?19400

No difference that I can see. It processes the form using SmartMailer no matter what I type into the recaptcha box.

<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?>
<?php require_once('Connections/watches24.php'); ?>
<?php
$eCart1->GetContent();
?>
<?php require_once('ScriptLibrary/incSmartMailer.php'); ?>
<?php require_once('ScriptLibrary/dmxReCAPTCHA.php'); ?>
<?php
// DMXzone reCAPTCHA 1.0.1
$theCAPTCHA = new dmxReCAPTCHA();
$theCAPTCHA->privateKey = "6LcpwsoSAAAAAOIRAN3TxAdk96vEsYfdifaSXOgo";
$theCAPTCHA->publicKey = "6LcpwsoSAAAAAJF5usbtmcWMoBEV_N13Rlx09gvu";
$theCAPTCHA->Construct();
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_watches24, $watches24);
$query_rs_watches_atoz = "SELECT watches24_brand.*, count(watches24_watch.watchbrandid) AS watchcount FROM watches24_watch LEFT JOIN watches24_brand ON watches24_watch.watchbrandid = watches24_brand.watchbrandid GROUP BY watches24_brand.watchbrand ORDER BY watches24_brand.watchbrand";
$rs_watches_atoz = mysql_query($query_rs_watches_atoz, $watches24) or die(mysql_error());
$row_rs_watches_atoz = mysql_fetch_assoc($rs_watches_atoz);
$totalRows_rs_watches_atoz = mysql_num_rows($rs_watches_atoz);

mysql_select_db($database_watches24, $watches24);
$query_rs_watches_gents = "SELECT watches24_brand.*, count(watches24_watch.watchbrandid) AS watchcount FROM watches24_watch LEFT JOIN watches24_brand ON watches24_watch.watchbrandid = watches24_brand.watchbrandid WHERE watches24_watch.gender_id = 1 GROUP BY watches24_brand.watchbrand ORDER BY watches24_brand.watchbrand";
$rs_watches_gents = mysql_query($query_rs_watches_gents, $watches24) or die(mysql_error());
$row_rs_watches_gents = mysql_fetch_assoc($rs_watches_gents);
$totalRows_rs_watches_gents = mysql_num_rows($rs_watches_gents);

mysql_select_db($database_watches24, $watches24);
$query_rs_watches_ladies = "SELECT watches24_brand.*, count(watches24_watch.watchbrandid) AS watchcount FROM watches24_watch LEFT JOIN watches24_brand ON watches24_watch.watchbrandid = watches24_brand.watchbrandid WHERE watches24_watch.gender_id = 2 GROUP BY watches24_brand.watchbrand ORDER BY watches24_brand.watchbrand";
$rs_watches_ladies = mysql_query($query_rs_watches_ladies, $watches24) or die(mysql_error());
$row_rs_watches_ladies = mysql_fetch_assoc($rs_watches_ladies);
$totalRows_rs_watches_ladies = mysql_num_rows($rs_watches_ladies);
?>
<?php
if($_SERVER['REQUEST_METHOD'] == "POST") { // if form is submitted
  if (!isset($mm_abort_edit) || !$mm_abort_edit) { // and validation is fine
    $GoTo = "tell_a_friend_new.php?message=sent";  // redirect to a new page
    if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
      $GoTo .= (strpos($GoTo, '?')) ? "&" : "?";
      $GoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $GoTo));
  }
} 
?>
<?php
// Smart Mailer 1.0.8
// Send on submit of form form1
$sm1 = new SmartMailer();
$sm1->checkVersion("1.08");
$sm1->smtpSetup("", "", "", "");
$sm1->component = "SMTP";
$sm1->tmpFolder = "";
$sm1->embedImages = false;
$sm1->progressBar = "";
$sm1->ignore_errors = true;
if (count($HTTP_POST_VARS) > 0) {
  @set_time_limit(300);
  $sm1->setFrom(((isset($_POST["name"]))?$_POST["name"]:""), ((isset($_POST["email"]))?$_POST["email"]:""));
  $sm1->setTo(((isset($_POST["friend_name"]))?$_POST["friend_name"]:""), ((isset($_POST["friend_email"]))?$_POST["friend_email"]:""));
  $sm1->setCc("", "");
  $sm1->setBcc("", "");
  $sm1->setSubject("Watches 24 website");
  // using static for body
  $sm1->setBody_Static_html("Your friend sent the following message about the website www.watches24.co.uk:\n\nFriend's Name: ".((isset($_POST["name"]))?$_POST["name"]:"")."\nFriend's Email: ".((isset($_POST["email"]))?$_POST["email"]:"")."\n\nMessage:\n\n".((isset($_POST["message"]))?$_POST["message"]:"")."\n\n\n\n-- end of message --");
  // Attachments none
  $sm1->sendMail("one");
  $GoTo = "tell_a_friend_new.php?message=sent";
  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $GoTo .= (strpos($GoTo, '?')) ? "&" : "?";
  $GoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $GoTo));
}
$SM_mailAction = getMailAction();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Watches 24</title>
<link href="stylesheet1.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="ScriptLibrary/rotator/wt-rotator.css"/>
<link rel="stylesheet" href="ScriptLibrary/megamenu/stylesheets/jquery.megamenu.css" type="text/css" media="screen" />
<link rel="stylesheet" href="ScriptLibrary/megamenu/stylesheets/example.css" type="text/css" media="screen" />
<script type="text/javascript" src="ScriptLibrary/jquery-1.4.2.min.js"></script>
<script src="ScriptLibrary/megamenu/javascripts/jquery.megamenu.js" type="text/javascript"></script>
<script type="text/javascript">
	jQuery(function(){
		var SelfLocation = window.location.href.split('?');
		switch (SelfLocation[1]) {
			case "justify_right":
				jQuery(".megamenu").megamenu({ 'justify':'right' });
				break;
			case "justify_left":
			default:
				jQuery(".megamenu").megamenu();
		}
	});
</script>
<script type="text/javascript" src="ScriptLibrary/rotator/js/jquery.easing.1.3.min.js"></script>
<script type="text/javascript" src="ScriptLibrary/rotator/js/jquery.wt-rotator.min.js"></script>
<script src="ScriptLibrary/swfobject_modified.js" type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(	
		function() {
			$(".container").wtRotator({
				width:596,
				height:274,
				button_width:16,
				button_height:16,
				button_margin:15,
				auto_start:true,
				delay:5000,
				play_once:false,
				transition:"fade",
				transition_speed:800,
				auto_center:true,
				easing:"",
				cpanel_position:"inside",
				cpanel_align:"BR",
				timer_align:"top",
				display_thumbs:true,
				display_dbuttons:false,
				display_playbutton:false,
				display_numbers:true,
				display_timer:false,
				mouseover_pause:false,
				cpanel_mouseover:false,
				text_mouseover:false,
				text_effect:"fade",
				text_sync:true,
				tooltip_type:"image",
				lock_tooltip:true,
				shuffle:false,
				block_size:75,
				vert_size:55,
				horz_size:50,
				block_delay:25,
				vstripe_delay:75,
				hstripe_delay:180			
			});
		}
	);
</script>   
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-24634598-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>

<body>
<div id="wrapper">
  <div id="innerwrapper">
    <div id="header"><a href="index.php" title="Home Page"><img src="images/w24_logo.jpg" alt="Watches 24" name="w24_logo" width="269" height="85" id="w24_logo" /></a>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="95" height="95" id="header_clock" title="Watches_24">
        <param name="movie" value="header_clock_1.swf" />
        <param name="quality" value="high" />
        <param name="wmode" value="opaque" />
        <param name="swfversion" value="6.0.65.0" />
        <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
        <param name="expressinstall" value="ScriptLibrary/expressInstall.swf" />
        <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="header_clock_1.swf" width="95" height="95">
          <!--<![endif]-->
          <param name="quality" value="high" />
          <param name="wmode" value="opaque" />
          <param name="swfversion" value="6.0.65.0" />
          <param name="expressinstall" value="ScriptLibrary/expressInstall.swf" />
          <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
          <div>
            <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
            <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
          </div>
          <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
      </object>
      <ul id="header_menu">
        <li><a href="index.php" class="selected">Home</a></li>
        <li><a href="contact_us.php">Contact Us</a></li>
        <li class="last"><a href="site_map.php">Site Map</a></li>
      </ul>
      <div id="phone_number">
      	<p class="smaller_text">Call us now on:</p>
      	<p>02825 631 380 </p>
        <p class="smaller_text">we are open monday to friday 9am-5pm</p>
			</div>
      <div id="quick_cart">
        <p class="email_link"><a href="mailto:info@watches24.co.uk">info@watches24.co.uk</a></p>
        <h2>Shopping Basket</h2>
        <p><?php echo $eCart1->TotalColumn("Quantity"); ?> items - <strong><?php echo WA_eCart_DisplayMoney($eCart1, $eCart1->GrandTotal()); ?></strong></p>
        <div class="eC_Simple_Slate_Arial eC_Simple_Slate_Arial_QuickCart">
          <form action="ecart.php" method="post">
          	<input class="ecart_button" name="eCart1_View_100" type="submit" id="eCart1_View_100" onclick="MM_goToURL('parent','');" value="View Basket"  />
          </form>
           
        </div>
<!--
        <p>Items in Cart: 12</p>
        <p>Cart Total: £63,000.00</p>
        <p class="view_cart"><a href="cart.php">View Cart</a></p>
        -->
      </div>
    </div>
    <div id="menu_bar">
    	<ul class="megamenu">
        <li>
          <a href="javascript:void(0)">A-Z by Brand</a>
          <div style="width: 200px;">
            <ul id="list-content">
              <?php do { ?>
                <li><a href="watch_brand.php?watchbrandid=<?php echo $row_rs_watches_atoz['watchbrandid']; ?>" title="<?php echo $row_rs_watches_atoz['watchbrand']; ?> Watches"><?php echo $row_rs_watches_atoz['watchbrand']; ?> <span class="watch_count">[<?php echo $row_rs_watches_atoz['watchcount']; ?>]</span></a></li>
              <?php } while ($row_rs_watches_atoz = mysql_fetch_assoc($rs_watches_atoz)); ?>
            </ul>
          </div>
        </li>
        <li>
          <a href="javascript:void(0)">Gents Watches</a>
          <div style="width: 200px;">
            <ul id="list-content">
              <?php do { ?>
                <li><a href="watch_brand.php?watchbrandid=<?php echo $row_rs_watches_gents['watchbrandid']; ?>&gender_id=1" title="<?php echo $row_rs_watches_gents['watchbrand']; ?> Watches (Gents)"><?php echo $row_rs_watches_gents['watchbrand']; ?> <span class="watch_count">[<?php echo $row_rs_watches_gents['watchcount']; ?>]</span></a></li>
              <?php } while ($row_rs_watches_gents = mysql_fetch_assoc($rs_watches_gents)); ?>
            </ul>
          </div>
        </li>
        <li>
          <a href="javascript:void(0)">Ladies Watches</a>
          <div style="width: 200px;">
            <ul id="list-content">
              <?php do { ?>
                <li><a href="watch_brand.php?watchbrandid=<?php echo $row_rs_watches_ladies['watchbrandid']; ?>&gender_id=2" title="<?php echo $row_rs_watches_ladies['watchbrand']; ?> Watches (Ladies)"><?php echo $row_rs_watches_ladies['watchbrand']; ?> <span class="watch_count">[<?php echo $row_rs_watches_ladies['watchcount']; ?>]</span></a></li>
              <?php } while ($row_rs_watches_ladies = mysql_fetch_assoc($rs_watches_ladies)); ?>
            </ul>
          </div> </li>
        <li>
          <a href="javascript:void(0)">Information</a>
          <div style="width: 200px;">
            <ul id="list-content">
              <li><a href="about_us.php" title="About us">About us</a></li>
              <li><a href="why_us.php" title="Why Us?">Why Us?</a></li>
              <li><a href="faqs.php" title="Frequently Asked Qustions"><acronym title="Frequently Asked Qustions" lang="en">FAQs</acronym></a></li>
              <li><a href="tell_us_what_your_after.php" title="Can't find the watch you're looking for?">Can't find the watch you're looking for?</a></li>
              <li><a href="glossary_of_terms.php" title="Glossary of Terms">Glossary of Terms</a></li>
              <li><a href="types_of_movement.php" title="Types of Movement">Types of Movement</a></li>
              <li><a href="delivery_returns_and_refunds.php" title="Delivery, Returns and Refunds">Delivery, Returns and Refunds</a></li>
              <li><a href="wee_regulations.php" title="WEEE regulations">WEEE regulations</a></li>
              <li><a href="shipping_locations.php" title="Shipping Locations">Shipping Locations</a></li>
              <li><a href="watch_buying_guide.php" title="Watch Buying Guide">Watch Buying Guide</a></li>
              <li><a href="free_bracelet_adjustment.php" title="Free Bracelet Adjustment">Free Bracelet Adjustment</a></li>
              <li><a href="lifetime_warranty.php" title="Lifetime Warranty">Lifetime Warranty</a></li>
              <li><a href="contact_us.php" title="Contact Us">Contact Us</a></li>
              <li><a href="servicing_and_repair.php" title="Servicing and Repairs">Servicing and Repairs</a></li>
              <li><a href="refurbishments.php" title="Refurbishments">Refurbishments</a></li>
              <li><a href="battery_replacement.php" title="Battery Replacement">Battery Replacement</a></li>
              <li><a href="affiliate_offers.php" title="Affiliate Offers">Affiliate Offers</a></li>
            </ul>
          </div>
        </li>
        <li class="no_dropdown">
          <a href="sell_your_watch.php" title="Sell Your Watch">Sell Your Watch</a>
        </li>
        <li class="no_dropdown">
          <a href="about_us.php" title="About us">About us</a>
        </li>
        <li class="no_dropdown">
          <a href="why_us.php" title="Why Us?">Why Us?</a>
        </li>
      </ul>
      <form id="quicksearch" name="quicksearch" method="get" action="watch_search_results.php">
        Find:
       <input name="searchbox" type="text" id="searchbox" value="" />
        <input type="submit" name="search_now" id="search_now" value="Search" />
      </form>
    </div>
    <div id="content_area" class="infopage">
    	<h1>Tell a Friend</h1>
      <?php if ($_GET['message']=='sent') { ?>
        <div class="message_sent">
          <p><strong>Thank You</strong></p>
          <p>Your friend has been sent an email telling them about our site. We appreciate your support and hope that we can help them find the watch they desire.</p>
        </div>
      <?php } ?>
    	<p>Use the form below to tell your friends about our website.    	</p>
    	<form action="<?php echo $SM_mailAction; ?>" method="post" name="form1" class="enquiry_form" id="form1">
        <p>
          <label for="name">Your Name</label>
          <input name="name" type="text" id="name" size="50" />
        </p>
        <p>
          <label for="email">Your Email</label>
          <input name="email" type="text" id="email" size="50" />
        </p>
        <p>
          <label for="friend_name">Friend's Name</label>
          <input name="friend_name" type="text" id="friend_name" size="50" />
        </p>
        <p>
          <label for="friend_email">Friend's Email</label>
          <input name="friend_email" type="text" id="friend_email" size="50" />
        </p>
        <p>
          <label for="message">Message</label>
          <textarea name="message" cols="90" rows="8" id="message"></textarea>
        </p>
        <p class="indented">
	        <?php echo $theCAPTCHA->GetControl("blackglass","en"); ?>
        </p>
        <p class="indented">
          <input type="submit" name="submit" id="submit" value="Send Enquiry" />
        </p>
      </form>
      <p>&nbsp;</p>
    </div>
    <div id="sharing_bar">
      <ul class="text_links">
        <li><a href="email_signup.php">email signup</a></li>
        <li><a href="tell_a_friend.php">email to a friend</a></li>
        <li><a href="sell_your_watch.php">sell your watch</a></li>
      </ul>
      <div id="share_logos"><a href="http://www.facebook.com/?sk=lf#!/pages/Watches-24/148074481930425?v=wall"><img src="icons/social_facebook_box_blue.png" width="24" height="24" alt="" /></a><a href="http://twitter.com/watches24"><img src="icons/social_twitter_box_blue.png" width="24" height="24" alt="" /></a></div>
      <div id="home_fb">
        <div id="fb-root"></div>
        <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
        <fb:like href="http://www.watches24.co.uk" send="true" width="400" show_faces="false" colorscheme="dark" font="verdana"></fb:like>
      </div>
    </div>
    <div id="footer_menu">
      <ul>
        <li><a href="why_us.php" title="Why Us?">Why Us?</a></li>
        <li><a href="faqs.php" title="Frequently Asked Qustions"><acronym title="Frequently Asked Qustions" lang="en">FAQs</acronym></a></li>
        <li><a href="tell_us_what_your_after.php" title="Can't find the watch?">Can't find the watch?</a></li>
        <li><a href="glossary_of_terms.php" title="Glossary of Terms">Glossary of Terms</a></li>
      </ul>
      <ul>
        <li><a href="types_of_movement.php" title="Types of Movement">Types of Movement</a></li>
        <li><a href="delivery_returns_and_refunds.php" title="Delivery, Returns and Refunds">Delivery, Returns and Refunds</a></li>
        <li><a href="wee_regulations.php" title="WEEE regulations">WEEE regulations</a></li>
        <li><a href="shipping_locations.php" title="Shipping Locations">Shipping Locations</a></li>
      </ul>
      <ul>
        <li><a href="watch_buying_guide.php" title="Watch Buying Guide">Watch Buying Guide</a></li>
        <li><a href="free_bracelet_adjustment.php" title="Free Bracelet Adjustment">Free Bracelet Adjustment</a></li>
        <li><a href="lifetime_warranty.php" title="Lifetime Warranty">Lifetime Warranty</a></li>
        <li><a href="about_us.php" title="About us<">About us</a></li>
      </ul>
      <ul>
        <li><a href="contact_us.php" title="Contact Us">Contact Us</a></li>
        <li><a href="servicing_and_repair.php" title="Servicing and Repairs">Servicing and Repairs</a></li>
        <li><a href="refurbishments.php" title="Refurbishments">Refurbishments</a></li>
        <li><a href="battery_replacement.php" title="Battery Replacement">Battery Replacement</a></li>	
      </ul>
      <ul>
        <li><a href="affiliate_offers.php" title="Affiliate Offers">Affiliate Offers</a></li>
        <li><a href="privacy.php">Privacy</a></li>
        <li><a href="terms_and_conditions.php">Terms and Conditions</a></li>
        <li><a href="site_map.php">Site Map</a></li>
      </ul>
    <div class="clearing"></div>
    </div>
    <div id="footer_brand_list">
    	<?php mysql_data_seek($rs_watches_atoz, 0); ?>
      <ul>
      	<?php do { ?>
          <li><a href="watch_brand.php?watchbrandid=<?php echo $row_rs_watches_atoz['watchbrandid']; ?>" title="<?php echo $row_rs_watches_atoz['watchbrand']; ?> Watches"><?php echo $row_rs_watches_atoz['watchbrand']; ?></a></li>
        <?php } while ($row_rs_watches_atoz = mysql_fetch_assoc($rs_watches_atoz)); ?>
      </ul>
    </div>
  </div>
</div>
<script type="text/javascript">
<!--
swfobject.registerObject("header_clock");
//-->
</script>
</body>
</html>
<?php
mysql_free_result($rs_watches_atoz);

mysql_free_result($rs_watches_gents);

mysql_free_result($rs_watches_ladies);
?>



Replies

Replied 03 Dec 2011 01:06:03
03 Dec 2011 01:06:03 R W replied:
As the DMXZone reCapture "dmxReCAPTCHA.php" files are the same for all of us (unless you had a fiddle with it) I only had to quickly remark out all the php calls in the code that caused warnings or fatal exceptions and change the require path to my library.

Bottom line, your code as is DOES contact and activate (display) the Google reCapture object on the page as it should and even responds to an error input by showing the red "Incorrect. Try again." text on the object when the page re-displays.

Therefore I can assume your problems are apparently with the mySQL or other php calls and / or layout functioning, not the reCapture. You perhaps need to do some staged debugging.

HAVING SAID THAT, what of the returned "$mm_abort_edit" var. It is that your form validation should be using to change programming logic pathways; it appears to be missing!!!!

Regards.

Edited by - R W on 03 Dec 2011  01:26:33
Replied 05 Dec 2011 09:40:44
05 Dec 2011 09:40:44 Teodor Kuduschiev replied:
Hello Bruce,
What is the page address your form is inserted on and are you redirecting to another page within the smart mailer configuration window?

Reply to this topic