<?php
// 再計算プログラム
require_once __DIR__.'/../../include/server_check.php';
require_once __DIR__.'/../../include/functions.php';
require_once __DIR__.'/../../include/db.php';
require_once __DIR__.'/../../include/config.php';
require_once __DIR__.'/../../include/calc.php';

$log = "";
$count = 0;
$person_log = "";

try {
	$pdo = DBopen();

	// 計算結果のあるユーザー
	$select_person_sql = "SELECT * FROM user WHERE user_type1 != ''";
	$select_person = $pdo->query($select_person_sql);

	while($row = $select_person->fetch()){
		$count++;
		$user_id = $row["user_id"];
		$person_log = "id -> {$user_id}";
		diagnosis($pdo,$user_id);

		$log .= "SUCCESS | {$person_log}\n";
	}

} catch(Exception $e){
	$error = $e->getMessage();
	$log .= "error -> {$error} | {$person_log}\n";
}
echo $count;
echo "<br>";
echo nl2br($log);
