

























$PIO->postCount($resto)


$TPC = $PIO->postCount($resto);





'{$TPC}'=>$TPC, (edited)

































$apiUrl = 'http://vichan.example/';
$boardName = 'test';
// Loop through all the pages and count the replies made in the last hour
$count = 0;
$now = time();
for ($i = 0; $i <= 21; $i++) {
$jsonIndex = file_get_contents($apiUrl . $boardName . '/' . $i . '.json');
$index = json_decode($jsonIndex, true);
$threads = $index['threads'];
foreach ($threads as $thread) {
$threadNumber = $thread['no'];
$threadApiUrl = $apiUrl . $boardName . 'res/' . $threadNumber . '.json';
$threadJson = file_get_contents($threadApiUrl);
$threadData = json_decode($threadJson, true);
$replies = $threadData['posts'];
foreach ($replies as $reply) {
if ($reply['time'] > $now - 3600) {
$count++;
}
}
}
}
// Output the count
echo $count . ' replies made in the last hour on /' . $boardName . '/';




http://localhost/vichan/b/threads.json (edited)













