Jump to content

Captcha


bandolero

Recommended Posts

I have been getting a steady flow of garbage in my on-line form for requesting availability in my hotel. I searched the web to find a way of preventing programs from completing the form without success; I have seen other forms requiring verification with an alpha/numeric random code.

 

I'm told by Stefan that what I'm seeking is called a captcha; can anyone in this forum please tell me how to put this captcha program onto an on-line form. Many thanks.

Link to comment
Share on other sites

A method I use with my online forms is a hidden input box which PHP code checks to see that it is empty as a human won't see the hidden input box and so it will stay empty but a computer will find it and enter something which will disable the form.

 


 

In the PHP process file:-

// If a bot is attempting to send spam it will complete this input while viewers don't see the visibility: hidden box
elseif ($_REQUEST['catchbot'] !="") {
//Boot it out of the server
die();
} 

 

where if ... !="..." means Not equal to 0... die.

 

 

Or

 


with the style

#formplusreply input.botcatch { visibility: hidden; height: 0; line-height: 0; font-size: 0; margin: 0; padding: 0; border: none; }

 

You can use a Captcha but that won't stop manual input, in fact nearly all methods won't stop a human from inputting manually unless you have a registration system.

 

A forum I run had trouble with computer spambots and I installed a Captcha but I heard that computers can now decode Captcha images, most of the time. They can identify the lower parts of p g j etc and the up strokes of l k t etc. and quite often make a correct choice so I changed the forum to ask the viewer to enter a code that was written next to the input box. A computer cannot find this from text.

Link to comment
Share on other sites

You should offer multiple ways of doing it. I often have trouble reading those captcha codes, a blind user (and I am guessing much of your hotel has braille room numbers etc?) will not see the code and if you add as text then the robot has it.

 

In this case, a simple query is better. "What is 2 + 3?" That is good for most people and works for the blind. BUT.... people with cognitive issues may have problems with such things and prefer the typical image Captcha.

 

So you really need to consider using both types and let the user choose which.

Link to comment
Share on other sites

thanks for this information but honestly, I am a bit lost. I am an amateur webmaster and only maintain my hotel website with little more experience than that in managing websites. I can understand HTML code but as for this stuff with the PHP and captcha, I am confused; please can someone explain it in layman's terms? Also, the hotel is not equipped for the blind and we have never had a blind guest so I would venture to say that that is not an issue in my case (at this point in time).

Link to comment
Share on other sites

You will need to edit your php process code, can you post it here, and the page code with the form?

 

LSW's method and mine are similar:

 

I have text next to the input box "Enter H8yMF6 in the box"

He has "What is 2+3; enter the answer in the box"

 

Both methods cannot be answered by a computer, only by a human.

 

Then your php process code has to check that the value of the field is equal to the answer, or an error is shown.

Link to comment
Share on other sites

Hi,

 

Don't mean to hijack. Just want to say thanks to both LSW and Wickham.

 

 

One my first ever post today on this forum my second question was about how people validate a human is actually a human, currently i use recaptcha which works great but it lacks due to it requires javascript, if disabled it makes your pages look very ugly, secondly althou it comes with audible support i myself who has fantastic hearing cannot understand it or here it clearly and my concern was with people with disability having problems with the recaptcha like seeing the characters etc. Plus lately they have added black background circles etc to the text and the text is also black and i myself have became concerned as i who also have good vision found it hard to understand some of the text.

 

I was going to use the akismet service but felt it was not ideal for me personally.

 

So i thought both your ideas about asking a user a simple math question and the hidden field to be good yet simple ideas. I did think about the question one before but never thought anymore of it, so thanks to you both for your simple ideas, i have added both features to each of my forms.

 

May i ask have you had spam using both methods on a single form? I would be interested to here the statistics.

 

Thanks

Mat

Link to comment
Share on other sites

Thanks Eric for the reply.

 

This makes me feel confident in using both of them.

 

What concerned me was i got a guestbook that i made myself, a blog i made myself and other additional features that allows user input such as comments on blog, send blog to a friend etc and the thought i having tons of spam hitting all the forms would be a killer, althou i have some measures in place it is still nice to avoid as much spam as possible.

 

I logged into my Google Webmaster account back last week and noticed someone was linking to my site from an unknown source that i was not aware of, when i checked the site it was a post on a forum which had hundreds of links in the post one of them being a link to my site saying to spam my site etc. I was shocked at what i saw but thankfully no humans came around and spammed my site.

 

But hearing what you have said i feel confident i will be ok with it.

 

Thanks,

