You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.5 KiB
PHP

<?php
$editor = str_replace("\'","'",$_GET[ "ed" ]);
$editor = '"'.str_replace('/','\\',$editor).'"';
$file_to_edit = str_replace('/','\\',$_GET[ "fn" ]);
session_start();
/*
if ($_GET["xed"]!=''){
echo '$_GET["xed"]..:::'.$_GET["xed"].":::<br>\n";
}
if ($_GET["ded"]!=''){
echo '$_GET["ded"]..:::'.$_GET["ded"].":::<br>\n";
}
if ($_GET["an"]!=''){
echo '$_GET["an"]..:::'.$_GET["an"].":::<br>\n";
}
if ($_GET["sp"]!=''){
echo '$_GET["sp"]..:::'.$_GET["sp"].":::<br>\n";
}
if ($_GET["ap"]!=''){
echo '$_GET["ap"]..:::'.$_GET["ap"].":::<br>\n";
}
echo $file_to_edit;
echo "<br>";
echo $todo;
Exit;
*/
// touch
if (!file_exists($file_to_edit)){
fclose(fopen($file_to_edit,"w"));
}
$todo = str_replace('/','\\',$_GET["ba"]) .' ' .$editor.' '.$file_to_edit;
$externalProcess=popen($todo, 'r');
pclose($externalProcess);
if ($_GET["xed"] != ''){
if (!isset($_SESSION["lastedit"])){
$_SESSION["lastedit"] = array($_GET["xed"]);
}
else {
array_push($_SESSION["lastedit"],$_GET["xed"]);
}
}
if ($_GET["ded"] != ''){
if (!isset($_SESSION["deledit"])){
$_SESSION["deledit"] = array($_GET["ded"]);
}
else{
array_push($_SESSION["deledit"],$_GET["ded"]);
}
}
$url = $_GET["sp"];
if ($_GET["ap"] != ''){
$url .= '?ap='.$_GET["ap"];
}
// Anker
if ($_GET["an"] != ''){
if ($_GET["ap"] != ''){
$url .= "&an=".$_GET["an"];
}
else{
$url .= "?an=".$_GET["an"];
}
}
echo "<head>";
echo '<meta http-equiv="refresh" content="0; URL='.$url.'">';
echo "</head>";
?>