https://gitlab.inria.fr/lyao/visinmotion
Tip revision: dd99681039060e6dcec83a378405faa3bc4527d3 authored by lyao on 09 December 2023, 20:43:19 UTC
readme updated
readme updated
Tip revision: dd99681
log.php
<?php
/*
This file will generate our CSV table. There is nothing to display on this page, it is simply used
to generate our CSV file and then exit. That way we won't be re-directed after pressing the export
to CSV button on the previous page.
*/
// convert the sent data into a flat array
$data = json_decode(file_get_contents('php://input'), true);
// write individual file
$indiv_file = "../../results/individual/" . $data["participant_id"] . '.csv';
$exists = file_exists($indiv_file);
$indiv_handle = fopen($indiv_file, "a+");
// write a column header
if (!$exists) {
fwrite($indiv_handle, $LOG_HEADER . PHP_EOL);
}
// add the received data to the file
fputcsv($indiv_handle, $data);
// close the file
fclose($indiv_handle);
exit;
?>
