8 Replies - 2298 Views - Last Post: 15 October 2012 - 09:17 AM Rate Topic: -----

#1 IrishDoc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-October 12

Trying to use captcha snippet, Help Please

Posted 12 October 2012 - 10:09 AM

I am using the snippet on this page http://www.dreaminco...snippet3567.htm I have added everything correctly and even added a refresh button for the captcha but the captcha is allowing all messages to be sent without verification at all. Have I missed something? Please help?!?!
Is This A Good Question/Topic? 0
  • +

Replies To: Trying to use captcha snippet, Help Please

#2 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5224
  • View blog
  • Posts: 26,990
  • Joined: 10-May 07

Re: Trying to use captcha snippet, Help Please

Posted 12 October 2012 - 10:41 AM

View PostIrishDoc, on 12 October 2012 - 01:09 PM, said:

I have added everything correctly

It's not really possible to help if we just take your word that it's added correctly. There's no magical catch-phrase we can spout off that allows it to suddenly work.

Please show us the code you have in place, & we'll do our best to troubleshoot it with you.
Was This Post Helpful? 0
  • +
  • -

#3 IrishDoc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-October 12

Re: Trying to use captcha snippet, Help Please

Posted 12 October 2012 - 04:48 PM

OK here is the code. It has been adjusted for wordpress.

<?php session_start(); ?>
<!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" dir="ltr" lang="en-US">

<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>Quote Request &mdash;  Swat Solutions</title>

<link rel="stylesheet" href="http://swatbeta.brilliantbulb.com/wp-content/themes/swat/style.css" type="text/css" media="screen" />
<link rel="pingback" href="http://swatbeta.brilliantbulb.com/xmlrpc.php" />

<!--[if IE 6]>
<style type="text/css">
#page {width: expression(document.body.clientWidth < 960 ? "960": "auto" );}
</style>
<![endif]-->


<meta name='robots' content='noindex,nofollow' />
<link rel='stylesheet' id='admin-bar-css'  href='http://swatbeta.brilliantbulb.com/wp-includes/css/admin-bar.css?ver=20110122' type='text/css' media='all' />
<script type='text/javascript' src='http://swatbeta.brilliantbulb.com/wp-includes/js/l10n.js?ver=20101110'></script>
<script type='text/javascript' src='http://swatbeta.brilliantbulb.com/wp-includes/js/comment-reply.js?ver=20090102'></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://swatbeta.brilliantbulb.com/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://swatbeta.brilliantbulb.com/wp-includes/wlwmanifest.xml" /> 
<link rel='index' title='Swat Solutions' href='http://swatbeta.brilliantbulb.com/' />
<link rel='up' title='Contact' href='http://swatbeta.brilliantbulb.com/contact/' />
<link rel='prev' title='WHQL Pre-Certification' href='http://swatbeta.brilliantbulb.com/practice-areas/whql-pre-certification/' />
<link rel='next' title='Careers' href='http://swatbeta.brilliantbulb.com/careers/' />
<meta name="generator" content="WordPress 3.1" />
<link rel='canonical' href='http://swatbeta.brilliantbulb.com/contact/request-info/' />
<style type="text/css" media="print">#wpadminbar { display:none; }</style>
<style type="text/css">
	html { margin-top: 28px !important; }
	* html body { margin-top: 28px !important; }
</style>
<!-- LOAD JQUERY FROM GOOGLE CDN -->
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
  google.load("jquery", "1.3.2");
</script>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://swatbeta.brilliantbulb.com/wp-content/themes/swat/js/jquery.easing.1.3.js"></script>


<script type="text/javascript" src="http://swatbeta.brilliantbulb.com/wp-content/themes/swat/js/AC_FL_RunContent.js"></script>


<script type="text/javascript">
$(document).ready(function() {
	var autoPlayTime=18000;
	autoPlayTimer = setInterval( autoPlay, autoPlayTime);
	function autoPlay(){
		Slidebox('next');
	}
	$('#slidebox .next').click(function () {
		Slidebox('next','stop');
	});
	$('#slidebox .previous').click(function () {
		Slidebox('previous','stop');
	});
	var yPosition=($('#slidebox').height()-$('#slidebox .next').height())/2;
	$('#slidebox .next').css('top',yPosition);
	$('#slidebox .previous').css('top',yPosition);
	$('#slidebox .thumbs a:first-child').removeClass('thumb').addClass('selected_thumb');
	$("#slidebox .content").each(function(i){
		slideboxTotalContent=i*$('#slidebox').width();	
		$('#slidebox .container').css("width",slideboxTotalContent+$('#slidebox').width());
	});
});

