Complete PHP Noob Needs Help on Send To A Friend Form

Discussion in 'PHP' started by reefwalker, Jul 11, 2008.

  1. #1
    Hi everyone.

    I'm having some issues implementing a send to friend pop-up. The program completely works with one exception. On occasion the link which is retreived by and responsible for sending the link in a email...:

    <? $refurl = $_SERVER['HTTP_REFERER']; ?>
    <? print $refurl;?>


    is not always displaying to the users.

    The email comes out like this:

    ======================

    USER has used your recommendation form using an email address of

    The people the recommendation has been submitted to are:







    The page recommended:

    ========================

    As you can see the page recommended is BLANK! But other times the link is there?

    Could it be due to the fact too many people are using this form? I had quite a traffic surge yesterday but nothing too big.

    I got the script form hotscripts. Here is the file info if any of you want to look it up:

    // This following statement must not be changed.
    // Copyright (c) Michael Bloch and Taming The Beast.
    // Tell-A-Friend script V 2.1 Updated September 19 2006
    // Taming the Beast.net - http://www.tamingthebeast.net
    // Free Web Marketing and Ecommerce Resources and Tools
    // By using this script you agree to indemnify Taming the Beast
    // from from any liability that might arise from its use.
    // The preceding statement must not be changed.

    Like I said I'm a noob. Is this sufficient info find out why it's not working or do you need the link to the site? Source code? :confused:

    Thanks for your patience and muchas gracias in advance!
     
    reefwalker, Jul 11, 2008 IP
  2. JLEville

    JLEville Peon

    Messages:
    147
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you don't print it....you just have to include that in your mail function as a variable.
     
    JLEville, Jul 11, 2008 IP
  3. reefwalker

    reefwalker Peon

    Messages:
    48
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the response. I have to get the link from the page so the above

    <? $refurl = $_SERVER['HTTP_REFERER']; ?>
    <? print $refurl;?>

    is in the actual form. I then have another handler file that places the variable in the email and sends. Hope I've managed to explain myself better.
     
    reefwalker, Jul 11, 2008 IP
  4. JLEville

    JLEville Peon

    Messages:
    147
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Some servers do not send the HTTP_REFERER information...so that could be your problem. Just to make sure, you know that the HTTP_REFERER will give you where the user is navigating to your site from.
     
    JLEville, Jul 11, 2008 IP
  5. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #5
    Just attach a $_GET variable to the link (which points to the form) then read this variable, more reliable than trusting the browser to send the referer information.

    Dan
     
    Danltn, Jul 11, 2008 IP
  6. reefwalker

    reefwalker Peon

    Messages:
    48
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Like I said, sometimes it send other times it doesn't. If the server didn't send the http_referer it would not send it all the time not just every now and then. Any other ideas?
     
    reefwalker, Jul 11, 2008 IP
  7. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #7
    You don't depend on the server to get the HTTP_REFERER string, you depend upon the browser.

    Dan
     
    Danltn, Jul 11, 2008 IP
  8. JLEville

    JLEville Peon

    Messages:
    147
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    It can be a browser or server problem.
     
    JLEville, Jul 11, 2008 IP
  9. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #9
    What sort of circumstances would have to happen for it to be a server problem?

    '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.
    Code (markup):
    Off PHP.net...
     
    Danltn, Jul 11, 2008 IP