Is this possible?

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

    #1

    Is this possible?

    I'm trying to create what I think should be a simple script. I'm using
    Dreamweaver, which saves a copy of the php page to the web server each time
    you want to view it. I would like to include in include that contains a
    form at the bottom of the page that would be used to save the static content
    of the page being rendered for archiving purposes, but I ONLY want this to
    show up if it's on a certain IP range (ie, I have a network of static IPs
    locally that I want to be able to use this form to save a static copy of the
    page to a filename prefix+timestam p). I'm new to php, and have figured out
    how to do everything as far as creating directories and timestamping stuff
    is concerned, but I'm a bit lost as to how to make this part work. Any
    advice?

    GregoryD


  • milahu

    #2
    Re: Is this possible?

    You can obtain the generated code via PHP's output control functions
    [1].
    Writing files is done using fwrite() [2].
    You can check the client's IP using following code:

    <?php
    $IP = explode('.', $_SERVER['REMOTE_ADDR']);
    if ($IP[0] == '192' && $IP[1] == '168') {
    // Client from 192.168.*
    }
    ?>

    [1] http://www.php.net/outcontrol
    [2] http://www.php.net/fwrite

    Comment

    • GregoryD

      #3
      Re: Is this possible?


      "milahu" <milahu@googlem ail.com> wrote in message
      news:1144074324 .661115.67570@j 33g2000cwa.goog legroups.com...[color=blue]
      > You can obtain the generated code via PHP's output control functions
      > [1].
      > Writing files is done using fwrite() [2].
      > You can check the client's IP using following code:
      >
      > <?php
      > $IP = explode('.', $_SERVER['REMOTE_ADDR']);
      > if ($IP[0] == '192' && $IP[1] == '168') {
      > // Client from 192.168.*
      > }
      > ?>
      >
      > [1] http://www.php.net/outcontrol
      > [2] http://www.php.net/fwrite[/color]

      Thanks! That's exactly what I needed, just didn't know where to look. :)

      GregoryD


      Comment

      Working...