Deletion of files through functions Copy Already displayed Whether to enable magic references
- /**
- 2012-4-12丨Yiyifan Taixi丨
- *Customized addslashes function, supports multi-dimensional arrays, supports automatic identification of whether the server has enabled magic references
- */
- function add_slashes($var){
- //First determine whether the server supports magic quotes
- if(get_magic_quotes_gpc()==0){
- if(is_array ($var)){
- //Traverse the array
- foreach($var as $key => $value){
- $var[$key] = add_slashes($value);
-
- }
- return $var;
- }
- }elseif(is_string($var)){
- //Not an array, but a string
- return addslashes($var);
- }else{
- //Already turned on
- return $var;
- }
- }
-
- //copy Function to realize the copy function of files and folders
-
- function dir_copy($src,$dst){
- if(is_dir($src)){
- if(!file_exists($dst)){
- @mkdir($dst,0777 ,true);
- }
- }
- $fp = opendir($src);
- while(!false==($fn=readdir($fp))){
- if($fn == "." || $ fn == ".."){
- continue;
- }
- $path = $src.DIRECTORY_SEPARATOR.$fn;
- if(is_dir($path)){
- dis_copy($path,($dst.DIRECTORY_SEPARATOR.$fn ));
- }elseif(is_file($path)){
- copy($path,($dst.DIRECTORY_SEPARATOR.$fn));
- }else{
- copy($path,($dst.DIRECTORY_SEPARATOR.$fn) ;
- while(!false== ($fn =readdir($fp))){
- if($fn=="." || $fn == ".."){
- continue;
- }
- $path = $src.DIRECTORY_SEPARATOR.$fn;
- if(is_dir($path)){
- delete_dir($path);
- }elseif(is_file($path)){
- @unlink($path);
- }else{
- @ unlink($path);
- }
- }
-
- }
- closedir($fp);
- @rmdir($src);
- }
-
-
- //msg output returns
-
- function msg($msg){
- echo $ msg."
";
- echo "Return to the previous page";
- die;
-
- }
-
-
-
- Copy code
-
-
-
-
-
-
-
|