[FEAT] Score API should be functional
This commit is contained in:
@@ -11,16 +11,25 @@ include_once '../objects/score.php';
|
||||
$db = new Database();
|
||||
|
||||
// initialize object
|
||||
$score = new Score($db, "../../Scores/");
|
||||
|
||||
$score = new Score($db, "../../Scores/", "http://ohmj2.free.fr/legacy/Scores");
|
||||
|
||||
$id = isset($_GET['id']) ? $_GET['id']: -1;
|
||||
|
||||
// read score will be here
|
||||
// query scores
|
||||
$scores_arr = $score->read_score_list();
|
||||
|
||||
if ($id == -1)
|
||||
{
|
||||
$payload = $score->read_score_list();
|
||||
}
|
||||
else
|
||||
{
|
||||
$payload = $score->read_score($id);
|
||||
}
|
||||
|
||||
// set response code - 200 OK
|
||||
http_response_code(200);
|
||||
|
||||
// show scores data in json format
|
||||
echo json_encode($scores_arr);
|
||||
echo json_encode($payload);
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user