logging referring ip address

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

logging referring ip address

Post by kendall »

Hello,

i am current developing an ad system that logs the ip address of the web page that shows the banner. i was using the $_SERVER['HTTP_REFERER'] but read that this is an unsure thing. Is there anything else that could give me a more accurate info. im using php 4.2


kendall
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

require them to send an id that tells you what site it is?
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

feyd,

I dont understand what you ment there. what is the $_SERVER['REMOTE_HOST'] ?

Kendall
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$_SERVER wrote:'REMOTE_HOST'

The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user.

Note: Your web server must be configured to create this variable. For example in Apache you'll need HostnameLookups On inside httpd.conf for it to exist. See also gethostbyaddr().
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

What feyd suggested in his first reply was to have the banner link include the url or id of the site - so you reply on the link itself rather than the user.
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

feyd,

lol....of course i know that!!!...but i wanted to no what it meant.

kettle_drum....ooooohhhhhhhh i see

kendall
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it means exactly what the description says: it's the DNS name of the remote address accessing the page.
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

feyd,

sorry for my ignorance. i was wondering "whose" remote address was it the user or the web page. im using a method that allows the banner script to be accessed via a

Code: Select all

<script src="url to script"></script>
while i am implimenting the suggestion i want a more simple method. Isnt there a more dynamic way of getting the page that a banner shows up on?

Kendall
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

without some help from the requesting page, not really. You can use Javascript to pass the url to your scripts by making the image come from a image dropping script.

window.location.href is the full url Javascript would see. Granted, this requires that the client has Javascript turned on.
Post Reply