[sclug] The SCLUG survey !!!
John Stumbles
john at stumbles.org.uk
Mon Feb 14 19:52:28 UTC 2005
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).
--
John Stumbles mobile 0780 866 8204
plumbing:heating:electrical:property maintenance home 0118 954 2406
More information about the Sclug
mailing list