action_touch_file.php
上传用户:feiyaoda
上传日期:2016-11-21
资源大小:9556k
文件大小:2k
- <?php
- if ($_POST['touch_file_name'])
- {
- $new_file = realpath_alternative($target_folder.$_POST['touch_file_name']);
- if (FALSE == is_file($new_file))
- {
- // from windows browser fix
- $content = str_replace("r",'',$_POST['filecontent']);
- $fp = @fopen($new_file,'w');
- if ($fp)
- {
- fwrite($fp,stripslashes($content));
- fclose($fp);
- echo "<body bgcolor='#CFE3E3'><div class="success_box"><i>Action successfull. file </i>".$_POST['touch_file_name']."<i> has been created</i></div>n";
- }
- else
- echo "<div class="error_box">ERROR! file ".$_POST['touch_file_name']." can't be created</div>n";
- }
- else
- echo "<div class="error_box">ERROR! file ".$_POST['touch_file_name']." already exists</div>n";
-
- echo "<br><br>n";
- }
- else
- {
-
- echo "<form action=execute.php method=POST>n";
- echo "<input type=hidden name=action value="".$_POST['action']."">n";
- echo "<input type=hidden name=target_folder value="".$_POST['target_folder']."">n";
- echo "<input type=hidden name=target_type value="".$_POST['target_type']."">n";
-
- echo "<table border=0>n";
-
- echo "<tr><th>current folder</th><td>".realpath_alternative($target_folder,true)."</td></tr>n";
- echo "<tr><th>file name</th><td><input type=text name="touch_file_name" value=""></td></tr>n";
- echo "<tr><th>file content</th><td><textarea name=filecontent></textarea></td></tr>n";
- echo "</table>n";
- echo "<input type=submit name=submit value="Create">n";
- echo "</form>n";
- }