Private Sub ip()
Dim root As DirectoryEntry = New DirectoryEntry("WinNT:")
Dim domains As DirectoryEntries = root.Children
domains.SchemaFilter.Add("domain")
Dim domain As New DirectoryEntry
For Each domain In root.Children
ListBox3.Items.Add("主机" + "****" + domain.Name + "****")
Dim computers As DirectoryEntry
For Each computers In domain.Children
If (computers.Name <> "Schema") Then
ListBox3.Items.Add(computers.Name)
End If
Next
Next
End Sub
Function getIP()
Dim strIPAddr
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
strIPAddr = Request.ServerVariables("REMOTE_ADDR")
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)
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)
Else
strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
End If
getIP = Trim(Mid(strIPAddr, 1, 30))
End Function