function Slidebox(slideTo,autoPlay){
    var animSpeed=3000; //animation speed
    var easeType='easeInOutExpo'; //easing type
	var sliderWidth=$('#slidebox').width();
	var leftPosition=$('#slidebox .container').css("left").replace("px", "");
	if( !$("#slidebox .container").is(":animated")){
		if(slideTo=='next'){ //next
			if(autoPlay=='stop'){
				clearInterval(autoPlayTimer);
			}
			if(leftPosition==-slideboxTotalContent){
				$('#slidebox .container').animate({left: 0}, animSpeed, easeType); //reset
				$('#slidebox .thumbs a:first-child').removeClass('thumb').addClass('selected_thumb');
				$('#slidebox .thumbs a:last-child').removeClass('selected_thumb').addClass('thumb');
			} else {
				$('#slidebox .container').animate({left: '-='+sliderWidth}, animSpeed, easeType); //next
				$('#slidebox .thumbs .selected_thumb').next().removeClass('thumb').addClass('selected_thumb');
				$('#slidebox .thumbs .selected_thumb').prev().removeClass('selected_thumb').addClass('thumb');
			}
		} else if(slideTo=='previous'){ //previous
			if(autoPlay=='stop'){
				clearInterval(autoPlayTimer);
			}
			if(leftPosition=='0'){
				$('#slidebox .container').animate({left: '-'+slideboxTotalContent}, animSpeed, easeType); //reset
				$('#slidebox .thumbs a:last-child').removeClass('thumb').addClass('selected_thumb');
				$('#slidebox .thumbs a:first-child').removeClass('selected_thumb').addClass('thumb');
			} else {
				$('#slidebox .container').animate({left: '+='+sliderWidth}, animSpeed, easeType); //previous
				$('#slidebox .thumbs .selected_thumb').prev().removeClass('thumb').addClass('selected_thumb');
				$('#slidebox .thumbs .selected_thumb').next().removeClass('selected_thumb').addClass('thumb');
			}
		} else {
			var slide2=(slideTo-1)*sliderWidth;
			if(leftPosition!=-slide2){
				clearInterval(autoPlayTimer);
				$('#slidebox .container').animate({left: -slide2}, animSpeed, easeType); //go to number
				$('#slidebox .thumbs .selected_thumb').removeClass('selected_thumb').addClass('thumb');
				var selThumb=$('#slidebox .thumbs a').eq((slideTo-1));
				selThumb.removeClass('thumb').addClass('selected_thumb');
			}
		}
	}
}
</script>

</head>


<body class="page page-id-65 page-child parent-pageid-18 page-template page-template-default logged-in admin-bar">

<div id="page">

	<div id="header">
		<h1 id="logo"><a href="http://swatbeta.brilliantbulb.com/">Swat Solutions</a></h1>
	</div>
	<div id="content" class="clearcontents">
		<div id="banner">
		<img width="960" height="200" src="http://swatbeta.brilliantbulb.com/wp-content/uploads/2011/04/banner_6int.jpg" class="attachment-original" alt="banner_6int" title="banner_6int" />	</div>
	<div class="primary-nav-container"><ul id="primary-nav" class="menu"><li id="menu-item-132" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-132"><a href="http://swatbeta.brilliantbulb.com/">Home</a></li>
<li id="menu-item-141" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-141"><a href="http://swatbeta.brilliantbulb.com/practice-areas/">Practice Areas</a>
<ul class="sub-menu">
	<li id="menu-item-143" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-143"><a href="http://swatbeta.brilliantbulb.com/practice-areas/qa-service-overview/">QA Service Overview</a></li>
	<li id="menu-item-135" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-135"><a href="http://swatbeta.brilliantbulb.com/practice-areas/manual-functional-testing/">Manual Functional Testing</a></li>
	<li id="menu-item-142" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-142"><a href="http://swatbeta.brilliantbulb.com/practice-areas/qa-assessment/">QA Assessment</a></li>
	<li id="menu-item-151" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-151"><a href="http://swatbeta.brilliantbulb.com/practice-areas/test-automation/">Test Automation</a></li>
	<li id="menu-item-154" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-154"><a href="http://swatbeta.brilliantbulb.com/practice-areas/load-performance/">Load Performance</a></li>
	<li id="menu-item-152" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-152"><a href="http://swatbeta.brilliantbulb.com/practice-areas/compatibilitylocalization/">Compatibility/Localization</a></li>
	<li id="menu-item-160" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-160"><a href="http://swatbeta.brilliantbulb.com/practice-areas/fda-software-validation/">FDA Software Validation</a></li>
	<li id="menu-item-162" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-162"><a href="http://swatbeta.brilliantbulb.com/practice-areas/whql-pre-certification/">WHQL Pre-Certification</a></li>
	<li id="menu-item-223" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-223"><a href="http://swatbeta.brilliantbulb.com/practice-areas/windows-software-logo-program/">Windows Software Testing</a></li>
</ul>
</li>
<li id="menu-item-133" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-133"><a href="http://swatbeta.brilliantbulb.com/about-swat/">About SWAT</a>
<ul class="sub-menu">
	<li id="menu-item-153" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-153"><a href="http://swatbeta.brilliantbulb.com/about-swat/leadership/">Leadership</a></li>
	<li id="menu-item-147" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-147"><a href="http://swatbeta.brilliantbulb.com/about-swat/delivery-models/">Delivery Models</a></li>
	<li id="menu-item-632" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-632"><a href="http://swatbeta.brilliantbulb.com/about-swat/press/">News and Events</a></li>
