[Product-Developers] How to get the user's IP address

Tim Hicks tim at sitefusion.co.uk
Tue Apr 22 16:16:24 UTC 2008


Mark Phillips wrote:
> How do I get an anonymous user's IP address from within a Plone product?
> 
> I want to modify PloneSurvey to return the user's IP address with the
> survey submission. We only use anonymous surveys, so I want some way to
> see if someone is stuffing the survey box. I know an IP address is not
> the best way, but I think in my particular use case it will be
> effective.
> 
> There is a method in PloneSurvey that returns and id for anonymous
> submissions. I just don't know how to access the anonymous user's IP
> address from within Plone.

REQUEST['REMOTE_ADDR']?  Actually, I think there's another way (i.e. 
request key) for when you have a proxy in front of your zope, but I 
forget that now.

Tim




More information about the Product-Developers mailing list