Results 1 to 3 of 3

Thread: Display message for visitors from specific website

  1. #1

    Display message for visitors from specific website

    This code doesn't work. I would like to display a message for visitors who arrive from a specific website address.

    PHP Code:
    if (strpos($_SERVER['HTTP_REFERER'], "http://www.studiopress.com") === 0) { 
    I'm using it in a custom function however i have also used it in a template with PHP tags.

  2. #2
    Join Date
    Aug 2004
    Do you have any ability to change anything on the studiopress site? If so, a more robust solution might be to have the links there include a URL parameter to could look for in $_GET, since $_SERVER['HTTP_REFERER'] is not guaranteed to be set, nor what it's actual content/format might be. If you do use it, you might want to use stripos() to make it case-insensitive, and possibly just look for the domain:
    PHP Code:
    if (stripos($_SERVER['HTTP_REFERER'], "studiopress.com") !== false) { 
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    No . I only used that domain as an example.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this 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
HTML5 Development Center