VB icon

DHCP Finder

Email
Submitted on: 1/5/2015 9:01:00 AM
By: manikantan (from psc cd)  
Level: Intermediate
User Rating: By 2 Users
Compatibility: ASP (Active Server Pages)
Views: 732
 
     This Code WIll use cdonts.dll to mail the site owner about the hit that was made to his site 1)Country From Which the Hit was Made 2)The Browser That Was Used 3)Time 4)Date
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: DHCP Finder
' Description:This Code WIll use cdonts.dll to mail the site owner
about the hit that was made to his site
1)Country From Which the Hit was Made
2)The Browser That Was Used
3)Time
4)Date
' By: manikantan (from psc cd)
'
' Returns:1)Country From Which the Hit was Made
2)The Browser That Was Used
3)Time
4)Date
'
' Assumes:Install cdonts.dll in the IIS
'**************************************

<% 
'code by Manikantan
'Web Developer 
'3rd Agenda
'Nungambakkam
'Chennai
'India
Dim RIPAddress 
Dim UAgent 
Dim strgetTime 
RIPAddress = Request.ServerVariables("REMOTE_ADDR") 
reg=split(RIPaddress,".")
'check for American regions
' Increase The Numbers into Subdomains to Find The Exact Location
if cint(reg(0))<=207 and cint(reg(0))>=204 then 
region="North America or South America or Caribbean or Saharan Africa" 
end if
if reg(0)="196" or reg(0)="198" or reg(0)="199" or reg(0)="200" or reg(0)="216" or reg(0)="208" or reg(0)="209" then
region="American regions Inclucding Caniberra and Saharian region" 
end if
'Check for Asian Regions
'Increase the Check for Accuracy
if reg(0)="202" or reg(0)="203" or reg(0)="210" or reg(0)="211" or reg(0)="169" or reg(0)="61" or reg(0)="24" then
region="Asian pacific region like India,Afghan" 
end if
if region <>"Asian pacific region like India,Afghan" then 
if region<>"American regions Inclucding Caniberra and Saharian region" then
region="European Region,North Africa,Russian region"
end if
end if
UAgent = Request.ServerVariables("HTTP_USER_AGENT") 
strgetTime = FormatDateTime(Now(),vbLongDate) 
' you need cdonts.dll for this
' Anyother Mailer like abmailer.dll can be used instead
Dim myMail 
Set myMail = Server.CreateObject("CDONTS.NewMail") 
myMail.To = "youremail@home.com" 
myMail.From = "admin@yourwebsite.com" 
myMail.Subject = "You Have a Visitor " & strgettime 
Body = "A visitor had visited your site:" & vbCrlf
Body = Body & "His DHCP Ip Was: " & RIPAddress & vbCrlf 
Body = Body & "His Agent Was: " & UAgent & vbCrlf 
Body = Body & "Date: " & strgetTime & vbCrlf 
Body = Body & "The Hit was Approximately From" & vbcrlf
Body = Body & "<b>" & region & "</b>" & vbcrlf
myMail.Body = Body 
myMail.Send 
Set myMail = nothing 
%> 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.