</ul>
</li>
<li id="menu-item-157" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-157"><a href="http://swatbeta.brilliantbulb.com/about-swat/case-studies/">Case Studies</a></li>
<li id="menu-item-161" class="menu-item menu-item-type-post_type menu-item-object-page current-page-ancestor current-menu-ancestor current-menu-parent current-page-parent current_page_parent current_page_ancestor menu-item-161"><a href="http://swatbeta.brilliantbulb.com/contact/">Contact</a>
<ul class="sub-menu">
	<li id="menu-item-144" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-65 current_page_item menu-item-144"><a href="http://swatbeta.brilliantbulb.com/contact/request-info/">Quote Request</a></li>
	<li id="menu-item-149" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-149"><a href="http://swatbeta.brilliantbulb.com/contact/map-directions/">Map & Directions</a></li>
</ul>
</li>
<li id="menu-item-131" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-131"><a href="http://swatbeta.brilliantbulb.com/careers/">Careers</a></li>
</ul></div>
	
			
		
		
		<div id="content-main" class="left" style="width:920px;border:none;">

			
				
				<div class="post-65 page type-page status-publish hentry" id="post-65">
					
											<h2 id="request-info">Quote Request | <a class="post-edit-link" href="http://swatbeta.brilliantbulb.com/wp-admin/post.php?post=65&amp;action=edit" title="Edit Page">Edit</a></h2>		
						<div class="entry">
							<p>You know what needs to be tested, but price is always a consideration. Request a quote from SWAT and let us show you how cost effective we can be. We have the staff and the test environments to quickly engage with your project.</p>
<p>Please provide the following information and we will contact you within one business day.</p>
<p>Contact Information *(Required Field)</p>
<script type="text/javascript">
function formCheck() {
var passed = false;
with (document.Request) {
if (name.value == "") {
alert("Please enter your full name.");
name.focus();
}
else if (email.value == "") {
alert("Please enter your email address.");
email.focus();
}
else if (phone.value == "") {
alert("Please include a phone number you wish to be contacted at.");
phone.focus();
}
else if (project_description.value == "") {
alert("Please provide an outline for your project.");
project_description.focus();
}
else if (project_timeline.value == "") {
alert("Please describe any benchmark deadlines/goals for timeline.");
project_timeline.focus();
}
else {
passed = true;
}
}
return passed;
}
</script>
<fieldset>
<form name="Request" method="post" onsubmit="return formCheck();" action="/quote.php">
<ol>
<li class="clearcontents">
<label class="left">Your Name *</label>
<input class="left text-input" type="text" name="name"/>
</li>
<li class="clearcontents">
<label class="left">Your Email *</label>
<input class="left text-input" type="text" name="email"/>
</li>
<li class="clearcontents">
<label class="left">Your Phone Number *</label>
<input class="left text-input" type="text" name="phone"/>
</li>
<li class="clearcontents">
<label class="left">Please Describe Project *</label>
<textarea class="left" name="project_description"></textarea>
</li>
<li class="clearcontents">
<label class="left">Timeline for your project *</label>
<textarea class="left" name="project_timeline"></textarea>
</li>
<li class="clearcontents">
<label class="left"></label>
Please confirm the letters in the image
</li>
<li class="clearcontents">
<label class="left"></label>
* All letters are case sensitive *
</li>
<li class="clearcontents">
<label class="left"></label>
<img id="captchaImg" src="captcha/captcha.php"/>
<img src="captcha/refresh.jpg" onclick="javascript:document.getElementById([\'captchaImg\']).src=[\'captcha/captcha.php?rand=\']+new Date().getTime();" />
</li>
<li class="clearcontents">
<label class="left"></label>
Confirm Letters:
<input type="text" id="tt_pass" name="tt_pass" style="width:100px;" maxlength="5"/>
</li>
<li class="clearcontents">
<label class="left">&nbsp;</label>
<input class="left" type="submit" value="Submit">
</li>
</ol>
</form>
</fieldset>
						</div>
										
				</div>
	
				
			<div class="navigation">
				<div class="alignleft"></div>
				<div class="alignright"></div>
			</div>
	
			
		</div>
		
		
				
		
	</div>


	<div id="footer" valign="bottom">
		<p>
        
        
		<div class="left" align="left">
                <p>&copy; 2011, SWAT Solutions, Inc. &nbsp; Phone: (952) 500-6000 &nbsp; Toll Free: (800) 980-SWAT (7928) &nbsp; Email: <a href="mailto:info@swatsolutions.com">info@swatsolutions.com</a></p>
                </div>
        	<div  align="right">
                <p><a href="http://twitter.com/@SWATsolutions" target="_blank"><img class="bottom" src="/wp-content/themes/swat/images/icon_twitter.gif" width="28" height="29" border="0" alt="Visit us on Twitter"></a> &nbsp; <a href="http://www.facebook.com/pages/SWAT-Solutions-Inc/103733846341604" target="_blank"><img class="bottom" src="/wp-content/themes/swat/images/icon_facebook.gif" width="28" height="29" border="0" alt="Visit us on Facebook"></a> &nbsp; <a href="http://www.linkedin.com/companies/30871?trk=NUS_CMPE-updater" target="_blank"><img class="bottom" src="/wp-content/themes/swat/images/icon_linkedin.gif" width="28" height="29" border="0" alt="Visit us on LinkedIn"></a></p>
                </div>
        
        </p>
	</div>

