C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$R30CG93\phpmyserver\edit.php


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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php

//----------------------------------//
//    Copyright by Matthias Speer   //
//----------------------------------//

include('./config.inc.php');
include(
'./auth.php');

function 
form1()
{
    global 
$encpath;
    global 
$encfile;
    echo 
'<TABLE width=100% cellpadding=0 cellspacing=5 border=0>';
    echo 
'<FORM action="./edit.php?action=ed&path='.$encpath.'&file='.$encfile.'&option='.$option.'" method="post" enctype="application/x-www-form-urlencoded" name="frm"><TR><TD>';
    echo 
'<INPUT type=submit value="Änderungen speichern" name=sbmbtn class=frmbtn></TD></TR>';
    echo 
'<TR><TD><TEXTAREA name=ftext class=edit rows=25 wrap=virtual>';
}

function 
form2()
{
    echo 
'</TEXTAREA></TD></TR></FORM></TABLE>';
}

$action=(isset($_GET['action']))?$_GET['action']:'';
$option=(isset($_GET['option']))?$_GET['option']:'';
$encpath=(isset($_GET['path']))?$_GET['path']:'';
$encfile=(isset($_GET['file']))?$_GET['file']:'';
$path=($encpath=='')?'':DecodeGET($encpath);
$file=($encfile=='')?'':DecodeGET($encfile);
$fullpath=GetPath($path$file);
$encfullpath=($fullpath!==false)?EncodeGET($fullpath):'';

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Edit</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=<?php echo GetLocText('charset'false); ?>">
<LINK href="style/global.css" rel="stylesheet" type="text/css">
<LINK href="style/form.css" rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript" src="./script/frames.js" type="text/JavaScript"></SCRIPT>
</HEAD>

<BODY class=body_main>
<?php
        
