File size: 757 Bytes
1ae558f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
newfile_nameerror = "Please enter a valid file name";
        }
        else {
            $newfile_nameerror = "";
        }
    }
    else {
        $newfile_nameerror = "";
    }

    if (isset($_POST['newfile_content'])) {
        $newfile_content = $_POST['newfile_content'];
        if (empty($newfile_content)) {
            $newfile_contenterror = "Please enter a valid file content";
        }
        else {
            $newfile_contenterror = "";
        }
    }
    else {
        $newfile_contenterror = "";
    }

    if ($newfile_nameerror == "" && $newfile_contenterror == "") {
        $newfile = fopen($newfile_name, "w");
        fwrite($newfile, $newfile_content);
        fclose($newfile);
        header("Location: index.php");
    }
}