<script type='text/javascript' src='http://swatbeta.brilliantbulb.com/wp-includes/js/admin-bar.js?ver=20110131'></script>
		<div id="wpadminbar">
			<div class="quicklinks">
				<ul>
													
		<li id="wp-admin-bar-my-account-with-avatar" class="menupop">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/profile.php"><span><img alt='' src='http://0.gravatar.com/avatar/04b656d980f3e736434114542564ca65?s=16&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D16&amp;r=G' class='avatar avatar-16 photo' height='16' width='16' />irishdoc</span></a>

						<ul>
											
		<li id="wp-admin-bar-edit-my-profile" class="">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/profile.php">Edit My Profile</a>

			
					</li>											
		<li id="wp-admin-bar-dashboard" class="">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/">Dashboard</a>

			
					</li>											
		<li id="wp-admin-bar-log-out" class="">
			<a href="http://swatbeta.brilliantbulb.com/wp-login.php?action=logout&_wpnonce=a575bb99e2">Log Out</a>

			
					</li>							</ul>
			
					</li>													
		<li id="wp-admin-bar-edit" class="">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/post.php?post=65&action=edit">Edit Page</a>

			
					</li>													
		<li id="wp-admin-bar-new-content" class="menupop">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/post-new.php?post_type=post"><span>Add New</span></a>

						<ul>
											
		<li id="wp-admin-bar-new-post" class="">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/post-new.php?post_type=post">Post</a>

			
					</li>											
		<li id="wp-admin-bar-new-page" class="">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/post-new.php?post_type=page">Page</a>

			
					</li>							</ul>
			
					</li>													
		<li id="wp-admin-bar-comments" class="">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/edit-comments.php">Comments </a>

			
					</li>													
		<li id="wp-admin-bar-appearance" class="menupop">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/themes.php"><span>Appearance</span></a>

						<ul>
											
		<li id="wp-admin-bar-menus" class="">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/nav-menus.php">Menus</a>

			
					</li>							</ul>
			
					</li>													
		<li id="wp-admin-bar-updates" class="">
			<a href="http://swatbeta.brilliantbulb.com/wp-admin/update-core.php"><span title='1 Plugin Update, 1 Theme Update'>Updates <span id='ab-updates' class='update-count'>2</span></span></a>

			
					</li>									</ul>
			</div>

			<div id="adminbarsearch-wrap">
				<form action="http://swatbeta.brilliantbulb.com" method="get" id="adminbarsearch">
					<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />
					<input type="submit" class="adminbar-button" value="Search"/>
				</form>
			</div>
		</div>

		</body>
</html>



And the captcha.php code from the snippet

<?php 
// this part should be saved as captcha.php
// best usage is to put this file with 5 random TTF font files in a folder named captcha
// for easy access and simplicity of use

	// Captcha script for GD > 2.0

/* 		Few notes about this script

	the width and height are measured in px so adjust according to your desire
	most variables in the variable section control the entire script so no editing below them should be needed
	the session variable $_SESSION['tt_pass'] is what holds the pass in the session can be changed on line 45

*/


/********************VARIABLES FOR THIS SCRIPT********************/
/*********SHOULD BE THE ONLY THING YOU HAVE TO CHANGE*********/

$pass_length = 5;					// passphrase length	
$make_upper = true;					// all upper case letters in image? true or false
$width = 200; $height = 60;			// image dimensions
$font_path = dirname(__FILE__);		// TTF font @ only change this if you relocate the TTF files!
$dark_font = true;					// if you want it easier to read, side effect bots can read it easier as well  true or false	
	
/********************END VARIABLES FOR SCRIPT********************/
/*********         EDIT BELOW THIS AT YOUR OWN RISK :)/>           *********/





	
// create a passphrase  ** it is case sensitive!!! **
	session_start();
	$passwd = '';
	$i = 0;
	
		while ($i < $pass_length) {
			$passwd .= chr(rand(97, 122));
			$i++;
		}
		
	if ($make_upper) {
		$passwd = strtoupper($passwd);
	}

// store the passphrase
	$_SESSION['tt_pass'] = $passwd;
	
// get available fonts
	$fonts = array();
	
		if ($handle = opendir($font_path)) {
			while (false !== ($file = readdir($handle))) {
				if (substr(strtolower($file), -4, 4) == '.ttf') {
					$fonts[] = $font_path.'/'.$file;
				}
			}
		}
		if (count($fonts) < 1) {
			die('No Fonts Found!!!');
		}

// image header
	header("Content-Type: image/jpeg");

