Unable to use $_SERVER['HTTP_REFERER']

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jez

    Unable to use $_SERVER['HTTP_REFERER']

    Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
    shared hosting account (PHP 4.1.2), but I can on my local server (PHP
    4.3.3)?

    I imagine it has something to do with the different versions of PHP or
    perhaps php.ini, but I'm not sure what?

    Thanks!

    Jez
  • Anthony Whitehead

    #2
    Re: Unable to use $_SERVER['HTTP_REFERER']

    On Mon, 06 Oct 2003 23:56:31 -0700, Jez wrote:
    [color=blue]
    > Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
    > shared hosting account (PHP 4.1.2), but I can on my local server (PHP
    > 4.3.3)?
    >
    > I imagine it has something to do with the different versions of PHP or
    > perhaps php.ini, but I'm not sure what?[/color]

    Have you tried adding a quick phpinfo(); to your script to make sure that
    the hosting web server is actually providing the referer information?

    /Ant



    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

    Comment

    • Jez

      #3
      Re: Unable to use $_SERVER['HTTP_REFERER']

      jez.hailwood@bt internet.com (Jez) wrote in message news:<ad15f8ee. 0310062256.3cb6 efd6@posting.go ogle.com>...[color=blue]
      > Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
      > shared hosting account (PHP 4.1.2), but I can on my local server (PHP
      > 4.3.3)?
      >
      > I imagine it has something to do with the different versions of PHP or
      > perhaps php.ini, but I'm not sure what?
      >
      > Thanks!
      >
      > Jez[/color]

      The reason I ask is that I've created a 'send to friend' page which
      obviously needs to know the url of the referring page.

      I've found a solution, but I'm unsure whether it's ok to use:

      Rather than use $_SERVER['HTTP_REFERER'] on the 'send to friend' page,
      I've used send.php?page=h ttp://$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']
      in the link on the referring page.

      It works, and although it's not the best solution is it a good one?

      Jez

      Comment

      • Tom Thackrey

        #4
        Re: Unable to use $_SERVER['HTTP_REFERER']


        On 6-Oct-2003, jez.hailwood@bt internet.com (Jez) wrote:
        [color=blue]
        > Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
        > shared hosting account (PHP 4.1.2), but I can on my local server (PHP
        > 4.3.3)?
        >
        > I imagine it has something to do with the different versions of PHP or
        > perhaps php.ini, but I'm not sure what?[/color]

        The browser may choose not to provide referer information.

        --
        Tom Thackrey

        tom (at) creative (dash) light (dot) com
        do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

        Comment

        • Randell D.

          #5
          Re: Unable to use $_SERVER['HTTP_REFERER']


          "Jez" <jez.hailwood@b tinternet.com> wrote in message
          news:ad15f8ee.0 310062256.3cb6e fd6@posting.goo gle.com...[color=blue]
          > Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
          > shared hosting account (PHP 4.1.2), but I can on my local server (PHP
          > 4.3.3)?
          >
          > I imagine it has something to do with the different versions of PHP or
          > perhaps php.ini, but I'm not sure what?
          >
          > Thanks!
          >
          > Jez[/color]

          The browser might not provide HTTP_REFERER so you cannot rely on it -
          Secondly, some software firewalls (like Norton Internet Security) have
          features to strip out such information... It might work on your local server
          if your local server is also your client....


          Comment

          • Timo Henke

            #6
            Re: Unable to use $_SERVER['HTTP_REFERER']

            [color=blue]
            > "Jez" <jez.hailwood@b tinternet.com> wrote in message
            > news:ad15f8ee.0 310062256.3cb6e fd6@posting.goo gle.com...[color=green]
            > > Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
            > > shared hosting account (PHP 4.1.2), but I can on my local server (PHP
            > > 4.3.3)?[/color][/color]

            Just print it out to the browser:

            print '<pre><xmp>';
            print_r($_SERVE R);
            print '</xmp></pre>';

            and you see which keys are defined inside $_SERVER @ your hoster.

            regards

            timo

            Comment

            • Justin Koivisto

              #7
              Re: Unable to use $_SERVER['HTTP_REFERER']

              Jez wrote:
              [color=blue]
              > jez.hailwood@bt internet.com (Jez) wrote in message news:<ad15f8ee. 0310062256.3cb6 efd6@posting.go ogle.com>...
              >[color=green]
              >>Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
              >>shared hosting account (PHP 4.1.2), but I can on my local server (PHP
              >>4.3.3)?
              >>
              >>I imagine it has something to do with the different versions of PHP or
              >>perhaps php.ini, but I'm not sure what?
              >>
              >>Thanks!
              >>
              >>Jez[/color]
              >
              >
              > The reason I ask is that I've created a 'send to friend' page which
              > obviously needs to know the url of the referring page.
              >
              > I've found a solution, but I'm unsure whether it's ok to use:
              >
              > Rather than use $_SERVER['HTTP_REFERER'] on the 'send to friend' page,
              > I've used send.php?page=h ttp://$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']
              > in the link on the referring page.
              >
              > It works, and although it's not the best solution is it a good one?[/color]

              That's about as reliable as you're gonna get. Not all browsers/web
              servers provide referer info, and still others allow you to set it to
              whatever you want.

              That said, you may not want to provide the entire URL to the send.php
              script. Use only the REQUEST_URI, and put that in a session variable
              instead of a get request. Not doing these things may cause you pain when
              spammers see how easy it will be to use your script for themselves...

              --
              Justin Koivisto - spam@koivi.com
              PHP POSTERS: Please use comp.lang.php for PHP related questions,
              alt.php* groups are not recommended.

              Comment

              • Jez

                #8
                Re: Unable to use $_SERVER['HTTP_REFERER']

                Anthony Whitehead <anthony.whiteh ead@rfv.sfa.se> wrote in message news:<pan.2003. 10.07.11.29.47. 599371@rfv.sfa. se>...[color=blue]
                > On Mon, 06 Oct 2003 23:56:31 -0700, Jez wrote:
                >[color=green]
                > > Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
                > > shared hosting account (PHP 4.1.2), but I can on my local server (PHP
                > > 4.3.3)?
                > >
                > > I imagine it has something to do with the different versions of PHP or
                > > perhaps php.ini, but I'm not sure what?[/color]
                >
                > Have you tried adding a quick phpinfo(); to your script to make sure that
                > the hosting web server is actually providing the referer information?[/color]

                Thanks.

                Just tried it and it's not listed. Does that mean it's a server issue
                rather than a PHP one?

                Jez

                Comment

                • Jez

                  #9
                  Re: Unable to use $_SERVER['HTTP_REFERER']

                  jez.hailwood@bt internet.com (Jez) wrote in message news:<ad15f8ee. 0310070614.6916 33a0@posting.go ogle.com>...[color=blue]
                  > jez.hailwood@bt internet.com (Jez) wrote in message news:<ad15f8ee. 0310062256.3cb6 efd6@posting.go ogle.com>...[color=green]
                  > > Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
                  > > shared hosting account (PHP 4.1.2), but I can on my local server (PHP
                  > > 4.3.3)?
                  > >
                  > > I imagine it has something to do with the different versions of PHP or
                  > > perhaps php.ini, but I'm not sure what?
                  > >
                  > > Thanks!
                  > >
                  > > Jez[/color]
                  >
                  > The reason I ask is that I've created a 'send to friend' page which
                  > obviously needs to know the url of the referring page.
                  >
                  > I've found a solution, but I'm unsure whether it's ok to use:
                  >
                  > Rather than use $_SERVER['HTTP_REFERER'] on the 'send to friend' page,
                  > I've used send.php?page=h ttp://$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']
                  > in the link on the referring page.
                  >
                  > It works, and although it's not the best solution is it a good one?
                  >
                  > Jez[/color]

                  Perhaps $_SERVER['SCRIPT_URI'] would be more appropriate?

                  Comment

                  • Paulus Magnus

                    #10
                    Re: Unable to use $_SERVER['HTTP_REFERER']

                    "Timo Henke" <webmaster@fli7 e.de> wrote in message
                    news:blv1ar$dl3 $01$1@news.t-online.com...[color=blue]
                    >[color=green]
                    > > "Jez" <jez.hailwood@b tinternet.com> wrote in message
                    > > news:ad15f8ee.0 310062256.3cb6e fd6@posting.goo gle.com...[color=darkred]
                    > > > Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
                    > > > shared hosting account (PHP 4.1.2), but I can on my local server (PHP
                    > > > 4.3.3)?[/color][/color]
                    >
                    > Just print it out to the browser:
                    >
                    > print '<pre><xmp>';
                    > print_r($_SERVE R);
                    > print '</xmp></pre>';
                    >
                    > and you see which keys are defined inside $_SERVER @ your hoster.[/color]

                    It could be related to your browser. Most firewall products will block the
                    sending of the HTTP_REFERER information to untrusted sites. If you can't
                    read HTTP_REFERER during testing, try turning your firewall off as it may
                    make a difference. Firewalls create a lot of problems for users and they
                    often blame the web developer for cookie problems, HTTP_REFERER issues and
                    spurious JavaScript errors when its the firewall's interference that has
                    caused the errors to occur. You can, and should, program around cookie and
                    REFERER issues but the JavaScript errors are moderately difficult to code
                    around unless you start using sneaky tactics. Such tactics for legitimate
                    purposes seem a bit bizarre but Symantec and ZoneAlarm create a significant
                    number of support issues through their default settings.

                    Paulus


                    Comment

                    Working...