PHP Modifying Linux Text File

by 3 replies
4
#programming #file #linux #modifying #php #text
  • Here is a tutorial on how to use PHP to write to files in the filesystem.
    PHP Tutorial - File Write

    If its a straighforward append to the end of the list, then that should do it, If the IP address has to go in a specific location in the file, it wil get a little more complex.

    You will need to load the file into a variable then do a search and replace for the location it needs to go before writing it again.
    • [1] reply
    • Another great starting place is the PHP manual:

      PHP: Filesystem Functions - Manual
      PHP: Directory Functions - Manual

      Make yourself a cup of tea and play around, look at the examples. Here's some pseudo code for you:

      display form:

      open directory
      display list of files in an <select>/<option> html-element
      allow creation of new file

      save ip:

      open/create relevant file
      write ip
      close file
  • if you have time try to learn and do it yourself it might take you a couple of days but keep an open mind to learn new things otherwise you could hire somebody.
    I'm sure it'll cost you max 20-30$ ... unless you add more stuff to the task

Next Topics on Trending Feed