Mat

Edited by mat22
Link to comment
Share on other sites

  • 1 year later...

i need help iv been trying to add captch to my forum to combat spam no luck .

here is my

index form page php:

 

<form action="send.php" method="post" name="qtfrm" id="qtfrm" onsubmit="return freeQuotesOK()">

<input type="hidden" name="freequote" value="1" />

<table width="96%" border="1" align="center" bordercolor="#CCCCCC">

<tbody>

<tr>

<td height="300" bgcolor="#FFCC66"><table cellspacing="0" cellpadding="3" align="center">

<tbody>

<tr>

 

</tr>

<tr>

 

</tr>

<tr>

<td colspan="2" height="4"></td>

</tr>

<tr>

<td>First Name: </td>

<td><input type="text" name="name" style='width:250px' />

 *</td>

</tr>

<tr>

<td>Last name: </td>

<td><input size="25" name="Last_Name" style='width:250px' />

 *</td>

</tr>

<tr>

<td>Home Phone: </td>

<td><input type="text" name="phone" style='width:250px' />

 *</td>

</tr>

<tr> </tr>

<tr>

<td>Email: </td>

<td><input type="text" name="email" style='width:250px' />

 *</td>

</tr>

<tr>

<td>Contact me at: </td>

<td><select name="Contact_Preference">

<option value="">Select Phone</option>

<option value="home">Home</option>

<option value="work">Work</option>

</select>

 *  in the

<select name="Contact_Time">

<option value="">Select Time</option>

<option value="morning">Morning</option>

<option value="noon">Noon</option>

<option value="evening">Evening</option>

<option value="anytime">AnyTime</option>

</select>

 *</td>

</tr>

</tbody>

</table>

<table cellspacing="0" cellpadding="0" align="center" border="0">

<tbody>

<tr>

<td align="middle" colspan="4">How Many Quotes <strong>:</strong> 3

<input id="radio3" type="radio" name="How_Quotes" value="3" />

5

<input id="cty" type="radio" name="How_Quotes" value="5" />

7

<input id="lgr" type="radio" name="How_Quotes" value="7" />

8

<input id="radio" type="radio" name="How_Quotes" value="8" />

10

<input id="radio2" type="radio" name="How_Quotes" value="10" checked='checked' />

</td>

</tr>

<tr>

 

</tr>

<tr>

<td bgcolor="#336699" colspan="4" height="2"></td>

</tr>

<tr>

<td colspan="4" height="4"></td>

</tr>

<tr>

<td> </td>

<td>Moving From</td>

<td> </td>

<td>Moving To</td>

</tr>

<tr>

<td>City: </td>

<td><input size="15" value="<?=$From_City?>" name="From_City" />

 *</td>

<td>City: </td>

<td><input size="15" value="<?=$To_City?>" name="To_City" /></td>

</tr>

<tr>

<td>State: </td>

<td><select style='font-size:12px' name="From_State">

<option value="">Select State</option>

<option value="Alaska">Alaska</option>

<option value="Alabama">Alabama</option>

<option value="American Samoa">American Samoa</option>

<option value="Arizona">Arizona</option>

<option value="Arkansas">Arkansas</option>

<option value="California">California</option>

<option value="Colorado">Colorado</option>

<option value="Connecticut">Connecticut</option>

<option value="Delaware">Delaware</option>

<option value="District of Columbia">District of Columbia</option>

<option value="Federated States of Micronesia">Federated States of Micronesia</option>

<option value="Florida">Florida</option>

<option value="Georgia">Georgia</option>

<option value="Guam">Guam</option>

<option value="Hawaii">Hawaii</option>

<option value="Idaho">Idaho</option>

<option value="Illinois">Illinois</option>

<option value="Indiana">Indiana</option>

<option value="Iowa">Iowa</option>

<option value="Kansas">Kansas</option>

<option value="Kentucky">Kentucky</option>

<option value="Louisiana">Louisiana</option>

<option value="Maine">Maine</option>

<option value="Marshall Islands">Marshall Islands</option>

<option value="Maryland">Maryland</option>

<option value="Massachusetts">Massachusetts</option>

<option value="Michigan">Michigan</option>

<option value="Minnesota">Minnesota</option>

<option value="Mississippi">Mississippi</option>

<option value="Missouri">Missouri</option>

<option value="Montana">Montana</option>

<option value="Nebraska">Nebraska</option>

<option value="Nevada">Nevada</option>

<option value="New Hampshire">New Hampshire</option>

<option value="New Jersey">New Jersey</option>

