SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Referrer

  1. #1
    SitePoint Guru augathra's Avatar
    Join Date
    Jul 2004
    Location
    united states
    Posts
    826
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Referrer

    Hi, I log all the referrers on my index. I looked at a few, and they come up as: XXXX:+++++++++++++++++++++++++++++++++

    Any ideas what this is?

    Modified referrer porn site?

    Lol

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2004
    Location
    tn
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not trying to hijack the thread! But curious, is this a hard thing to set up? I'd like to log my referrers as well. Thanks

  3. #3
    SitePoint Guru augathra's Avatar
    Join Date
    Jul 2004
    Location
    united states
    Posts
    826
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you know the basics of MySQL & PHP, it's insanely easy.
    I made a table with the following:
    CREATE TABLE `referrers` (
    `id` int(255) NOT NULL auto_increment,
    `referrer` text NOT NULL,
    `ip` varchar(255) NOT NULL default '',
    PRIMARY KEY (`id`)
    )

    Then at the top of any page, put:
    PHP Code:
    <?PHP
    // MYSQL connection goes here//
    $ip $_SERVER['REMOTE_ADDR'];
    $referrer $_SERVER['HTTP_REFERER'];
    mysql_query("INSERT INTO referrers (referrer, ip) VALUES ('$referrer', '$ip')");
    mysql_close;
    ?>

  4. #4
    SitePoint Guru augathra's Avatar
    Join Date
    Jul 2004
    Location
    united states
    Posts
    826
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Forgot to note, PHP.net says HTTP_REFERER really can't be trusted

  5. #5
    SitePoint Guru augathra's Avatar
    Join Date
    Jul 2004
    Location
    united states
    Posts
    826
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lol, funny, I was so sure referer (in HTTP_REFERER) was spelled referrer, so i checked it in dictionary.com, this is what it said:

    A misspelling of "referrer" which somehow
    made it into the HTTP standard. A given web page's
    referer (sic) is the URL of whatever web page contains the
    link that the user followed to the current page. Most
    browsers pass this information as part of a request.

    Lol

  6. #6
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I used to get the same thing on a site I ran before! Im sure it was so kind of 'unfriendly' site! Like you say, could be a porn site! Do you still get an IP address inserted into your log?

    Mark

  7. #7
    SitePoint Enthusiast
    Join Date
    Nov 2004
    Location
    tn
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks man I'm gunna check this out today.

    Now.. it stores an IP it would appear. Is this the users or the servers they are coming from? I assume the servers, but at some point soon I'll also need to start logging the users. Just as easy?

  8. #8
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its the IP address the user is browsing with, However if they are on dialup it will change a lot.

    Mark


Bookmarks

Posting Permissions

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