// clear the cache
	header("Expires: Fri, 09 Jan 2008 05:00:00 GMT");
	header("Last-Modified: ".gmdate("D, d M Y H:i:s")."GMT");
	header("Cache-Control: no-store, no-cache, must-revalidate");
	header("Cache-Control: post-check=0, pre-check=0", false);
	header("Pragma: no-cache");
	
// create image
	$img = imagecreatetruecolor($width, $height);
	
// fill background with random shade of pastel
	$bg = imagecolorallocate($img, rand(210, 255), rand(210, 255), rand(210, 255));
	
// draw rectangle
	imagefilledrectangle($img, 0, 0, $width, $height, $bg);

// make the background jaggedy with differnet colored polygons
	$right = rand(10, 30);
	$left = 0;
	
		while ($left < $width) {
			$poly_points = array(
				$left, 0,
				$right, 0,
				rand($right-25, $right+25), $height,
				rand($left-15, $left+15), $height);
	
			$c = imagecolorallocate($img, rand(210, 255), rand(210, 255), rand(210, 255));
			imagefilledpolygon($img, $poly_points, 4, $c);
			
			$random_amount = rand(10, 30);
			$left += $random_amount;
			$right += $random_amount;
		}
		
// base range for lines
	$c_min = rand(150, 185);
	$c_max = rand(195, 280);
	
// draw vertical lines
	$left = 0;
		while ($left < $width) {
			$right = $left + rand(3, 7);
			$offset = rand(-3, 3);
			
			$line_points = array(
				$left, 0,
				$right, 0,
				$right + $offset, $height,
				$left + $offset, $height);
			
			$pc = imagecolorallocate($img, rand($c_min, $c_max),
										   rand($c_min, $c_max),
										   rand($c_min, $c_max));
			
			imagefilledpolygon($img, $line_points, 4, $pc);
			$left += rand(20, 60);
		}
	
// draw horisontal lines
	$top = 0;
		while ($top < $height) {
			$bottom = $top + rand(1, 4);
			$offset = rand(-6, 6);
			
			$line_points = array(
				0, $top,
				0, $bottom,
				$width, $bottom + $offset,
				$width, $top + $offset);
			$pc = imagecolorallocate($img, rand($c_min, $c_max),
										   rand($c_min, $c_max),
										   rand($c_min, $c_max));
			imagefilledpolygon($img, $line_points, 4, $pc);
			$top += rand(8, 15);
		}
		
// character spacing
	$spacing = $width/(strlen($passwd)+2);
	$x = $spacing;

// draw each character
	for ($i=0; $i < strlen($passwd); $i++) {
		$letter = $passwd[$i];
		$size = rand($height/3, $height/2);
		$rotation = rand(-30, 30);
		$y = rand($height * .90, $height - $size - 4);
	
	// random font	
		$font = $fonts[array_rand($fonts)];
	
	// color for letter
	if ($dark_font) {	
		$r = rand(0, 200); $g = rand(0, 200); $b = rand(0, 200);
	} else {
		$r = rand(100, 255); $g = rand(100, 255); $b = rand(100, 255);
	}
		
	// create letter and shadow colors
		$color = imagecolorallocate($img, $r, $g, $B)/>;
		$shadow = imagecolorallocate($img, $r/3, $g/3, $b/3);
		
	// draw the shadow than letter
		imagettftext($img, $size, $rotation, $x, $y, $shadow, $font, $letter);
		imagettftext($img, $size, $rotation, $x-1, $y-3, $color, $font, $letter);
	
	// space the letter
		$x += rand($spacing, $spacing * 1.5);
	}
	
	// clear the memory used to make the captcha image
	imagejpeg($img);
	imagedestroy($img);
?>


Here is the page that is being tested for the snippet http://swatbeta.bril...t/request-info/
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6048
  • View blog
  • Posts: 23,473
  • Joined: 23-August 08

Re: Trying to use captcha snippet, Help Please

Posted 13 October 2012 - 03:15 AM

You did not show us the code on the page to which you're submitting (the most important part, given the behavior you're experiencing), but did you forget this part?

Quote

On a submit page simply compare $_SESSION['tt_pass'] with $_POST['tt_pass'] to see if the submitter verified your letters.

Was This Post Helpful? 1
  • +
  • -

#5 IrishDoc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-October 12

Re: Trying to use captcha snippet, Help Please

Posted 13 October 2012 - 04:11 AM

I did forget that part. I am seriously new to wordpress and a friend asked me to implement a captcha on his forms for him on a site that was already built and to be honest I have no clue where to look to find the submit page code. Functions.php maybe?
Was This Post Helpful? 0
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6048
  • View blog
  • Posts: 23,473
  • Joined: 23-August 08

Re: Trying to use captcha snippet, Help Please

Posted 13 October 2012 - 04:23 AM

It's got nothing to do with WordPress, it's strictly PHP.

The page to which you're submitting is right here:

<form name="Request" method="post" onsubmit="return formCheck();" action="/quote.php">

Was This Post Helpful? 1
  • +
  • -

#7 IrishDoc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-October 12

Re: Trying to use captcha snippet, Help Please

Posted 13 October 2012 - 04:59 AM

