mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-07 12:16:28 +02:00
Filemanager security update.
This commit is contained in:
@@ -13,6 +13,25 @@ class Caller{
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' and isset($_POST['method'])) {
|
||||
|
||||
$pathToSeed = '/home/' . $_POST['domainName'] . '/..filemanagerkey';
|
||||
$receivedSeed = $_POST['domainRandomSeed'];
|
||||
|
||||
$myfile = fopen($pathToSeed, "r") or die("Unable to open file!");
|
||||
$seed = fread($myfile,filesize($pathToSeed));
|
||||
fclose($myfile);
|
||||
|
||||
if ($seed != $receivedSeed){
|
||||
$answer = array(
|
||||
'uploadStatus' => 0,
|
||||
'answer' => 'Not allowed to upload in this path.',
|
||||
'error_message' => "None",
|
||||
'fileName' => $_FILES['file']['name']
|
||||
);
|
||||
$json = json_encode($answer);
|
||||
echo $json;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($_POST['method']) {
|
||||
case 'upload':
|
||||
$this->uploadFile();
|
||||
|
||||
@@ -11,6 +11,25 @@ class fileManager
|
||||
$postdata = file_get_contents("php://input");
|
||||
$request = json_decode($postdata);
|
||||
|
||||
$pathToSeed = '/home/' . $request->domainName . '/..filemanagerkey';
|
||||
$receivedSeed = $request->domainRandomSeed;
|
||||
|
||||
$myfile = fopen($pathToSeed, "r") or die("Unable to open file!");
|
||||
$seed = fread($myfile,filesize($pathToSeed));
|
||||
fclose($myfile);
|
||||
|
||||
if ($seed != $receivedSeed){
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "You can not open filemanager for this domain.",
|
||||
"copied" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (isset($request->method)) {
|
||||
|
||||
switch ($request->method) {
|
||||
@@ -84,7 +103,8 @@ class fileManager
|
||||
if (is_dir($completePath) == true) {
|
||||
array_push($tempDir, $dirFile);
|
||||
} else {
|
||||
array_push($tempFiles, $dirFile);
|
||||
array_push($tempFiles, $dirFile);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user