Simple PHP question.

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

    Simple PHP question.

    Hi,

    Just set up PHP (PHP Version 4.3.3) as a CGI on a WIN2k server and tried
    this:


    <?php

    echo $REMOTE_ADDR;

    print "This is PHP...";

    ?>

    And I get this error:


    Notice: Undefined variable: REMOTE_ADDR ...

    Is there some module I may be missing?

    Thanks,

    S


  • DvDmanDT

    #2
    Re: Simple PHP question.

    Nope, it's register_global s.. Read manual... It's in PHP.ini..

    --
    // DvDmanDT
    MSN: dvdmandt@hotmai l.com
    Mail: dvdmandt@telia. com
    "Stefan" <nickm@studiowe b.com> skrev i meddelandet
    news:1a%ab.1413 1$hF3.1597308@n ews20.bellgloba l.com...[color=blue]
    > Hi,
    >
    > Just set up PHP (PHP Version 4.3.3) as a CGI on a WIN2k server and tried
    > this:
    >
    >
    > <?php
    >
    > echo $REMOTE_ADDR;
    >
    > print "This is PHP...";
    >
    > ?>
    >
    > And I get this error:
    >
    >
    > Notice: Undefined variable: REMOTE_ADDR ...
    >
    > Is there some module I may be missing?
    >
    > Thanks,
    >
    > S
    >
    >[/color]


    Comment

    • rush

      #3
      Re: Simple PHP question.

      "Stefan" <nickm@studiowe b.com> wrote in message
      news:1a%ab.1413 1$hF3.1597308@n ews20.bellgloba l.com...
      [color=blue]
      > Is there some module I may be missing?[/color]

      Nope, you are running code in style that is about to becomme obsolete.

      Try:

      echo $_SERVER['REMOTE_ADDR'];

      The change is that now register_global s option is by default turned off
      which means you can no longer access REMOTE_ADDR as global, but instead you
      have to look into the $_SERVER super global.

      The change is for the better since register_global turned to on had some
      grim security implications.

      rush
      --
      Get your very own domain easily. Fast and professional customer service.




      Comment

      Working...