Commit b4c4c11c authored by Ayush's avatar Ayush

Minor fixes

parent 8bf265b9
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true'); header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE"); header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
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");
......
...@@ -2,13 +2,16 @@ ...@@ -2,13 +2,16 @@
header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true'); header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE"); header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
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");
echo $postData;
exit(0);
if(isset($postData) && !empty($postData)){ if(isset($postData) && !empty($postData)){
$request = json_decode($postData); $request = json_decode($postData);
...@@ -20,7 +23,7 @@ if(isset($postData) && !empty($postData)){ ...@@ -20,7 +23,7 @@ if(isset($postData) && !empty($postData)){
$tc2 = trim($request->tc2_inp); $tc2 = trim($request->tc2_inp);
$out2 = trim($request->tc2_out); $out2 = trim($request->tc2_out);
$stime = trim($request->start_time); //string $stime = trim($request->start_time); //string
$etime = trim($request->end_time) $etime = trim($request->end_time);
$sql = "INSERT INTO questions(title,username,statement,tc1,out1,tc2,out2,stime,etime) VALUES ('$title','$username','$statement','$tc1','$out1','$tc2','$out2','$stime','$etime')"; $sql = "INSERT INTO questions(title,username,statement,tc1,out1,tc2,out2,stime,etime) VALUES ('$title','$username','$statement','$tc1','$out1','$tc2','$out2','$stime','$etime')";
......
...@@ -16,6 +16,7 @@ export class QuestionService { ...@@ -16,6 +16,7 @@ export class QuestionService {
constructor(private http: HttpClient) { } constructor(private http: HttpClient) { }
uploadQues(ques: Question): Observable<any> { uploadQues(ques: Question): Observable<any> {
console.log(ques);
return this.http.post(this.uploadUrl, ques); return this.http.post(this.uploadUrl, ques);
} }
......
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