I am pretty sure this is the code you are talking about, if it is can you please tell me where to put in the code or modify a certain line.

<?php

if ( function_exists( 'register_nav_menus' ) ) {
		register_nav_menus(
			array(
				'primary' => __( 'Primary Nav' )
			)
		);
	}

function get_element($name = false, $class = false) {

	global $post;

	if ($name) {

		include (TEMPLATEPATH . '/elements/' . $name . '.php');

	}

}



function add_last_class($input) {

	if( !empty($input) ) {



		$pattern = '/<li class="(?!.*<li class=")/is';

		$replacement = '<li class="last_item ';



		$input = preg_replace($pattern, $replacement, $input);



		echo $input;

	}

}

function get_width( $show_sidebar, $sidebar_width = 350 ) {
	
	$content_width = 960;
	$main_padding = 40;
	$border_width = 1;
	$main_width = $content_width - $main_padding;
	$sidebar_padding = 40;
	$sidebar_width = $sidebar_width + $sidebar_padding;
	if($show_sidebar) { $main_width = $main_width - $border_width - $sidebar_width; }
	
	return array('main'=>$main_width,'sidebar'=>$sidebar_width);
	
}





//insert list of child pages

function shortcode_list_pages($atts, $content, $tag) {

	global $post;

		

	// set defaults

	$defaults = array(

	    'class'       => $tag,

	    'depth'       => 0,

	    'show_date'   => '',

	    'date_format' => get_option('date_format'),

	    'exclude'     => '',

	    'child_of'    => 0,

	    'title_li'    => '',

	    'authors'     => '',

	    'sort_column' => 'menu_order, post_title',

	    'link_before' => '',

	    'link_after'  => '',

	    'exclude_tree'=> ''

	);

	

	// merge user provided atts with defaults

	$atts = shortcode_atts($defaults, $atts);

	

	// set necessary params

	$atts['echo'] = 0;

	if($tag == 'child-pages')

		$atts['child_of'] = $post->ID;	



	// create output

	$out = wp_list_pages($atts);

	if(!empty($out))

		$out = '<ul class="'.$atts['class'].'">' . $out . '</ul>';

	

  return $out;

}



add_shortcode('child-pages', 'shortcode_list_pages');

add_shortcode('list-pages', 'shortcode_list_pages');





//insert row div

function insert_row( $atts, $content = null ) {

	extract( shortcode_atts( array('width' => 'auto', 'margin' => '0'), $atts ) );

	$content = do_shortcode($content);

	return '<div class="row clearcontents" style="width:' . $width . ';margin:' . $margin .';">' . $content . '</div>';

}

add_shortcode('row', 'insert_row');



//insert text block

function insert_text_block( $atts, $content = null ) {

	extract( shortcode_atts( array('width' => 'auto', 'float' => 'none', 'padding' => '10px'), $atts ) );

	$content = do_shortcode($content);

	return '<div class="text-block" style="width:' . $width . ';float:' . $float . ';padding:' . $padding . '">' . $content . '</div>';

}

add_shortcode('text_block', 'insert_text_block');


//insert request form

