[FEAT] Move Legacy code into a legacy directory

This commit is contained in:
NADAL Jean-Baptiste
2026-02-13 10:44:51 +01:00
parent bfb703e6b9
commit 5066e1d54f
142 changed files with 194 additions and 0 deletions

35
legacy/api/score/read.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
// required headers
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
// include database and object files
include_once '../config/database.php';
include_once '../objects/score.php';
// instantiate database and score object
$db = new Database();
// initialize object
$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
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($payload);
?>