Location: PHPKode > scripts > File Editor > do.php
<?php
session_start();
if(!isset($_GET['act'])){$action_get="";}else{$action_get=$_GET['act'];}

if($action_get=="salvare_fisier"){
		
		
	if(!isset($_POST['filename'])){
				
					$_SESSION['mesaj_eroare_de_afisat']="Numele fisierului este incorect!";//error incorrect filename
				
		}else{
				
				$filename=$_POST['filename'];
				
				
				if(preg_match("/^[a-zA-Z0-9\.\-\_]+$/iD", $filename)){
				
					include "file-editor-class.php";
					$files= new  file_editor();
					$extensions=array("html", "txt");
					$files -> only_these_ext($extensions);
					
					if($files -> check_ext($filename)){
							
							$folder = "test_folder";
							$text_content=$_POST['text_content'];
							$text_content= $files -> replace_html($text_content, FALSE);
							file_put_contents($folder."/".$filename, $text_content);
														
							$_SESSION['mesaj_eroare_de_afisat']="Fisierul &laquo; $filename &raquo; a fost salvat!";	//the file was saved
						}else{
						
							$_SESSION['mesaj_eroare_de_afisat']="Aceasta extensie nu este acceptata!";//this extension is not accepted
					}
					
					
					}else{
					
					$_SESSION['mesaj_eroare_de_afisat']="Numele fisierului contine caractere interzise!";//filename contains restricted characters
				}
				
				
				
	}
			
header ("Location: ".$_SERVER['HTTP_REFERER']);	
}
?>
Return current item: File Editor