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
7a2260cb
Commit
7a2260cb
authored
Dec 07, 2020
by
Gudipaty Aniket
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added file list backend
parent
90d14eee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
.vscode/launch.json
.vscode/launch.json
+15
-0
backend/list_files.php
backend/list_files.php
+30
-0
No files found.
.vscode/launch.json
0 → 100644
View file @
7a2260cb
{
//
Use
IntelliSense
to
learn
about
possible
attributes.
//
Hover
to
view
descriptions
of
existing
attributes.
//
For
more
information
,
visit:
https://go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"type"
:
"pwa-chrome"
,
"request"
:
"launch"
,
"name"
:
"Launch Chrome against localhost"
,
"url"
:
"http://localhost:8080"
,
"webRoot"
:
"${workspaceFolder}"
}
]
}
\ No newline at end of file
backend/list_files.php
0 → 100644
View file @
7a2260cb
<?php
header
(
"Access-Control-Allow-Origin: *"
);
header
(
'Access-Control-Allow-Credentials: true'
);
header
(
"Access-Control-Allow-Methods: PUT, GET, POST, DELETE"
);
header
(
"Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept"
);
header
(
"Content-Type: application/json; charset=UTF-8"
);
$postData
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$postData
,
true
);
$uname
=
$postData
[
'username'
];
$dir
=
"../users/"
.
$uname
;
$contents
=
scandir
(
$dir
);
$f_list
=
array
();
foreach
(
$contents
as
$fname
)
{
$ext
=
pathinfo
(
$fname
,
PATHINFO_EXTENSION
);
if
((
strcmp
(
$ext
,
"java"
)
==
0
)
||
(
strcmp
(
$ext
,
"cpp"
)
==
0
)
||
(
strcmp
(
$ext
,
"py"
)
==
0
))
{
array_push
(
$f_list
,
$fname
);
}
}
echo
json_encode
(
$f_list
);
?>
\ No newline at end of file
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