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
93b64d57
Commit
93b64d57
authored
Dec 08, 2020
by
Ayush
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fix
parent
bf95b9eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
35 deletions
+27
-35
backend/filesave.php
backend/filesave.php
+18
-29
src/app/home/home.component.ts
src/app/home/home.component.ts
+9
-6
No files found.
backend/filesave.php
View file @
93b64d57
...
@@ -11,35 +11,24 @@ if (isset($postData) && !empty($postData)) {
...
@@ -11,35 +11,24 @@ if (isset($postData) && !empty($postData)) {
$lang
=
trim
(
$request
->
language
);
$lang
=
trim
(
$request
->
language
);
$path
=
'../users/'
.
$username
.
'/'
.
trim
(
$request
->
path
)
.
'/'
.
$filename
.
$lang
;
$path
=
'../users/'
.
$username
.
'/'
.
trim
(
$request
->
path
)
.
'/'
.
$filename
.
$lang
;
// if (file_exists($path)) {
$sql1
=
"SELECT n_files from users where username = '
$username
'"
;
// $msg = "file already exists";
$sql2
=
"UPDATE users SET n_files = n_files+1 WHERE username = '
$username
'"
;
// clearstatcache();
$result
=
mysqli_query
(
$mysqli
,
$sql1
)
->
fetch_all
()[
0
];
// echo json_encode($msg);
if
(
$result
==
10
)
{
// }
$msg
=
"maximum limit(10) reached"
;
// else {
echo
json_encode
(
$msg
);
// $sql1 = "SELECT n_files from userdata where username = $username";
}
else
{
// $sql2 = "UPDATE userdata SET n_files = n_files+1 WHERE username = $username ";
if
(
mysqli_query
(
$mysqli
,
$sql2
))
{
// $result = mysqli_query($mysqli, $sql1);
$myfile
=
fopen
(
$path
,
"w"
);
// if($result == 10){
fwrite
(
$myfile
,
$data
);
// $msg = "maximum limit(10) reached";
fclose
(
$myfile
);
// 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);
// }
// }
// }
$msg
=
"file successfully uploaded"
;
clearstatcache
();
echo
json_encode
(
$msg
);
}
else
{
http_response_code
(
404
);
}
}
}
}
?>
?>
src/app/home/home.component.ts
View file @
93b64d57
...
@@ -39,7 +39,7 @@ export class HomeComponent implements OnInit {
...
@@ -39,7 +39,7 @@ export class HomeComponent implements OnInit {
this
.
getProblems
();
this
.
getProblems
();
// this.questionService.getQues()
// this.questionService.getQues()
// .subscribe(questions => this.questions = questions);
// .subscribe(questions => this.questions = questions);
// console.log(this.questions);
// console.log(this.questions);
}
}
...
@@ -49,11 +49,11 @@ export class HomeComponent implements OnInit {
...
@@ -49,11 +49,11 @@ export class HomeComponent implements OnInit {
}
}
openForm
():
void
{
openForm
():
void
{
document
.
getElementById
(
"
popupForm
"
).
style
.
display
=
"
block
"
;
document
.
getElementById
(
'
popupForm
'
).
style
.
display
=
'
block
'
;
}
}
closeForm
():
void
{
closeForm
():
void
{
document
.
getElementById
(
"
popupForm
"
).
style
.
display
=
"
none
"
;
document
.
getElementById
(
'
popupForm
'
).
style
.
display
=
'
none
'
;
}
}
resetForm
():
void
{
resetForm
():
void
{
...
@@ -71,15 +71,18 @@ export class HomeComponent implements OnInit {
...
@@ -71,15 +71,18 @@ export class HomeComponent implements OnInit {
}
}
submitForm
()
{
submitForm
()
{
this
.
questiontoPost
.
start_time
=
this
.
questiontoPost
.
start_time
.
split
(
'
T
'
).
join
(
'
'
);
this
.
questiontoPost
.
end_time
=
this
.
questiontoPost
.
end_time
.
split
(
'
T
'
).
join
(
'
'
);
this
.
questionService
.
uploadQues
(
this
.
questiontoPost
).
subscribe
(
this
.
questionService
.
uploadQues
(
this
.
questiontoPost
).
subscribe
(
(
event
:
any
)
=>
{
(
event
:
any
)
=>
{
if
(
typeof
(
event
)
===
'
object
'
)
{
if
(
typeof
(
event
)
===
'
object
'
)
{
this
.
questiontoPost
=
null
;
this
.
questiontoPost
=
null
;
(
document
.
getElementById
(
'
quesform
'
)
as
HTMLInputElement
).
value
=
''
;
(
document
.
getElementById
(
'
quesform
'
)
as
HTMLInputElement
).
value
=
''
;
}
}
this
.
resetForm
();
this
.
closeForm
();
}
}
);
);
this
.
resetForm
();
this
.
closeForm
();
}
}
}
}
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