function shortcode_swat_request_form() {

	

	$swat_form = array();



	$swat_form[] = '<script type="text/javascript">';

	$swat_form[] = 'function formCheck() {';
	
	$swat_form[] = 'var passed = false;';
	
	$swat_form[] = 'with (document.Request) {';
	
	$swat_form[] = 'if (name.value == "") {';
	
	$swat_form[] = 'alert("Please enter your full name.");';
	
	$swat_form[] = 'name.focus();';
	
	$swat_form[] = '}';
	
	$swat_form[] = 'else if (email.value == "") {';
	
	$swat_form[] = 'alert("Please enter your email address.");';
	
	$swat_form[] = 'email.focus();';
	
	$swat_form[] = '}';
	
	$swat_form[] = 'else if (phone.value == "") {';
	
	$swat_form[] = 'alert("Please include a phone number you wish to be contacted at.");';
	
	$swat_form[] = 'phone.focus();';
	
	$swat_form[] = '}';
	
	$swat_form[] = 'else if (project_description.value == "") {';
	
	$swat_form[] = 'alert("Please provide an outline for your project.");';
	
	$swat_form[] = 'project_description.focus();';
	
	$swat_form[] = '}';
	
	$swat_form[] = 'else if (project_timeline.value == "") {';
	
	$swat_form[] = 'alert("Please describe any benchmark deadlines/goals for timeline.");';
	
	$swat_form[] = 'project_timeline.focus();';
	
	$swat_form[] = '}';
	
	$swat_form[] = 'else {';
	
	$swat_form[] = 'passed = true;';
	
	$swat_form[] = '}';
	
	$swat_form[] = '}';
	
	$swat_form[] = 'return passed;';
	
	$swat_form[] = '}';
	

	$swat_form[] = '</script>';

	

	$swat_form[] = '<fieldset>';

	//$swat_form[] = '<legend>Quote Requests</legend>';

	$swat_form[] = '<form name="Request" method="post" onsubmit="return formCheck();" action="/quote.php">';

	$swat_form[] = '<ol>';

	$swat_form[] = '<li class="clearcontents">';

	$swat_form[] = '<label class="left">Your Name *</label>';

	$swat_form[] = '<input class="left text-input" type="text" name="name"/>';

	$swat_form[] = '</li>';

	$swat_form[] = '<li class="clearcontents">';

	$swat_form[] = '<label class="left">Your Email *</label>';

	$swat_form[] = '<input class="left text-input" type="text" name="email"/>';

	$swat_form[] = '</li>';

	$swat_form[] = '<li class="clearcontents">';	

	$swat_form[] = '<label class="left">Your Phone Number *</label>';

	$swat_form[] = '<input class="left text-input" type="text" name="phone"/>';

	$swat_form[] = '</li>';

	$swat_form[] = '<li class="clearcontents">';

	$swat_form[] = '<label class="left">Please Describe Project *</label>';

	$swat_form[] = '<textarea class="left" name="project_description"></textarea>';

	$swat_form[] = '</li>';

	$swat_form[] = '<li class="clearcontents">';

	$swat_form[] = '<label class="left">Timeline for your project *</label>';

	$swat_form[] = '<textarea class="left" name="project_timeline"></textarea>';

	$swat_form[] = '</li>';
	
	$swat_form[] = '<li class="clearcontents">';
	
	$swat_form[] = '<label>Please confirm the letters in the image</label>';

	$swat_form[] = '</li>';
	
	$swat_form[] = '<li class="clearcontents">';
	
	$swat_form[] = '<label class="left">* All letters are case sensitive *</label>';

	$swat_form[] = '<img id="captchaImg" src="/wp-content/themes/swat/captcha/captcha.php"/>';

	$swat_form[] = '<img src="/wp-content/themes/swat/captcha/refresh.jpg" onclick="javascript:document.getElementById([\'captchaImg\']).src=[\'/wp-content/themes/swat/captcha/captcha.php?rand=\']+new Date().getTime();" />';
	
	$swat_form[] = '</li>';

	$swat_form[] = '<li class="clearcontents">';
	
	$swat_form[] = '<label class="left">Confirm Letters:</label>';

	$swat_form[] = '<input type="text" id="tt_pass" name="tt_pass" style="width:100px;" maxlength="5"/>';
	
	$swat_form[] = '</li>';

	$swat_form[] = '<li class="clearcontents">';

	$swat_form[] = '<label class="left">&nbsp;</label>';

	$swat_form[] = '<input class="left" type="submit" value="Submit">';

	$swat_form[] = '</li>';

	$swat_form[] = '</ol>';

	$swat_form[] = '</form>';

	$swat_form[] = '</fieldset>';

	

	$swat_request_form = implode("\n", $swat_form);

	

	return $swat_request_form;

}




add_shortcode('swat-request-form', 'shortcode_swat_request_form');


//resume upload

