Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sfcode
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush
sfcode
Commits
327846c1
Commit
327846c1
authored
Dec 07, 2020
by
Paarth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated filedelete.php for directory
parent
6fea0680
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
9 deletions
+23
-9
backend/filedelete.php
backend/filedelete.php
+22
-7
backend/questions/question_save.php
backend/questions/question_save.php
+1
-1
backend/register.php
backend/register.php
+0
-1
No files found.
backend/filedelete.php
View file @
327846c1
...
@@ -4,16 +4,31 @@ include_once("database.php");
...
@@ -4,16 +4,31 @@ include_once("database.php");
$postData
=
file_get_contents
(
"php://input"
);
$postData
=
file_get_contents
(
"php://input"
);
if
(
isset
(
$postData
)
&&
!
empty
(
$postData
))
{
if
(
isset
(
$postData
)
&&
!
empty
(
$postData
))
{
$request
=
json_decode
(
$postData
);
$request
=
json_decode
(
$postData
);
$isFile
=
trim
(
$request
->
isFile
);
if
(
isFile
){
$username
=
trim
(
$request
[
'file'
][
'username'
]);
$filename
=
trim
(
$request
[
'file'
][
'filename'
]);
$lang
=
trim
(
$request
[
'file'
][
'language'
]);
$path
=
'../users/'
.
$username
.
'/'
.
trim
(
$request
->
path
)
.
'/'
.
$filename
.
$lang
;
if
(
unlink
(
$path
))
{
$msg
=
"file successfully deleted"
;
echo
json_encode
(
$msg
);
}
else
{
http_response_code
(
404
);
}
exit
;
}
$username
=
trim
(
$request
->
username
);
$username
=
trim
(
$request
->
username
);
$data
=
trim
(
$request
->
text
);
$dirname
=
trim
(
$request
[
'file'
][
'name'
]);
$filename
=
trim
(
$request
->
filename
);
$path
=
'../users/'
.
$username
.
'/'
.
trim
(
$request
[
'file'
][
'path'
])
.
'/'
.
$dirname
;
$lang
=
trim
(
$request
->
language
);
$path
=
'../users/'
.
$username
.
'/'
.
trim
(
$request
->
path
)
.
'/'
.
$filename
.
$lang
;
if
(
unlink
(
$path
))
{
if
(
rmdir
(
$path
))
{
$msg
=
"file successfully deleted"
;
$msg
=
"directory successfully deleted"
;
clearstatcache
();
echo
json_encode
(
$msg
);
echo
json_encode
(
$msg
);
}
}
else
{
else
{
...
...
backend/questions/question_save.php
View file @
327846c1
...
@@ -6,7 +6,7 @@ header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE");
...
@@ -6,7 +6,7 @@ header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE");
header
(
"Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept"
);
header
(
"Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept"
);
header
(
"Content-Type: application/json; charset=UTF-8"
);
header
(
"Content-Type: application/json; charset=UTF-8"
);
include_once
(
"database.php"
);
include_once
(
"
../
database.php"
);
$postData
=
file_get_contents
(
"php://input"
);
$postData
=
file_get_contents
(
"php://input"
);
if
(
isset
(
$postData
)
&&
!
empty
(
$postData
)){
if
(
isset
(
$postData
)
&&
!
empty
(
$postData
)){
...
...
backend/register.php
View file @
327846c1
...
@@ -19,7 +19,6 @@ if (isset($postData) && !empty($postData)) {
...
@@ -19,7 +19,6 @@ if (isset($postData) && !empty($postData)) {
'id'
=>
mysqli_insert_id
(
$mysqli
),
'id'
=>
mysqli_insert_id
(
$mysqli
),
'username'
=>
$username
'username'
=>
$username
];
];
mkdir
(
'../users/'
.
$authData
[
'username'
],
0755
,
true
);
mkdir
(
'../users/'
.
$authData
[
'username'
],
0755
,
true
);
$mysqli
->
query
(
$sql1
);
$mysqli
->
query
(
$sql1
);
echo
json_encode
(
$authData
);
echo
json_encode
(
$authData
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment