writeCode.php 430 B

1234567891011121314151617181920
  1. <?php
  2. include_once '../auth.php';
  3. include_once 'checkCodePathValid.php';
  4. if (isset($_POST['filename']) && isset($_POST['content'])){
  5. $filename = $_POST['filename'];
  6. $content = $_POST['content'];
  7. if (checkIfFilepathAllowed($filename)){
  8. file_put_contents($filename,$content);
  9. }else{
  10. die("ERROR. No permission to write to this file.");
  11. }
  12. echo "DONE";
  13. exit(0);
  14. }else{
  15. die("ERROR. filepath or content undefined.");
  16. }
  17. ?>