Updates as per Team meeting 28 Aug 2025
This commit is contained in:
@@ -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 {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user