close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Honeypot Spam Prevention - WA Server Validations

Thread began 11/05/2011 9:32 am by dlovas275157 | Last modified 5/11/2018 5:35 pm by Ray Borduin | 3992 views | 12 replies |

dlovas275157

Honeypot Spam Prevention - WA Server Validations

I am trying to add a honeypot to my form to help prevent bot spammers from filling out my forms.

I have a textfield that is positioned off the page with css
position: absolute; left: -9000px

The textfield by default is empty. If a bot enters anything into the field, I want it to fail. How to do I set up this validation? can't seem to find an option in the Server Validation Dialog that requires the field to be empty.

Help is appreciated.

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

use regular expression validation. set the Allow Blank entry option and use the following regular expression:
/^$/i

Sign in to reply to this post

dlovas275157

Jason,

Great...that worked!

What does "/^$/i " mean, and why does that work?

Sign in to reply to this post

Jason ByrnesWebAssist

the leading / denotes the start of the expression

^ anchors the regular expression to the start of the line.

$ anchors it to the end of the line.

/i means case insensitive


The regular expression basically says:

Do a case insensitive search for the start of a line being right next to the end of a line

in other words, blank entry.


if you want more info on regular expressions, see the cheat sheet here:
regular-expressions-cheat-sheet/

Sign in to reply to this post

JBWebWorks

I use this regular expression for honeypot spam prevention and has worked fine until the last few months. For some reason I am now getting bot spam.

<?php 
if (isset($_POST["submit1"]) || isset($_POST["submit1_x"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_index_202_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["player1"]))?$_POST["player1"]:"") . "",false,1);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["tee1"]))?$_POST["tee1"]:"") . "",true,2);
$WAFV_Errors .= WAValidateRX(((isset($_POST["addblock"]))?$_POST["addblock"]:"") . "","/^$/i",false,6);
$WAFV_Errors .= WAValidateRX(((isset($_POST["seconddblock"]))?$_POST["seconddblock"]:"") . "","/^$/i",false,7);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"index_202");
}
}
?>
<div id="form1_ProgressWrapper">
<span style="display:">
<?php $selected = explode(", ", ValidatedField("index_202","player1")); ?>
</span>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input name="addblock" type="text" id="addblock" style="display:none" value="" />
<input name="seconddblock" id="seconddblock" type="text" style="display:none" value="" />
<span style="display:">
<label for="player1"><strong>*Your Name:</strong></label>
<select name="player1[]" id="player1" onchange="setSatsignup(document.form1.player1[document.form1.player1.selectedIndex].value)">
<option value="" selected="selected">Select From Dropdown</option>
<?php
do {
?>
<option value="<?php echo $row_rs_members['FirstName']?>,<?php echo $row_rs_members['LastName']?>,<?php echo $row_rs_members['GHIN_Number']; ?>"><?php echo $row_rs_members['FirstName']?> <?php echo $row_rs_members['LastName']?></option>
<?php
} while ($row_rs_members = mysql_fetch_assoc($rs_members));
$rows = mysql_num_rows($rs_members);
if($rows > 0) {
mysql_data_seek($rs_members, 0);
$row_rs_members = mysql_fetch_assoc($rs_members);
}
?>
</select>



<?php
if (ValidatedField('index_202','index_202')) {
if ((strpos((",".ValidatedField("index_202","index_202").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
<span class="stylered">Name required</span>
<?php //WAFV_Conditional index.php index_202(1:)
}
}
}?>
<br />

<?php
if (ValidatedField('index_276','index_276')) {
if ((strpos((",".ValidatedField("index_276","index_276").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
<span class="stylered">You are already signed up for Saturday</span>
<?php //WAFV_Conditional index.php index_276(3:)
}
}
}?>
<br />
<label for="email1"><strong>Email Confirmation </strong></label>
<select name="email1" id="email1">
<option value="" <?php if (!(strcmp("", (ValidatedField("index_202","email1"))))) {echo "selected=\"selected\"";} ?>>Select your Name if you want an email confirmation</option>
<?php
do {
?>
<option value="<?php echo $row_rs_members['EmailAddress']?>"<?php if (!(strcmp($row_rs_members['EmailAddress'], (ValidatedField("index_202","email1"))))) {echo "selected=\"selected\"";} ?>><?php echo $row_rs_members['FirstName']; ?> <?php echo $row_rs_members['LastName']?> </option>
<?php
} while ($row_rs_members = mysql_fetch_assoc($rs_members));
$rows = mysql_num_rows($rs_members);
if($rows > 0) {
mysql_data_seek($rs_members, 0);
$row_rs_members = mysql_fetch_assoc($rs_members);
}
?>
</select>
<br />
<br />

<label for="tee1"><strong>*Your Tee Choice:</strong></label>
<select name="tee1" id="tee1">
<option value="" selected="selected" <?php if (!(strcmp("", (ValidatedField("index_202","tee1"))))) {echo "selected=\"selected\"";} ?>>Select Your Tee</option>
<option value="Gold" <?php if (!(strcmp("Gold", (ValidatedField("index_202","tee1"))))) {echo "selected=\"selected\"";} ?>>Gold</option>
<option value="White" <?php if (!(strcmp("White", (ValidatedField("index_202","tee1"))))) {echo "selected=\"selected\"";} ?>>White</option>
<option value="Blue" <?php if (!(strcmp("Blue", (ValidatedField("index_202","tee1"))))) {echo "selected=\"selected\"";} ?>>Blue</option>
</select>

<?php
if (ValidatedField('index_202','index_202')) {
if ((strpos((",".ValidatedField("index_202","index_202").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
?>
<span class="stylered">Tee Required</span>
<?php //WAFV_Conditional index.php index_202(2:)
}
}
}?>
<br />
<br />
<label for="pairing1"><strong>Notes or Message:</strong></label><br />

<textarea name="pairing1" id="pairing1" cols="45" rows="5"><?php echo(ValidatedField("index_202","pairing1")) ?></textarea>
<br />
<br /><input name="FirstName" id="FirstName" type="hidden" value="" /><input name="LastName" id="LastName" type="hidden" value="" /><input name="GHIN_number" id="GHIN_number" type="hidden" value="" />
<input type="submit" name="submit1" id="submit1" value="Submit Saturday Signup" />
</span>
</form>
</div>
Sign in to reply to this post

Ray BorduinWebAssist

It must be smart enough to avoid your honeypot. I'd maybe try adding CAPTCHA or a simple question validation.

Sign in to reply to this post
Did this help? Tips are appreciated...

JBWebWorks

Ray,
is there a way to use regular expression in validation toolkit to block the words url, http, or https from a textarea. That seems to be what the bots put in my form.

Sign in to reply to this post

Ray BorduinWebAssist

Yes you can use a regular expression for that. I did a google search for "regular expression exclude word" and got:

^/(?!ignoreme|ignoreme2|ignoremeN)([a-z0-9]+)$

Sign in to reply to this post
Did this help? Tips are appreciated...

JBWebWorks

This post has been deleted.

JBWebWorks

Thanks Ray.
I used regular expression with these words ^/(?!url|http|https)([a-z0-9]+)$
It won't allow any word?

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...