Forums

This topic is locked

Static vs. dynamic IP logging - Strange behavior

Posted 30 Aug 2001 04:38:57
1
has voted
30 Aug 2001 04:38:57 Martin Ruppert posted:
<font face='Arial'>Hi!

I wrote a little page that logs IP addresses of visitors who access a
password protected area on my website. To retrieve the IP address I
used the Request.ServerVariables("REMOTE_ADDR"command. So, when
somebody logs into my website, his/her IP address and additional user
information (from the login page) are stored in a access log (SQL2000
table). In order to submit the insert record form, I added the
onUnload=document.form.submit... to the body tag and a redirect after
2 seconds in the header tag.

The funny thing is, that it all works just fine if I access the page
via a fixed IP address (the access is logged), but if I use my dial up
connection which obviously assigns a new IP addess every time I go
online, it doesn't log that access. However, if i change the code on
the logging page; add a submit button and remove the onUnload &
redirect code, it works fine again.

Any suggestions? Any help would be greatly appreciated!

Martin

Below is the non-working code - I used Ultradev to build the page:

&lt;meta http-equiv="refresh" content="2;URL=DocOverview.asp"&gt;
&lt;/head&gt;
&lt;body bgcolor="#153785" text="#000000"
onUnload="document.accesslog.submit()"&gt;
&lt;p&gt;&nbsp;&lt;/p&gt;
&lt;p&gt;&nbsp; &lt;/p&gt;
&lt;p align="center"&gt;&lt;b&gt;&lt;font face="Arial, Helvetica, sans-serif"
size="7" color="#CCCCCC"&gt;Login
Page is being processed.......&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&nbsp; &lt;/p&gt;
&lt;form method="POST" action="&lt;%=MM_editAction%&gt;" name="accesslog"&gt;
&lt;table align="center"&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;:&lt;/td&gt;
&lt;td&gt; &lt;font color="#FFFFFF"&gt;
&lt;input type="hidden" name="AccessIP" value="&lt;%=
Request.ServerVariables("REMOTE_ADDR" %&gt;" size="32"&gt;
&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;&nbsp;&lt;/td&gt;
&lt;td&gt; &lt;font color="#FFFFFF"&gt;
&lt;input type="hidden" name="UserID"
value="&lt;%=(User.Fields.Item("UserID".Value)%&gt;" size="32"&gt;
&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;&nbsp;&lt;/td&gt;
&lt;td&gt; &lt;font color="#FFFFFF"&gt;
&lt;input type="hidden" name="AccessTime"
value="&lt;%=(User.Fields.Item("CurrentVisit".Value)%&gt;" size="32"&gt;
&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;&nbsp;&lt;/td&gt;
&lt;td&gt; &lt;font color="#FFFFFF"&gt;
&lt;input type="hidden" name="FullName"
value="&lt;%=(User.Fields.Item("FullName".Value)%&gt;" size="32"&gt;
&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;&nbsp; &lt;/td&gt;
&lt;td&gt;&lt;font color="#FFFFFF"&gt;&lt;/font&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</font id='Arial'>

Reply to this topic