Commit 30c684ba authored by Paarth's avatar Paarth

filesave.php and newdir.php added

parent 49246421
...@@ -41,10 +41,12 @@ ...@@ -41,10 +41,12 @@
}, },
"configurations": { "configurations": {
"production": { "production": {
"fileReplacements": [{ "fileReplacements": [
{
"replace": "src/environments/environment.ts", "replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts" "with": "src/environments/environment.prod.ts"
}], }
],
"optimization": true, "optimization": true,
"outputHashing": "all", "outputHashing": "all",
"sourceMap": false, "sourceMap": false,
...@@ -53,7 +55,8 @@ ...@@ -53,7 +55,8 @@
"extractLicenses": true, "extractLicenses": true,
"vendorChunk": false, "vendorChunk": false,
"buildOptimizer": true, "buildOptimizer": true,
"budgets": [{ "budgets": [
{
"type": "initial", "type": "initial",
"maximumWarning": "2mb", "maximumWarning": "2mb",
"maximumError": "5mb" "maximumError": "5mb"
...@@ -133,5 +136,8 @@ ...@@ -133,5 +136,8 @@
} }
} }
}, },
"defaultProject": "temp" "defaultProject": "temp",
"cli": {
"analytics": false
}
} }
\ No newline at end of file
<?php
include_once("database.php")
$postData = file_get_contents("php://input");
if(isset($postData) && !empty($postData)) {
$request = json_decode($postData);
$username = trim($request->username);
$data = trim($request->File.text);
$filename = trim($request->File.filename);
$lang = trim($request->File.language);
$path = trim($request->File.path).'/'.$filename;
if(file_exists($path)) {
$msg = "file already exists";
clearstatcache();
echo json_encode($msg);
}
else {
$sql1 = "SELECT n_files from userdata where username = $username";
$sql2 = "UPDATE userdata SET n_files = n_files+1 WHERE username = $username ";
$result = mysqli_query($mysqli,$sql1);
if($result == 10){
$msg = "maximum limit(10) exceeded";
echo json_encode($msg);
}
else{
if($result = mysqli_query($mysqli, $sql2)) {
$myfile = fopen($path,"w");
fwrite($myfile,$data);
fclose($myfile);
$msg = "file successfully uploaded";
clearstatcache();
echo json_encode($msg);
}
else{
http_response_code(404);
}
}
}
}
?>
\ No newline at end of file
<?php
$postData = file_get_contents("php://input");
if(isset($postData) && !empty($postData)) {
$request = json_decode($postData);
// $username = trim($request->username);
$dir = trim($request->dir);
$path = trim($request->currdir) . '/' . $dir;
if(file_exists($path)) {
$msg = "directory already exists";
clearstatcache();
echo json_encode($msg);
}
else {
mkdir($path);
clearstatcache();
}
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment