Results 1 to 5 of 5
  1. #1
    pph Expert! Gordon's Avatar
    Join Date
    January 18th, 2005
    Location
    Edmonton Canada
    Posts
    5,781
    Can anyone tell me why the "referrer" and "user_browser" will not work? The other 3 work just fine but no matter how I've written the referrer and user_browser they won't work.

    $getdate = date( "Y-m-d" );// Get the date for the database.
    $gettime = date( "h:i:s A" );// Get the time.
    $user_ip = $_SERVER['REMOTE_ADDR'];// Get the users IP.
    $user_browser = $_SERVER['HTTP_USER_AGENT'];// Get the browser type.
    $referrer = $_SERVER['HTTP_REFERER'];// Get the refering page.
    One day parasites and their ilk will be made illegal, I bet a few Lawyers will be pissed off when the day comes.
    Mr. Spitzer is fetching it nearer

    YouTrek

  2. #2
    Member
    Join Date
    January 18th, 2005
    Posts
    69
    Are those 3 returning anything at all ?

    <edit>FYI you should also look up http_x_forwarded_for </edit>

    Breezing

  3. #3
    pph Expert! Gordon's Avatar
    Join Date
    January 18th, 2005
    Location
    Edmonton Canada
    Posts
    5,781
    I thought the IP one was working but it is not so no none of the bottom three will give me any results at all. I do not understand your edit could you explain a little please?

    thanks
    One day parasites and their ilk will be made illegal, I bet a few Lawyers will be pissed off when the day comes.
    Mr. Spitzer is fetching it nearer

    YouTrek

  4. #4
    Member
    Join Date
    January 18th, 2005
    Posts
    69
    That's odd, anyway...

    Create a page with just:

    <?php
    phpinfo();
    echo($_SERVER['REMOTE_ADDR']);
    ?>

    and see if that page returns the values you want.

    About the edit...

    $user_ip = $_SERVER['REMOTE_ADDR'];// Get the users IP.
    there's remote_addr and there's http_x_forwarded_for.

    For example, I am required by my ISP to use a proxy server (so in this case remote_addr will return the proxy's server IP address ). If I would browse your website I would also send you a variable called http_x_forwarded_for which is my real IP address and not the proxy's.

    So I'm not sure what you are using this script for but you might want to check both.

    Mind you, this isn't bulletproof even when using both remote_addr and http_x_forwarded_for.


    Hope that made sence,
    Breezing

  5. #5
    ABW Ambassador FFoc's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,015
    from php.net:
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>'HTTP_REFERER'

    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. <HR></BLOCKQUOTE>

    Ditto user agent. Opera isn't the only one that can fudge its string, ya know..
    “An adventure is an inconvenience rightly considered. An inconvenience is an adventure wrongly considered.” - G.K. Chesterton

  6. Newsletter Signup

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •