NetTalk Central

Author Topic: track incoming IP address  (Read 6846 times)

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
track incoming IP address
« on: July 30, 2008, 12:03:46 PM »
Is there any way to track the incoming IP address?

I need to keep a log of activity of what users are inserting, changing or deleting records but would also like to track the IP address for the auditors as well to help (I know it's not fool proof) prove that someone was not just logging in with someone else's login.

Any other ideas?

Cheers,

Kevin

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: track incoming IP address
« Reply #1 on: July 30, 2008, 12:17:08 PM »
Yup, that would be: p_web.RequestData.FromIP

Also handy:

p_web.WholeURL     
p_web.RequestFileName
p_web.RequestReferer

I use these to track my own sort of log file on my website. I use an inline page call to a program I wrote in NetTalk that does nothing but track this data into a log. The entirety of my procedure's code is in a NetWebPage proc called HitLogger. In the procedure setup I have the code:

   OPEN(WebLog,ReadWrite+DenyNone)
   WEB:SysID=Today() & Clock()
   WEB:HitDate=Today()
   WEB:HitTime=Clock()
   WEB:HitPage=p_web.WholeURL     
   WEB:PageName=p_web.RequestFileName
   WEB:Referrer=p_web.RequestReferer
   WEB:ClientIP=p_web.RequestData.FromIP
   ADD(WebLog)
   CLOSE(WebLog)
Mike Grigsby
Credify Systems
Central Oregon, USA

Alan Telford

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Re: track incoming IP address
« Reply #2 on: July 30, 2008, 04:35:18 PM »
Can you elaborate on how you do the inline page call.
i.e. when/where do you call your hitlogger() procedure?

Thanks

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: track incoming IP address
« Reply #3 on: July 30, 2008, 05:43:44 PM »
Sure. First, the HitLogger proc has no text and no headers or footers. It's just a page with the same color as the web page it is meant to display on. You can see (or not see<g>), my website at hrsnap.com and view the source, but this is the code (I included the cell code just to give it context):

 <td colspan="2" width="12"><iframe id="InlineFrame4" name="InlineFrame2" src="http://216.228.174.169:89/HitLogger" width="12" height="9" frameborder="0"></iframe></td>

Everytime the web page is loaded, the HitLogger is automatically called and it basically just logs their info. So along with the RequestFileName and RequestReferer that I mentioned, I can track the progress of the visitor through my website. Someday I'll figure out how to make a tracert proc for NetTalk to find out the URL of the associated IP address.

I have a program I run that does nothing but handle the forms, requests, logging, etc. for my website. So what I end up with is a log per the attached image.

[attachment deleted by admin]
« Last Edit: July 30, 2008, 05:49:41 PM by Mike Grigsby »
Mike Grigsby
Credify Systems
Central Oregon, USA

Alan Telford

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Re: track incoming IP address
« Reply #4 on: July 31, 2008, 12:44:46 PM »
Thanks for sharing. That helps!

I'm slightly puzzled because it looks as if your "HITPAGE" is always going to be "HitLogger" and is therefore redundant (unless you have multiple hit logger procedures).
So I guess the real valuable part is the "RequestReferrer" which is always the page which calls the hitlogger.

I had a play and ending up putting the logging code into my "PageHeaderTag".
So, any pages which use the common header will automatically log their information.  This saved me from having to insert the code into my pages.

Thanks again for sharing. i'd been meaning to add some logging for a long time.

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: track incoming IP address
« Reply #5 on: July 31, 2008, 02:52:07 PM »
Alan, Yes, you're right, or course. This is a work in progress, and as I say, I'm just experimenting. Eventually I want to put the Tracert result on one of those columns. I was mainly trying to see what was returned from the NTW functions.
Mike Grigsby
Credify Systems
Central Oregon, USA

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: track incoming IP address
« Reply #6 on: July 31, 2008, 05:29:45 PM »
Actually, I have a correction. Hitlogger is not always the same if different pages use additional parameters. On the screen shot, they all show just HitLogger, which to me, indicates it is a hit to my home page.

On other pages, I call the inline frame by putting a parameter behind it, like 192.168.0.100/hitlogger?About_Page. Then th hitlogger entry is not the same. Sorry for the confusion. My screen shot didn't show that.
Mike Grigsby
Credify Systems
Central Oregon, USA

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11179
    • View Profile
Re: track incoming IP address
« Reply #7 on: August 01, 2008, 05:31:13 AM »
Hi Kevin,

Mikes explanation is great. I can add very little except to say;

you can get the IP of the current request using
p_web.GetSessionIP()
Thus anywhere you are currently logging stuff, you can add the IP number of the client to your log.

Cheers
Bruce