<option value="New Mexico">New Mexico</option>

<option value="New York">New York</option>

<option value="North Carolina">North Carolina</option>

<option value="North Dakota">North Dakota</option>

<option value="Northern Mariana Islands">Northern Mariana Islands</option>

<option value="Ohio">Ohio</option>

<option value="Oklahoma">Oklahoma</option>

<option value="Oregon">Oregon</option>

<option value="Palau">Palau</option>

<option value="Pennsylvania">Pennsylvania</option>

<option value="Puerto Rico">Puerto Rico</option>

<option value="Rhode Island">Rhode Island</option>

<option value="South Carolina">South Carolina</option>

<option value="South Dakota">South Dakota</option>

<option value="Tennessee">Tennessee</option>

<option value="Texas">Texas</option>

<option value="Utah">Utah</option>

<option value="Vermont">Vermont</option>

<option value="Virgin Islands">Virgin Islands</option>

<option value="Virginia">Virginia</option>

<option value="Washington">Washington</option>

<option value="West Virginia">West Virginia</option>

<option value="Wisconsin">Wisconsin</option>

<option value="Wyoming">Wyoming</option>

<option value="Armed Forces Middle East">Armed Forces Middle East</option>

<option value="Armed Forces Pacific">Armed Forces Pacific</option>

</select>

 *</td>

<td>State: </td>

<td><select style='font-size:12px' name="To_State">

<option value="">Select State</option>

<option value="Alaska">Alaska</option>

<option value="Alabama">Alabama</option>

<option value="American Samoa">American Samoa</option>

<option value="Arizona">Arizona</option>

<option value="Arkansas">Arkansas</option>

<option value="California">California</option>

<option value="Colorado">Colorado</option>

<option value="Connecticut">Connecticut</option>

<option value="Delaware">Delaware</option>

<option value="District of Columbia">District of Columbia</option>

<option value="Federated States of Micronesia">Federated States of Micronesia</option>

<option value="Florida">Florida</option>

<option value="Georgia">Georgia</option>

<option value="Guam">Guam</option>

<option value="Hawaii">Hawaii</option>

<option value="Idaho">Idaho</option>

<option value="Illinois">Illinois</option>

<option value="Indiana">Indiana</option>

<option value="Iowa">Iowa</option>

<option value="Kansas">Kansas</option>

<option value="Kentucky">Kentucky</option>

<option value="Louisiana">Louisiana</option>

<option value="Maine">Maine</option>

<option value="Marshall Islands">Marshall Islands</option>

<option value="Maryland">Maryland</option>

<option value="Massachusetts">Massachusetts</option>

<option value="Michigan">Michigan</option>

<option value="Minnesota">Minnesota</option>

<option value="Mississippi">Mississippi</option>

<option value="Missouri">Missouri</option>

<option value="Montana">Montana</option>

<option value="Nebraska">Nebraska</option>

<option value="Nevada">Nevada</option>

<option value="New Hampshire">New Hampshire</option>

<option value="New Jersey">New Jersey</option>

<option value="New Mexico">New Mexico</option>

<option value="New York">New York</option>

<option value="North Carolina">North Carolina</option>

<option value="North Dakota">North Dakota</option>

<option value="Northern Mariana Islands">Northern Mariana Islands</option>

<option value="Ohio">Ohio</option>

<option value="Oklahoma">Oklahoma</option>

<option value="Oregon">Oregon</option>

<option value="Palau">Palau</option>

<option value="Pennsylvania">Pennsylvania</option>

<option value="Puerto Rico">Puerto Rico</option>

<option value="Rhode Island">Rhode Island</option>

<option value="South Carolina">South Carolina</option>

<option value="South Dakota">South Dakota</option>

<option value="Tennessee">Tennessee</option>

<option value="Texas">Texas</option>

<option value="Utah">Utah</option>

<option value="Vermont">Vermont</option>

<option value="Virgin Islands">Virgin Islands</option>

<option value="Virginia">Virginia</option>

<option value="Washington">Washington</option>

<option value="West Virginia">West Virginia</option>

<option value="Wisconsin">Wisconsin</option>

<option value="Wyoming">Wyoming</option>

<option value="Armed Forces Middle East">Armed Forces Middle East</option>

<option value="Armed Forces Pacific">Armed Forces Pacific</option>

</select>

 *</td>

</tr>

<tr>

<td>Zip: </td>

<td><input maxlength="5" size="5" name="From_Zip" />

 *</td>

<td>Zip: </td>

<td><input maxlength="5" size="5" name="To_Zip" />

