|
I have noticed that the IP address that is logged for some of the users of my forum are sometimes reporting as their local IP address when behind a NAT firewall. Is this the function that interrogates the IP address of the PC when posting a message?. This is from functions_common.asp
--------------------------------------------%>----------------------------------------------
'****************************************** '*** Get users IP address *** '******************************************
Private Function getIP()
Dim strIPAddr
'If they are not going through a proxy get the IP address If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
strIPAddr = Request.ServerVariables("REMOTE_ADDR")
'If they are going through multiple proxy servers only get the fisrt IP address in the list (,) ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
'If they are going through multiple proxy servers only get the fisrt IP address in the list (;) ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
'Get the browsers IP address not the proxy servers IP Else strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR") End If
'Remove all tags in IP string strIPAddr = removeAllTags(strIPAddr)
'Place the IP address back into the returning function getIP = Trim(Mid(strIPAddr, 1, 30)) End Function
--------------------------------------------%>----------------------------------------------
In another bit of my code in default.asp I am using:
Request.ServerVariables("REMOTE_ADDR") and it is showing the 'Internet' address rather than the local PC ip address and so is showing what I want. This is required if anyone posts bad information I can look up their ISP and take legal action if required. I have seen some posts to my forum that are showing local 192.xxx.xxx.xxx addresses. Can someone tell me if this is the correct file I should be editing to fix my problem.
Cheers
Justin
|