superglobal help

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

    superglobal help

    How would you translate the following script into something that would
    work with register globals set to 'off'?

    ---

    $envs = array("HTTP_REF ERER", "HTTP_USER_AGEN T", "REMOTE_ADD R",
    "REMOTE_HOS T", "QUERY_STRI NG", "PATH_INFO" );

    foreach($envs as $env) {
    if(isset($$env) )
    print("$env: ${$env}<br />\n");
    }

    ---

    The obvious solution would be to change

    if(isset($$env) )
    to
    if(isset($_SERV ER[$env]))

    however that doesn't work. Any ideas? Thanks.
  • Tom Thackrey

    #2
    Re: superglobal help


    On 27-Apr-2004, wmarcello@hotma il.com (Will) wrote:
    [color=blue]
    > How would you translate the following script into something that would
    > work with register globals set to 'off'?
    >
    > ---
    >
    > $envs = array("HTTP_REF ERER", "HTTP_USER_AGEN T", "REMOTE_ADD R",
    > "REMOTE_HOS T", "QUERY_STRI NG", "PATH_INFO" );
    >
    > foreach($envs as $env) {
    > if(isset($$env) )
    > print("$env: ${$env}<br />\n");
    > }
    >
    > ---
    >
    > The obvious solution would be to change
    >
    > if(isset($$env) )
    > to
    > if(isset($_SERV ER[$env]))
    >
    > however that doesn't work. Any ideas? Thanks.[/color]

    if(isset($_SERV ER[$$env]))



    --
    Tom Thackrey

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

    Comment

    • Terence

      #3
      Re: superglobal help

      Tom Thackrey wrote:[color=blue]
      >
      > if(isset($_SERV ER[$$env]))
      >
      >
      >[/color]

      you mean

      if(isset($_SERV ER[$env]))
      ------------ And now a word from our sponsor ------------------
      Do your users want the best web-email gateway? Don't let your
      customers drift off to free webmail services install your own
      web gateway!
      -- See http://netwinsite.com/sponsor/sponsor_webmail.htm ----

      Comment

      Working...