[Zope] DTML or ZPT to show browser's IP?

Terry Hancock hancock at anansispaceworks.com
Thu Mar 11 15:31:16 EST 2004


On Thursday 11 March 2004 11:24 am, Michael Dexter wrote:
> Might someone be willing to point me in the right direction of how I 
> might insert a simple tag to show the browser's IP address? Is this a 
> simple global to be echoed or is more involved?

Create a DTML method object called "test_request" with these
contents:

"""
<dtml-var standard_html_header>
<dtml-var REQUEST>
<dtml-var standard_html_footer>
"""

You will find this a really educational experience. ;-D

Doing so, I find that REMOTE_ADDR is probably what you
want, although if you are running behind Apache as
I am doing (and as I think is most common), it will be
HTTP_X_FORWARDED_FOR.  Could be more complicated
if you are running a caching proxy server like Squid or
something.

But look at what the above script gives you on your
server, and it should be pretty easy to figure out.

Cheers,
Terry



--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com



More information about the Zope mailing list