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
1a0dea61
Commit
1a0dea61
authored
Dec 07, 2020
by
Adarsh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor
parent
7761765d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
5 deletions
+22
-5
backend/questions/get_questions.php
backend/questions/get_questions.php
+8
-1
backend/questions/question_save.php
backend/questions/question_save.php
+7
-1
src/app/home/home.component.ts
src/app/home/home.component.ts
+5
-1
src/app/question.service.ts
src/app/question.service.ts
+2
-2
No files found.
backend/questions/get_questions.php
View file @
1a0dea61
<?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"
);
include_once
(
"database.php"
);
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
)
)
{
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
){
$sql1
=
"SELECT Now()"
;
$currtime
=
$mysqli
->
query
(
$sql1
);
$sql2
=
"SELECT * FROM questions WHERE stime <=
$currtime
and etime >=
$currtime
"
;
...
...
backend/questions/question_save.php
View file @
1a0dea61
<?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"
);
include_once
(
"database.php"
);
$postData
=
file_get_contents
(
"php://input"
);
...
...
@@ -22,7 +28,7 @@ if(isset($postData) && !empty($postData)){
echo
json_encode
(
$msg
);
}
else
{
$msg
=
"
title
already exists"
;
$msg
=
"
question
already exists"
;
echo
json_encode
(
$msg
);
}
...
...
src/app/home/home.component.ts
View file @
1a0dea61
...
...
@@ -26,6 +26,7 @@ export class HomeComponent implements OnInit {
start_time
:
""
,
end_time
:
""
};
questions
:
any
[];
constructor
(
private
dataService
:
ApiService
,
private
problemService
:
ProblemService
,
...
...
@@ -36,6 +37,10 @@ export class HomeComponent implements OnInit {
this
.
user
=
JSON
.
parse
(
this
.
dataService
.
getToken
());
this
.
questiontoPost
.
username
=
this
.
user
.
username
;
this
.
getProblems
();
// this.questionService.getQues()
// .subscribe(questions => this.questions = questions);
// console.log(this.questions);
}
getProblems
():
void
{
...
...
@@ -66,7 +71,6 @@ export class HomeComponent implements OnInit {
}
submitForm
():
void
{
this
.
questionService
.
uploadQues
(
this
.
questiontoPost
);
this
.
resetForm
();
this
.
closeForm
();
...
...
src/app/question.service.ts
View file @
1a0dea61
...
...
@@ -19,8 +19,8 @@ export class QuestionService {
this
.
http
.
post
(
this
.
uploadUrl
,
ques
);
}
getQues
():
Observable
<
Question
[]
>
{
return
this
.
http
.
get
<
Question
[]
>
(
this
.
getUrl
);
getQues
():
Observable
<
any
[]
>
{
return
this
.
http
.
get
<
any
[]
>
(
this
.
getUrl
);
}
}
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