-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax-handler.php
More file actions
44 lines (35 loc) · 1.29 KB
/
ajax-handler.php
File metadata and controls
44 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
session_start();
require_once 'excel-reader.php';
header('Content-Type: application/json');
if (!isset($_GET['action'])) {
echo json_encode(['success' => false, 'message' => 'Action non spécifiée']);
exit;
}
$excelManager = new ExcelManager();
$action = $_GET['action'];
switch ($action) {
case 'view_archive':
$archiveName = $_GET['archive_name'] ?? '';
if (empty($archiveName)) {
echo json_encode(['success' => false, 'message' => 'Nom d\'archive non spécifié']);
exit;
}
$archiveData = $excelManager->readArchiveData($archiveName);
echo json_encode($archiveData);
break;
case 'search_archive':
$archiveName = $_GET['archive_name'] ?? '';
$searchTerm = $_GET['search_term'] ?? '';
if (empty($archiveName) || empty($searchTerm)) {
echo json_encode(['success' => false, 'message' => 'Paramètres manquants']);
exit;
}
$searchResults = $excelManager->searchInArchive($archiveName, $searchTerm);
echo json_encode($searchResults);
break;
default:
echo json_encode(['success' => false, 'message' => 'Action non reconnue']);
break;
}
?>