<?


$checkthankdau = $db->query('SELECT COUNT(*) FROM `forum_thank` WHERE `userthank` = "' . $systemUser->id . '" and `topic` = "' . $_GET['thanks'] . '" and `user` = "' . $_GET['user'] . '"')->fetchColumn();
if ($systemUser->isValid() && $systemUser->id != $_GET['user'] && ($checkthankdau < 1)) {
if ((isset ($_GET['thank']))&&(isset ($_GET['user']))&&(isset ($_GET['thanks']))) {
echo '<div class="rmenu" id="thanksyou">Your thanks was acepted !</div>';
$db->exec("INSERT INTO `forum_thank` SET
     `user` = '".trim($_GET['user'])."',
     `topic` = '".trim($_GET['thanks'])."' ,
     `time` = '$realtime',
     `userthank` = '$systemUser->id',
     `chude` = '".$_GET["id"]."'
");

$anu = $db->query('SELECT * FROM `users` WHERE `id` = "' . trim($_GET['user']) . '"')->fetch();
$db->exec("UPDATE `users` SET `thanked`='" . ($anu['thanked'] + 1) . "' WHERE `id` = '" . trim($_GET['user']) . "'");
$db->exec("UPDATE `users` SET `thanks`='" . ($systemUser['thanks'] + 1) . "' WHERE `id` = '" . $systemUser->id . "'");
}
}



?>
