Referer Data - Please HELP.

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
andrewt
Forum Newbie
Posts: 11
Joined: Fri Aug 08, 2003 8:18 am
Location: Sydney, Australia

Referer Data - Please HELP.

Post by andrewt »

Hi Guys,

Would it be possible to grab some back-end data,
eg ip address, FQN of referers site?

Thanks bunch... :lol:
Andrew
User avatar
Kriek
Forum Contributor
Posts: 238
Joined: Wed May 29, 2002 3:46 am
Location: Florida
Contact:

Post by Kriek »

See Predefined Variables associated with the $_SERVER superglobal array.

Code: Select all

<?php
    /*
    The address of the page (if any) which referred the user agent to the current
    page. This is set by the user agent. Not all user agents will set this, and some
    provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really
    be trusted.
    */
	
    echo $_SERVER['HTTP_REFERER'];
	
    /*
    The IP address from which the user is viewing the current page.
    */
	
    echo $_SERVER['REMOTE_ADDR'];
	
    /* 
	Contents of the User_Agent: header from the current request, if there is one.
    This is a string denoting the user agent being which is accessing the page. A
    typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Among other things,
        you can use this value with get_browser() to tailor your page's output to the
    capabilities of the user agent.
    */
	
    echo $_SERVER['HTTP_USER_AGENT'];
?>
Post Reply