<?php

error_reporting(0);

if (!empty($_GET['file']))
{
   $file = './files/' . $_GET['file'];

   if($_GET['action'] == 'save')
   {
      $fileContents = $_GET['fileContents'];

      $handle = fopen($file, 'w+');
      fwrite($handle, $fileContents);
      fclose($handle);
   }
   else
   {
      $loadedFile = file_get_contents($file);
      print "fileContents=" . $loadedFile;
   }
}

?>