* </td>

</tr>

</tbody>

</table>

<table cellspacing="0" cellpadding="0" align="center" border="0">

<tbody>

<tr>

<td bgcolor="#336699" colspan="2" height="2"></td>

</tr>

<tr>

<td colspan="2" height="4"></td>

</tr>

<tr>

<td height="25">Move Date: </td>

<td><select size="1" name="MoveMonth">

<option value="1">Jan</option>

<option value="2">Feb</option>

<option value="3">Mar</option>

<option value="4">Apr</option>

<option value="5">May</option>

<option value="6">Jun</option>

<option value="7">Jul</option>

<option value="8">Aug</option>

<option value="9">Sep</option>

<option value="10">Oct</option>

<option value="11">Nov</option>

<option value="12">Dec</option>

</select>

<select size="1" name="MoveDay">

<option value="1">1</option>

<option value="2">2</option>

<option value="3">3</option>

<option value="4">4</option>

<option value="5">5</option>

<option value="6">6</option>

<option value="7">7</option>

<option value="8">8</option>

<option value="9">9</option>

<option value="10">10</option>

<option value="11">11</option>

<option value="12">12</option>

<option value="13">13</option>

<option value="14">14</option>

<option value="15">15</option>

<option value="16">16</option>

<option value="17">17</option>

<option value="18">18</option>

<option value="19">19</option>

<option value="20">20</option>

<option value="21">21</option>

<option value="22">22</option>

<option value="23">23</option>

<option value="24">24</option>

<option value="25">25</option>

<option value="26">26</option>

<option value="27">27</option>

<option value="28">28</option>

<option value="29">29</option>

<option value="30">30</option>

<option value="31">31</option>

</select>

<select size="1" name="MoveYear">

<option value="2010">2010</option>

<option value="2011">2011</option>

<option value="2011">2012</option>

<option value="2011">2013</option>

<option value="2011">2014</option>

</select>

 *</td>

</tr>

<tr>

<td height="25">Move Size: </td>

<td><select size="1" name="Move_Size">

<option value="">Residential Types:</option>

<option value="Partial Home">Partial Home</option>

<option value="Studio">Studio</option>

<option value="1 Small Bedroom">1 Small Bedroom</option>

<option value="1 Large Bedroom">1 Large Bedroom</option>

<option value="2 Bedroom">2 Bedroom</option>

<option value="3 Bedroom">3 Bedroom</option>

<option value="4 Bedroom">4 Bedroom</option>

<option value="More Than 4 Bedroom">More Than 4 Bedroom</option>

</select>

 *</td>

</tr>

<tr>

<td height="25"> </td>

<td> </td>

</tr>

<tr>

<td colspan="2"><p align="center"> 

</p>

<p align="center">

<input name="button" type="image" onclick='if (freeQuotesOK()) document.qtfrm.submit()' value='Send >>' src="formSubmit.png" align="middle" />

</p></td>

</tr>

</tbody>

</table></td>

</tr>

</tbody>

</table>

 

</form>

 

and here is my send.php

 

<?

include_once "connect.php";

include_once "functions.php";

}

if (isset($_POST['name']) && !isset($_POST['freequote'])) {

$MSG = 'Contact Us:<br>';

$MSG .= (isset($_POST['name']))? 'Name = '.$_POST['name']."<br>" : '';

$MSG .= (isset($_POST['phone']))? 'Phone = <span dir=ltr>'.$_POST['phone']."</span><br>" : '';

$MSG .= (isset($_POST['email']))? 'Email = <span dir=ltr>'.$_POST['email']."</span><br>" : '';

$MSG .= (isset($_POST['comment']))? 'Comments = '.nl2br($_POST['comment'])."<br>" : '';

$MSG = "<div>$MSG</div>";

$headers = "MIME-Version: 1.0\n";

$headers .= "Content-type: text/html; charset=windows-1255\n";

$headers .= "From: Movers Community <info@moverscommunity.com>\n";

$subject = "From Website: ".$_SERVER['REMOTE_ADDR'];

$st = mail('avidanbanks@gmail.com ', $subject, $MSG, $headers);

header('location: ../thanks.php');

exit();

}

 