function shortcode_swat_resume_form() {

	

	$swat_res = array();

	$swat_res[] = '<script type="text/javascript">';

	$swat_res[] = 'function resCheck() {';
	
	$swat_res[] = 'var passed = false;';
	
	$swat_res[] = 'with (document.Resume) {';
	
	$swat_res[] = 'if (Name.value == "") {';
	
	$swat_res[] = 'alert("Please enter your full name.");';
	
	$swat_res[] = 'Name.focus();';
	
	$swat_res[] = '}';
	
	$swat_res[] = 'else if (Email.value == "") {';
	
	$swat_res[] = 'alert("Please enter your email address.");';
	
	$swat_res[] = 'Email.focus();';
	
	$swat_res[] = '}';
	
	$swat_res[] = 'else if (Phone.value == "") {';
	
	$swat_res[] = 'alert("Please include a phone number you wish to be contacted at.");';
	
	$swat_res[] = 'Phone.focus();';
	
	$swat_res[] = '}';

	$swat_res[] = 'else if (userfile.value == "") {';
	
	$swat_res[] = 'alert("Please upload your resume in a .doc file format or .pdf file format");';
	
	$swat_res[] = 'userfile.focus();';
	
	$swat_res[] = '}';

	$swat_res[] = 'else {';
	
	$swat_res[] = 'passed = true;';
	
	$swat_res[] = '}';
	
	$swat_res[] = '}';
	
	$swat_res[] = 'return passed;';
	
	$swat_res[] = '}';
	

	$swat_res[] = '</script>';



	$swat_res[] = '<fieldset>';

	//$swat_res[] = '<legend>Resume Requests</legend>';

	$swat_res[] = '<form name="Resume" method="post" onsubmit="return resCheck();" action="/upload.php" enctype="multipart/form-data">';

	$swat_res[] = '<ol>';

	$swat_res[] = '<li class="clearcontents">';

	$swat_res[] = '<label class="left">Your Name *</label>';

	$swat_res[] = '<input class="left text-input" type="text" name="Name"/>';

	$swat_res[] = '</li>';

	$swat_res[] = '<li class="clearcontents">';

	$swat_res[] = '<label class="left">Your Email *</label>';

	$swat_res[] = '<input class="left text-input" type="text" name="Email"/>';

	$swat_res[] = '</li>';

	$swat_res[] = '<li class="clearcontents">';	

	$swat_res[] = '<label class="left">Your Phone Number *</label>';

	$swat_res[] = '<input class="left text-input" type="text" name="Phone"/>';

	$swat_res[] = '</li>';

	$swat_res[] = '<li class="clearcontents">';

	$swat_res[] = '<label class="left">Introductions<br />(about 50 words)</label>';

	$swat_res[] = '<textarea class="left" name="Introduction"></textarea>';

	$swat_res[] = '</li>';

	$swat_res[] = '<li class="clearcontents">';

	$swat_res[] = '<label class="left">Upload Resume *<br />(.doc, .docx or .pdf)</label>';

	$swat_res[] = '<input class="left" type="file" name="userfile" id="file">';

	$swat_res[] = '</li>';

	$swat_res[] = '<li class="clearcontents">';

	$swat_res[] = '<label class="left">Upload Cover Letter<br />(.doc, .docx or .pdf)</label>';

	$swat_res[] = '<input class="left" type="file" name="userfile1" id="file1">';

	$swat_res[] = '</li>';

	$swat_res[] = '<li class="clearcontents">';
	
	$swat_res[] = '<label class="left">Please confirm the letters in the image</label>';

	$swat_res[] = '</li>';
	
	$swat_res[] = '<li class="clearcontents">';
	
	$swat_res[] = '<label class="left">* All letters are case sensitive *</label>';

	$swat_res[] = '<img id="captchaImg" src="/wp-content/themes/swat/captcha/captcha.php"/>';
	
	$swat_res[] = '<img src="/wp-content/themes/swat/captcha/refresh.jpg" onclick="javascript:document.getElementById([\'captchaImg\']).src=[\'/wp-content/themes/swat/captcha/captcha.php?rand=\']+new Date().getTime();" />';
	
	$swat_res[] = '</li>';
	
	$swat_res[] = '<li class="clearcontents">';
	
	$swat_res[] = '<label class="left">Confirm Letters:</label>';

	$swat_res[] = '<input type="text" id="tt_pass" name="tt_pass" style="width:100px;" maxlength="5"/>';
	
	$swat_res[] = '</li>';

	$swat_res[] = '<li class="clearcontents">';

	$swat_res[] = '<label class="left">&nbsp;</label>';

	$swat_res[] = '<input class="left" type="submit" value="Submit">';

	$swat_res[] = '</li>';

	$swat_res[] = '</ol>';

	$swat_res[] = '</form>';

	$swat_res[] = '</fieldset>';

	

	$swat_resume_form = implode("\n", $swat_res);

	

	return $swat_resume_form;

}



add_shortcode('swat-resume-form', 'shortcode_swat_resume_form');



//insert div with bottom border

function insert_border_block( $atts, $content = null ) {

	extract( shortcode_atts( array('width' => 'auto'), $atts ) );

	$content = do_shortcode($content);

	return '<div class="post-download" style="width:' . $width . ';">' . $content . '</div>';

}

add_shortcode('bottom-border', 'insert_border_block');



function new_excerpt_length($length) {

	return 20;

}

add_filter('excerpt_length', 'new_excerpt_length');



Sorry I put in the code tags but for some reason it didn't take. Looked for an edit function to double check but I don't see it.

This post has been edited by no2pencil: 13 October 2012 - 05:53 AM
Reason for edit:: Added code tags

Was This Post Helpful? 0
  • +
  • -

#8 IrishDoc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-October 12

Re: Trying to use captcha snippet, Help Please

Posted 14 October 2012 - 04:57 AM

Any Ideas????
Was This Post Helpful? 0
  • +
  • -

#9 IrishDoc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-October 12

Re: Trying to use captcha snippet, Help Please

Posted 15 October 2012 - 09:17 AM

I realized i put the wrong code in for the quote.php page. Sorry, can you help with the code below.

<?php
$to = "@gmail.com,@brilliantbulb.com";
$from = $_POST["email"];
$subject = "Quote Request";
$name =  $_POST['name'];
$phone =  $_POST['phone'];
$project_description =  $_POST['project_description'];
$project_timeline =  $_POST['project_timeline'];
$email = $_POST["email"];
 



// validation
		$validationOK=true;
		if (Trim($email)=="") $validationOK=false;
		if (!$validationOK) {
		  print "<meta http-equiv=\"refresh\" content=\"0;URL=/?page_id=258\">";
		  exit;
		}
		$body = "Please contact the following person to discuss their project outlined below.\n\nFrom: $name\nEmail: $email\nPhone: $phone\n\nProject Description:\n$project_description\n\nThe following is information concerning the timeline.\n$project_timeline
		
		";
		
		$success = mail($to,$subject,$body,"From: <$email>");

		if ($success){
		  print "<meta http-equiv=\"refresh\" content=\"0;URL=/thank-you/\">";
		}
		else{
		  print "<meta http-equiv=\"refresh\" content=\"0;URL=/?page_id=258\">";
		}

?>

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1