Commit c582efc2 authored by Paarth's avatar Paarth

check_output.php added

parent 13bf44f2
......@@ -16,7 +16,7 @@ $postData = json_decode($postData, true);
$uname = $postData['username'];
$filename = $postData['filename'];
$f_path = $postData['file_path'];
$f_path = $postData['path'];
$language = $postData['language'];
$ret_stat = 0;
......
<?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");
if(isset($postData) && !empty($postData)){
$request = json_decode($postData);
$title = mysqli_real_escape_string($mysqli, trim($request->title));
$out1 = mysqli_real_escape_string($mysqli, trim($request->out1));
$out2 = mysqli_real_escape_string($mysqli, trim($request->out2));
$sql = "SELECT out1, out2 FROM questions WHERE title='$title'";
if($result = mysqli_query($mysqli,$sql)->fetch_all()){
$bool = array(0,0);
if(result['out1'] === $out1){
$bool[0]=1;
}
if(result['out2'] === $out2){
$bool[1]=1;
}
echo json_encode($bool);
}
else{
http_response_code(404);
}
}
?>
\ No newline at end of file
......@@ -4,15 +4,11 @@
* This script registers a user using a username, password, name, and email (provided through POST). This script communicates with the MySQL server to save user data.
*/
<<<<<<< HEAD
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");
=======
>>>>>>> 8601987f1aa6573181cb9427847fcf57dc1afcf6
include_once("database.php");
......
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