if (isset($_POST['freequote'])) {

$phone = fixquotes($_REQUEST['phone']);

$phone2 = fixquotes($_REQUEST['phone2']);

$name = fixquotes($_REQUEST['name']);

$Last_Name = fixquotes($_REQUEST['Last_Name']);

$email = fixquotes($_REQUEST['email']);

$How_Quotes = intval($_REQUEST['How_Quotes']);

$contactTime = fixquotes($_REQUEST['Contact_Time']);

$contactPref = fixquotes($_REQUEST['Contact_Preference']);

$From_City = fixquotes($_REQUEST['From_City']);

$To_City = fixquotes($_REQUEST['To_City']);

$From_State = fixquotes($_REQUEST['From_State']);

$To_State = fixquotes($_REQUEST['To_State']);

$From_Zip = fixquotes($_REQUEST['From_Zip']);

$To_Zip = fixquotes($_REQUEST['To_Zip']);

$Move_Date = strtotime($_REQUEST['MoveMonth']."/".$_REQUEST['MoveDay']."/".$_REQUEST['MoveYear']);

$Move_Size = fixquotes($_REQUEST['Move_Size']);

$comment = fixquotes($_REQUEST['comment']);

$dater = strtotime("now");

 

$sql = "

INSERT INTO leads (

homePhone, workPhone, firstName, lastName, email, origQuotes, contactPref, contactTime,

From_City, To_City, From_State, To_State, From_Zip, To_Zip, Move_Date, Move_Size, comment, dater

)

VALUES(

'$phone','$phone2','$name','$Last_Name','$email','$How_Quotes', '$contactPref', '$contactTime',

'$From_City', '$To_City', '$From_State', '$To_State', '$From_Zip', '$To_Zip', '$Move_Date', '$Move_Size', '$comment', '$dater'

)";

 

$rs = mysql_query($sql);

 

$MSG = 'Free Quote:<br>';

$MSG .= (isset($_POST['name']))? 'Name = '.$_POST['name']."<br>" : '';

$MSG .= (isset($_POST['Last_Name']))? 'Last Name = '.$_POST['Last_Name']."<br>" : '';

$MSG .= (isset($_POST['phone']))? 'Home Phone = <span dir=ltr>'.$_POST['phone']."</span><br>" : '';

$MSG .= (isset($_POST['phone2']))? 'Work Phone = <span dir=ltr>'.$_POST['phone2']."</span><br>" : '';

$MSG .= (isset($_POST['email']))? 'Email = <span dir=ltr>'.$_POST['email']."</span><br>" : '';

$MSG .= 'Contact Preference = <span dir=ltr>'.$_POST['Contact_Preference']."</span><br>";

$MSG .= 'Contact Time = <span dir=ltr>'.$_POST['Contact_Time']."</span><br>";

$MSG .= 'How many quotes = <span dir=ltr>'.$_POST['How_Quotes']."</span><br>";

$MSG .= 'From City = <span dir=ltr>'.$_POST['From_City']."</span><br>";

$MSG .= 'To City = <span dir=ltr>'.$_POST['To_City']."</span><br>";

$MSG .= 'From State = <span dir=ltr>'.$_POST['From_State']."</span><br>";

$MSG .= 'To State = <span dir=ltr>'.$_POST['To_State']."</span><br>";

$MSG .= 'From Zip = <span dir=ltr>'.$_POST['From_Zip']."</span><br>";

$MSG .= 'To Zip = <span dir=ltr>'.$_POST['To_Zip']."</span><br>";

$MSG .= 'Move Date = <span dir=ltr>'.$_POST['MoveMonth']."/".$_POST['MoveDay']."/".$_POST['MoveYear']."</span><br>";

$MSG .= 'Move Size = <span dir=ltr>'.$_POST['Move_Size']."</span><br>";

$MSG .= (isset($_POST['comment']))? 'Comments = '.nl2br($_POST['comment'])."<br>" : '';

$MSG = "<div>$MSG</div>";

$headers = "MIME-Version: 1.0\n";

$headers .= "Content-type: text/html; charset=windows-1255\n";

$headers .= "From: Movers Community <info@moverscommunity.com>\n";

$subject = "From Website: ".$_SERVER['REMOTE_ADDR'];

 

$st = mail('shawn2411@gmail.com ', $subject, $MSG, $headers);

 

/*echo $sql;

echo "<br>";

die($MSG);*/

header('location: ../thanks.php');

exit();

}

 

?>

 

please help i tried to many scrip nothing working .

Link to comment
Share on other sites

  • 7 months later...

CAPTCHA is a kind of problem-response check used in computing as an attempt to ensure that the response is produced by a individual. The procedure usually entails a pc asking a consumer to complete a simple test which the computer is able to grade. These exams are designed to be easy for a computer to generate, but difficult for a pc to solve, so that if a right answer is received, it can be presumed to have been entered by a human.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...