Updates as per Team meeting 28 Aug 2025

This commit is contained in:
2025-05-28 19:53:00 +01:00
parent 9d6c761d15
commit 88853e955c
9 changed files with 581 additions and 185 deletions

View File

@@ -1,13 +1,19 @@
<?php
header('Content-Type: application/json');
// Basic input validation and sanitization
if (!isset($_POST['qid']) || empty($_POST['qid'])) {
echo json_encode(['error' => 'Missing QID parameter']);
exit;
if (php_sapi_name() === 'cli') {
echo "Running from command line.\n";
$qid="QID2_7";
} else {
//echo "Running from browser.\n";
// Basic input validation and sanitization
if (!isset($_POST['qid']) || empty($_POST['qid'])) {
echo json_encode(['error' => 'Missing QID parameter']);
exit;
}
$qid = $_POST['qid'];
}
$qid = $_POST['qid'];
// Database connection (adjust credentials accordingly)
//
@@ -54,7 +60,8 @@ try {
// Return as JSON array of objects [{value: -3, count: 5}, ...]
$response = [];
foreach ($counts as $value => $count) {
$response[] = ['value' => $value, 'count' => $count];
//$response[] = ['value' => $value, 'count' => $count];
$response[] = ['"'.strval($value).'"' => $count];
}
echo json_encode($response);
@@ -65,3 +72,12 @@ try {
}