Re: PHP4 vs PHP5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A simplified version of this would be:
$glb_http_ref = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER']
: "";

or just:
$glb_http_ref = @$_SERVER['HTTP_REFERER'];

The latter will suppress the error message and return a null (or a blank as
far as PHP is concerned. Not the cleanest route and I prefer the first
method, but just thought I would get some options out there. :)


On 1/7/06, Gerry Danen <gdanen@xxxxxxxxx> wrote:
>
> On 1/7/06, Kevin Waterson <kevin@xxxxxxxxxxx> wrote:
> >
> > This one time, at band camp, Gerry Danen <gdanen@xxxxxxxxx> wrote:
> >
> > > I'm wondering if $_SERVER['HTTP_REFERER'] is no longer supported, or
> > perhaps
> > > has a new name?
> >
> > still there, same name.
> >
> > print_r($_SERVER);
>
>
> Ah, yes. It's there when the page is actually referred from somewhere,
> otherwise it's not.
>
> Thanks, Kevin.
>
> Now my simple assignment becomes a conditional assignment to avoid clutter
> in the error log:
>
> if ( isset($_SERVER['HTTP_REFERER']) )
>     $glb_http_ref    =    $_SERVER['HTTP_REFERER'];
> else
>     $glb_http_ref    =    "";
>
> instead of
>
> $glb_http_ref =  $_SERVER['HTTP_REFERER'];
>
> Learning as I go... :)
>
> Gerry
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux