Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Battling form spam

by pKai (Priest)
on Nov 17, 2010 at 11:02 UTC ( #871977=note: print w/ replies, xml ) Need Help??


in reply to Battling form spam

A few random observations after having a cursory view on the download of your script (Form.cgi from Form.zip) which does "not work properly":

The original script is not your own, but you tried to adapt some form script "flying around" in the internet. (Which is not a bad thing as is, but just to mention because it was not obvious from your post.)

I didn't bother to long for the original of the script, but try to deduce your changes from what you wrote here.

You introduced the lines 631,632 (at beginning of sub send_email):

# Only send email if spam trapping field is empty # if ($Form{'hiddenfield'} eq '') {

and line 907,908:

# closing bracket for spam if statement # }

Now coming from here:

There is no such variable as %Form declared or filled anywhere, so it will be empty (referencing that stray variable is no error, since use strict; is not used in the script.)

The closing bracket for spam if statement is not placed at the end of the original sub send_email but a good while further below enclosing some additional subs.

The last 2 mentioned observations are errors IMHO. To correct that, I propose the following:

$Form{'hiddenfield'} should read $query->param('hiddenfield').

Move the closing bracket for spam if statement to approx. line 830, where the original sub send_email ended. (more precisely: place it in front of the } which precedes sub add_error.)


This is all untested guesswork, but I hope it may lead you closer to what you wanted.


Comment on Re: Battling form spam
Select or Download Code
Replies are listed 'Best First'.
Re^2: Battling form spam
by rickaltman (Initiate) on Nov 22, 2010 at 06:15 UTC

    pKai, thank you very much for the reply. In trying to implement your suggested changes, I botched something up. The beginning of the sub send_email routine now looks like this:

    -----------

    sub send_email {

    $query->param('human')

    {

    $FullName = $query->param("FullName");

    etc.

    -----------

    My tests now return this:

    syntax error at form.cgi line 632, near ")

    {"

    syntax error at form.cgi line 832, near "}"

    Execution of form.cgi aborted due to compilation errors.

    As you can plainly see, I'm pretty lame with all of this so any hand-holding that you can provide would be appreciated. A copy of the script is available at http://betterppt.com/form.txt if you need to see it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://871977]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (14)
As of 2015-07-29 18:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls