mirror of
https://github.com/Floriansylvain/projet_programmation_web.git
synced 2026-08-19 11:43:16 +02:00
✨ Added suggestion feature
This commit is contained in:
+14
-2
@@ -2,7 +2,19 @@
|
||||
|
||||
require_once("class/dump.php");
|
||||
|
||||
if (!isset($_GET['q']) || !isset($_GET['author'])) {
|
||||
print_r(json_encode(array("status" => 400, "message" => "Missing query type or attributs.")));
|
||||
exit();
|
||||
}
|
||||
|
||||
$author_name = $_GET['author'];
|
||||
$these_array = dump::getTheseByAuthor($author_name);
|
||||
$json = json_encode($these_array);
|
||||
$q = $_GET['q'];
|
||||
|
||||
$json_object = match ($q) {
|
||||
"theses" => dump::getTheseByAuthor($author_name),
|
||||
"authors" => dump::getAuthorsByAuthors($author_name),
|
||||
default => NULL,
|
||||
};
|
||||
|
||||
$json = json_encode($json_object);
|
||||
print_r($json);
|
||||
|
||||
Reference in New Issue
Block a user