Uncaptcha.URLBlock.3kaya

Langue: en

Version: March 2009 (fedora - 05/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Uncaptcha::URLBlock - A URL-based filter

SYNOPSIS

Uncaptcha::URLBlock< >
= URLBlock(Int maxurls,[String] fields,Bool rejectmixed)

DESCRIPTION

This filter rejects submissions which contain too many URLs. For many spambots, the aim is to submit as many forms as possible in the hope that the content of the form will be placed on the web and links in the content will then temporarily boost the search ranking of pages for the spammers.

By rejecting submissions with excessive URLs (or any URLs, if appropriate) spam is made significantly harder.

maxurls is the maximum number of URLs expected in legitimate content. This can generally be set relatively low, and in many applications can safely be set to zero (which means any URLs at all will cause the content to be rejected.

fields is a list of the field names in the previous form which should be subjected to this check. In some cases, you may wish to call this check more than once, with different fields and maxurls settings.

rejectmixed causes immediate rejection of a form where the same field contains two URLs of different 'types'. Software on the web has different ways of processing legitimate URLs in submissions - it may turn plain URLs into links, or expect HTML to be used, or use BBCode, for example. Generally legitimate users do not mix URL formats in submissions, but generic spambots may do so.


 // in the form handling function
     if (checkURLBlock(URLBlock(3,["commenttext"],true)) &&
         checkURLBlock(URLBlock(0,["subject","name","email"],true)) {
         // process form or do further checks
     } else {
         // reject form, perhaps with an error message
     }
 // this checks that the "commenttext" field has no more than
 // three URLs and that other fields have none at all.

AUTHORS

Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/

LICENSE

The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.

Uncaptcha.checkURLBlock(3kaya)