[sclug] The SCLUG survey !!!

Alan Pearson alandpearson at yahoo.com
Mon Feb 14 20:09:02 UTC 2005


This wasn't intended to be a script debugging exercise... I do enough of that 
at work...!

Right you miserable lot.. it will now spew all the env variables when it 
detects a duplicate IP.

Give it hell and send me (off list) the results.

Cheers
AlanP


On Monday 14 February 2005 19:52, John Stumbles wrote:
> Alan Pearson wrote:
> > Here we go again on the merry go round...
> > I've made a change :
> >
> > $q = new CGI ;
> > $ipFwdFor = $q->http('HTTP_FORWARDED_FOR') ;
> > $ipXFwdFor = $q->http('X_HTTP_FORWARDED_FOR') ;
> >
> > if ( $ipFwdFor ) {
> >         $ipaddr = $ipFwdFor ;
> > } elsif ( $ipXfwdFor ) {
> >         $ipaddr = $ipXFwdFor ;
> > } else {
> >         $ipaddr = remote_host() ;
> > }
>
> tsk! tsk! surely you mean:
>
> use warnings;
> use strict;
> my $q = new CGI ;
> my $ipFwdFor = $q->http('HTTP_FORWARDED_FOR') ;
> my $ipXFwdFor = $q->http('X_HTTP_FORWARDED_FOR') ;
> my $ipaddr = $ipFwdFor || $ipXFwdFor || remote_host() ; # should work
>
> > You can see that it now uses whichever ip addr it finds first, searching
> > FwdFor, XFwdFor and then real ip address.
> >
> > Could you guys who were having trouble before try it and let me know ?
>
> Nope:
>
> There was an error:
> A vote from your IP address (62.253.96.44) has already been received.
> Only one vote is allowed per IP address.
>
> (from http://www.alandpearson.f2s.com/cgi-bin/survey/survey.cgi - that's
> right, isn't it?)
>
> Would it help if you printed a dump of http env vars with the error
> message so those of us having problems (or is it just me? :-) could
> report what we're sending you (even if you can get that from your server
> logs it'd save you that hassle).

-- 
AlanP


More information about the Sclug mailing list