Registration Captcha

Hey what if we banned all users whose WCA profile code is 1 from posting? Would that decrease the amount of spam by a bit?

Well there were two cases of bots just a few minutes ago that DanCohen banned(one that we caught before they even posted anything), both of which had wca ID of 1.

A simple check if the WCA id is valid during registration should help.

I suggested this a while ago. Apparently it's more difficult than I thought to implement.

Why is that?

Either vBulletin sucks or someone doesn't know how to use it. That should be a trivial change.

I would expect that the e-mail address is validated by a regular expression, you'd just have to make a similar check to the WCAID that if it isn't NULL, it follows the correct syntax. If it doesn't, you could fail silently. Or, you could only fail silently if they enter in "1"
 
I'm trying to update my profile (and I have no WCA code) and I get the following error:

You did not enter the correct format for the Enter your WCA profile code (if available) field. Please read the field description for the expected format.

Has someone changed the form validation code?
 
Last edited:
I would expect that the e-mail address is validated by a regular expression, you'd just have to make a similar check to the WCAID that if it isn't NULL, it follows the correct syntax. If it doesn't, you could fail silently. Or, you could only fail silently if they enter in "1"

I was actually thinking of checking if the WCAID actually exists, but upon further research(since I know very little php) I found that doing an fopen approach may not be a very good idea. But what do I know.

But anyway, a \d{4}\D{4}\d\d regex is better than nothing.
 
If you're looking for something that will validate the WCA code, try this:

PHP:
<?php

$wca_code = "2005AKKE01";

if(preg_match('/(^[1-2][0-9]{3}[A-Z]{4}[0-9]{2}$|^$)/', $wca_code))
	print("$wca_code is valid");
else
	print("$wca_code is invalid");

?>

It assumes that the first four characters are a year (starting with 1 or 2, ie. 1999 or 2005, but not something like 0999 or 3005). The next four characters are upper case letters, and the final two characters are numbers between 0 and 9. Crucially it treats the empty string as valid as well, which is needed for ppl like myself who don't yet have a code!

If you can get the edit profile page working again i'd be greatful ... need to update my bio ... new PBs to add :eek: :)
 
Anytime :p

Spent a lot of my younger days regex hacking. For a while I tried to maintain a php search app to steal Google's results (by directly parsing Google's html). T'was a monster regex ... actually .. I'll see if I can dig it up...


Lol, here it is:
PHP:
// Build the regex to recognise each result
function gen_regex(){

	global $FRONT;
	global $BACK;

	// Constants representing sub-parts of the html
	//NB: This may change if google change their code
	$FRONT            = esc('<p class=g><!--m-->');

	$U_TYPE_FRONT     = esc('<span class=w><font size=-2><b>[');
	$U_TYPE_BACK      = esc(']</b></font></span> ');
	$U_PRE_FRONT      = esc('<link rel="prefetch" href="');
	$U_PRE_BACK       = esc('">');
	$U_ADDR_FRONT     = esc('<a href="');
	$U_ADDR_JS_FRONT  = esc('" onmousedown="return rwt(this,\'res\',\'');
	$U_ADDR_JS_BACK   = esc("','')");
	$U_ADDR_MID       = esc('">');
	$U_ADDR_BACK      = esc('</a>');
	$U_TRANS_FRONT    = esc('<font size=-1> - [ <a href=');
	$U_TRANS_BACK     = esc('  class=fl>Translate this page</a> ]</font>');

	$D_TABLE          = esc('<table cellpadding=0 cellspacing=0 border=0><tr><td class=j>');
	$D_BR             = esc('<br>');
	$D_FONT           = esc('<font size=-1>');
	$D_FORMAT_FRONT   = esc('<font color=#6f6f6f>File Format:</font> ');
	$D_HTMLVIEW_FRONT = esc(' - <a href="');
	$D_HTMLVIEW_BACK  = esc('">View as HTML</a>');
	$D_FORMAT_BACK    = esc('<br>');
	$D_BACK           = esc('<br>');

	$P_FRONT          = esc('<font color=#008000>');
	$P_DLIM           = esc(' - ');
	$P_SUPP           = esc('Supplemental Result');
	$P_BACK           = esc('</font>');

	$L_NOBR           = esc('<nobr>  ');
	$L_CACHE_FRONT    = esc('<a class=fl href="');
	$L_CACHE_MID1     = esc('http://');
	$L_CHCHE_MID2     = esc('/search?q=cache:');
	$L_CACHE_BACK     = esc('">Cached</a> - ');
	$L_RELATED_FRONT  = esc('<a class=fl href="');
	$L_RELATED_MID    = esc('/search?');
	$L_RELATED_BACK   = esc('">Similar&nbsp;pages</a></nobr>');

	$B_MORE_FRONT     = esc('<br>[ <a class=fl href="');
	$B_MORE_MID       = esc('">More results from ');
	$B_MORE_BACK      = esc('</a> ]');

	$BACK             = esc('</font><!--n-->');

	// Constants representing characters
	$alpha   = "[a-zA-Z]";
	$digit   = "[0-9]";
	$safe    = "[\$-_\.\+]";
	$extra   = "[!\*'\(\)\,]";
	$urlchar = "($alpha|$digit|$safe|$extra|[;:@&\=\/%\~\?])"; //RFC compliant characters

	// Mid level dcompositions
	$u_type      = "$U_TYPE_FRONT(.*?)$U_TYPE_BACK";
	$u_prefetch  = "$U_PRE_FONT(.*?)$U_PRE_BACK";
	$u_addr      = "$U_ADDR_FRONT($urlchar*?)(($U_ADDR_JS_FRONT)[0-9]*($U_ADDR_JS_BACK))?$U_ADDR_MID(.*?)$U_ADDR_BACK";
	$u_translate = "$U_TRANS_FRONT($urlchar*?)$U_TRANS_BACK";
	$d_format = "$D_FORMAT_FRONT(.*?)($D_HTMLVIEW_FRONT($urlchar*?)$D_HTMLVIEW_BACK)?$D_FORMAT_BACK";
	$d_text   = "(.*?)$D_BACK";
	$p_vurl = "(.*?)$P_DLIM";
	$p_size = "([0-9]*?(b|k|m|g))$P_DLIM";
	$p_date = "( [1-3]?[0-9] (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([1-2][0-9][0-9][0-9]))$P_DLIM";
	$l_cache   = "$L_CACHE_FRONT($L_CACHE_MID1([1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9])$L_CACHE_MID2($urlchar*?))$L_CACHE_BACK";
	$l_related = "$L_RELATED_FRONT($L_RELATED_MID$urlchar*?)$L_RELATED_BACK";
	$b_more = "$B_MORE_FRONT($urlchar*?)$B_MORE_MID(.*?)$B_MORE_BACK";

	// High level decompositions
	$url         = "($u_type)?($u_prefetch)?$u_addr($u_translate)?";
	$description = "(($D_TABLE)|($D_BR))$D_FONT(($d_format)?$d_text)?";
	$properties  = "$P_FRONT($p_vurl)? ($p_size)?($p_date|$P_SUPP$P_DLIM)?$P_BACK";
	$links       = "( )?$L_NOBR($l_cache)?$l_related";
	$back        = "($b_more)?$BACK";

	return "$FRONT$url$description($properties)?$links$back";
}

