NYCPHP Meetup

NYPHP.org

[nycphp-talk] relative newbie needs installation help

Hans Zaunere zaunere at yahoo.com
Tue Jun 4 18:42:02 EDT 2002


Change:
  $agent=$HTTP_USER_AGENT;

to:
  $agent=$_SERVER['HTTP_USER_AGENT'];

and that should do the trick.  From first thought, this seems like a
register_globals problem, but maybe it's track_vars or variable_order
or something.  Can't remember off the top.  Do a phpinfo(); to confirm
that that var is actually getting created as well.

HZ


--- Michael Southwell <southwell at dneba.com> wrote:
> Thanks, Klaus.  This suggestion sounded promising but didn't work.  I
> 
> changed register_globals to On and
> rebooted.  But I still got the following error:
> 
> Notice:  Undefined variable:  HTTP_USER_AGENT in
> g:\\dneba\\browsers.php on 
> line 50
> 
> Here is the relevant code (it is obvious which is line 50):
> 
> <CODE>
> Your choice of web browser is the single most important factor in 
> controlling your experience
> of a website.  Your browser seems to be
> 
> <?php
>    $agent=$HTTP_USER_AGENT;
> 
>    $brow="";
> 
>    if ($brow==""){
>      $pos=strpos($agent,"MSIE");
>      if ($pos>0){
>        $brow="MSIE";
>        $level=substr($agent,$pos+5,3);
>        $new=1;}}
> </CODE>
> 
> I think $HTTP_USER_AGENT is about as basic a variable as you can 
> get.  Needless to say,
> this code works perfectly (within its limitations, which no doubt are
> 
> plenty) at http://www.dneba.com/browsers.php.
> 
> So there must be something else going on.
> 
> At 03:10 PM 6/4/2002, you wrote:
> 
> >My first guess is it's a register_globals problem.  register_globals
> is
> >turned off by default in 4.2.1.  CGI vs Apache module shouldn't make
> a
> >difference in this case (I'm assuming you are only using the basic
> >variables, such as the post,get,server variables).
> >
> >As a quick fix, goto your php.ini and find the register_globals
> >directive, changing it to 'On'.  If this works, let us know; if not,
> >what specific variables does it report it can't find/are undefined?
> >
> >Hans Z.
> >
> >
> >--- Michael Southwell <southwell at dneba.com> wrote:
> > > I have some scripts that are working beautifully on the host but
> are
> > > not
> > > working on my localhost installation (which I thought I had
> gotten
> > > working):  PHP 4.2.1 running under Apache 1.3.24 on Windows XP. 
> The
> > > problem comes in recognizing variables locally, so I get
> "undefined
> > > variable" and "undefined constant" messages.  PHPInfo() tells me
> that
> > > my
> > > local Server API is CGI, while on the host it's Apache.  I am
> > > guessing that
> > > this is the cause of the problems, though I don't really
> understand
> > > the
> > > difference.  Can anybody offer an explanation/possible solution?
> > > TIA.
> > >
> > > Michael G. Southwell =================================
> > > DNEBA Enterprises
> > > 81 South Road
> > > Bloomingdale, NJ 07403-1425
> > > 973/492-7873 (voice and fax)
> > > southwell at dneba.com
> > > http://www.dneba.com
> > > ======================================================
> > >
> > >
> > >
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Yahoo! - Official partner of 2002 FIFA World Cup
> >http://fifaworldcup.yahoo.com
> 
> Michael G. Southwell =================================
> DNEBA Enterprises
> 81 South Road
> Bloomingdale, NJ 07403-1425
> 973/492-7873 (voice and fax)
> southwell at dneba.com
> http://www.dneba.com
> ======================================================
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the talk mailing list