<?



$a = isset($_GET['user']) ? trim($_GET['user']) : '';

$b = isset($_GET['id']) ? trim($_GET['id']) : '';

 



$checkthankdau = $db->query('SELECT COUNT(*) FROM `forum_thank` WHERE `userthank` = "' . $systemUser->id . '" and `topic` = "' . $_GET['thanks'] . '" and `user` = "' . $a . '"')->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 accepted !</div>';

$db->exec("INSERT INTO `forum_thank` SET

     `user` = '".trim($_GET['user'])."',

     `topic` = '".trim($_GET['thanks'])."' ,

     `time` = '$realtime',

     `userthank` = '$systemUser->id',

     `chude` = '".$b."'

");



$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 . "'");

}

}







?>