It totally worked, but was one cumbersome piece of code to maintain. Google kept slightly changing their output, so I kept having to alter the regex .. no fun I'll tell ya :fp Eventually I opted for the inferior, but much more reliable Google API ;)
 
Hey what if we banned all users whose WCA profile code is 1 from posting? Would that decrease the amount of spam by a bit?

Well there were two cases of bots just a few minutes ago that DanCohen banned(one that we caught before they even posted anything), both of which had wca ID of 1.

A simple check if the WCA id is valid during registration should help.

I suggested this a while ago. Apparently it's more difficult than I thought to implement.
I tried this awhile ago when it was first suggested, but I messed it up because I was treating the Banned usergroup as a primary usergroup. I messed with it more like a week ago and I think I fixed it. It was actually really easy. When a user enters "1" as their WCA Profile code during registration, once they activate their email address, they are moved to the Banned usergroup.

When was the last time you saw someone post with a "1" as their WCA ID? Perhaps there is still a hole somewhere that I am missing, but when I tested it out, it worked. Keep me updated, as I should be able to solve this issue.
 
Hey what if we banned all users whose WCA profile code is 1 from posting? Would that decrease the amount of spam by a bit?

Well there were two cases of bots just a few minutes ago that DanCohen banned(one that we caught before they even posted anything), both of which had wca ID of 1.

A simple check if the WCA id is valid during registration should help.

I suggested this a while ago. Apparently it's more difficult than I thought to implement.
I tried this awhile ago when it was first suggested, but I messed it up because I was treating the Banned usergroup as a primary usergroup. I messed with it more like a week ago and I think I fixed it. It was actually really easy. When a user enters "1" as their WCA Profile code during registration, once they activate their email address, they are moved to the Banned usergroup.

When was the last time you saw someone post with a "1" as their WCA ID? Perhaps there is still a hole somewhere that I am missing, but when I tested it out, it worked. Keep me updated, as I should be able to solve this issue.

A simple check if the WCA id is valid during registration should help.

http://www.speedsolving.com/forum/member.php?u=6136
 
Hmmm...that is weird that it works when I test it, but not when the bots do it. Checking to make sure the content entered in the field is valid is an alternative, but I think if I can get the current system working, that would be a bit better (keep in mind the WCA field is optional). I will mess with this when I get back from camping on Monday.

Off topic, when are you going overseas? You're going to be here for the Boulder Open, aren't you?
Sept. 15. Unfortunately, I will barely miss the Boulder comp. Expect Anthony to do the same at that comp as I did in Aurora, as I won't be there.
 
Hmmm...that is weird that it works when I test it, but not when the bots do it. Checking to make sure the content entered in the field is valid is an alternative, but I think if I can get the current system working, that would be a bit better (keep in mind the WCA field is optional). I will mess with this when I get back from camping on Monday.

Note that Dan just added a regex to it, which may be why it is working as you are testing it now.

yeah.. i just fixed it with the regex

Code:
(19|20)\d{2}[A-Z]{4}\d{2})?

that should be good until 2100.
 
Hmmm...that is weird that it works when I test it, but not when the bots do it. Checking to make sure the content entered in the field is valid is an alternative, but I think if I can get the current system working, that would be a bit better (keep in mind the WCA field is optional). I will mess with this when I get back from camping on Monday.

Note that Dan just added a regex to it, which may be why it is working as you are testing it now.

yeah.. i just fixed it with the regex

Code:
(19|20)\d{2}[A-Z]{4}\d{2})?
that should be good until 2100.
I had tested it a week ago when I first set it up. I will work on it more next week.
 
Back
Top