if (($fullpath!==false)&&($path!='')&&($file!=''))
{
    if (isset(
$_POST['ftext']))
    {
        
$rndcode=RandomCode();
        
$timestamp=time();
        
$tempname=$rndcode.'_'.$timestamp.'.txt';
        if (
$fh=@fopen('./work/'.$tempname'w'))
        {
            
HandlePOSTText($_POST['ftext']);
            @
fputs($fh$_POST['ftext']);
            @
fclose($fh);
            switch (
$PMS['os'].'|'.$PMS['modus'])
            {
                case 
'linux|PHPsys':
                case 
'linux|Python':
                case 
'linux|PerlCGI':    
                case 
'linux|Perl_htaccess'
                case 
'linux|SSI':            $mod=new PMSMod();
                                                
                                            if (
$mod->Execute("cp ".dirname($_SERVER['PATH_TRANSLATED'])."/work/$tempname $fullpath"))
                                            {
                                                if (
$PMS['os'].'|'.$PMS['modus']=='linux|PHPsys')
                                                {
                                                    if (
$mod->GetExecuteStatus()==0)
                                                    {
                                                        
DisplayMessage(GetLocText('msg_edit_ok'), $file);
                                                    } else
                                                    {
                                                        
DisplayError(GetLocText('err_edit'), $file);
                                                    }
                                                } else
                                                {
                                                    
$rs=$mod->Output2Array();
                                                    if (empty(
$rs))
                                                    {
                                                        
DisplayMessage(GetLocText('msg_edit_ok'), $file);
                                                    } else
                                                    {
                                                        
$mod->FormatOutput2Stdout();
                                                    }
                                                }
                                            } else
                                            {
                                                
DisplayError(GetLocText('err_edit'), $file);
                                            }                                            
                                            
$mod->Destructor();    
                                            break;
    
                case 
'win|PHPsys':            $mod=new PMSMod();
                                            if (
$mod->Execute("copy /Y \"".dirname($_SERVER['PATH_TRANSLATED'])."\\work\\$tempname\" \"$fullpath\""))
                                            {
                                                
DisplayMessage(GetLocText('msg_edit_ok'));
                                            } else
                                            {
                                                
DisplayError(GetLocText('err_edit'), $file);
                                            }
                                            
$mod->Destructor();    
                                            break;
                
    
                case 
'linux|PHP'
                case 
'win|PHP':             if (copy("./work/$tempname"$fullpath))
                                            {
                                                
DisplayMessage(GetLocText('msg_edit_ok'));
                                            } else
                                            {
                                                
DisplayError(GetLocText('err_edit'), $file);
                                            }
                                            break;
    
                default:                    
DisplayMessage(GetLocText('msg_func_na'));        
            }
            
//@unlink("./work/$tempname");
            
echo "<SCRIPT language=\"JavaScript\">\n<!--\nparent.frm_dir_main.location.href='./directory.php?action=o&path=$encpath&option=$option';\n//-->\n</SCRIPT>";
            echo 
'<NOSCRIPT><BR><HR size=1 noshade><A href=./directory_fs.php?action=o&path='.$encpath.'&option='.$option.' class=text1 target=frm_main><IMG src=./img/refresh.gif width=20 height=20 border=0 align=absmiddle>'.GetLocText('dir_refresh').'</A></NOSCRIPT>';                                
        } else
        {
            
DisplayError(GetLocText('err_edit'), $file);        
        }        
    } else
    {
        
$pathdata pathinfo($fullpath);
        
$noedit = Array('gif','jpg','jpeg','jpe','png','tif','tiff','swf','mpg','exe','xls','pdf','com','dll','gz','zip','tar','z');    
        if (!(isset(
$pathdata["extension"])&&(in_array(strtolower($pathdata["extension"]), $noedit))))
        {
            switch (
$PMS['os'].'|'.$PMS['modus'])
            {
                case 
'linux|PHPsys':
                case 
'linux|Python':
                case 
'linux|PerlCGI':    
                case 
'linux|Perl_htaccess'
                case 
'linux|SSI':            $mod=new PMSMod();
                                                
                                            if (
$mod->Copy2Temp("cp $fullpath"))
                                            {
                                                
form1();    
                                                if (
$mod->FormatTempFile2Stdout(falsefalse))
                                                {
                                                    
form2();
                                                } else
                                                {
                                                    
form2();
                                                    if (empty(
$PMS['fs_msg'])) DisplayError(GetLocText('err_fnf'), $file);    
                                                }                                                
                                            } else
                                            {
                                                
DisplayError(GetLocText('err_fnf'), $file);    
                                            }
                                            
$mod->Destructor();    
                                            break;
    
                case 
'win|PHPsys':            $mod=new PMSMod();
                                            if (
$mod->Copy2Temp("copy /Y \"$fullpath\""))
                                            {    
                                                
form1();    
                                                if (
$mod->FormatTempFile2Stdout(falsefalse))
                                                {
                                                    
form2();
                                                } else
                                                {
                                                    
form2();
                                                    if (empty(
$PMS['fs_msg'])) DisplayError(GetLocText('err_fnf'), $file);    
                                                }
                                            } else
                                            {
                                                
DisplayError(GetLocText('err_fnf'), $file);    
                                            }
                                            
$mod->Destructor();    
                                            break;
                
    
                case 
'linux|PHP'
                case 
'win|PHP':             form1();
                                            if (
FormatFile($fullpathfalsefalse))
                                            {
                                                
form2();
                                            } else
                                            {
                                                
form2();
                                                if (empty(
$PMS['fs_msg'])) DisplayError(GetLocText('err_fnf'), $file);    
                                            }
                                            break;
    
                default:                    
DisplayMessage(GetLocText('msg_func_na'));        
            }
        } else
        {
            
DisplayMessage(GetLocText('msg_noedit'), $file);        
        }    
    }
} else
{
     
DisplayError(GetLocText('err_fnf'), $file);
}
?>
</BODY>
</HTML>