<?

require "include/bittorrent.php";

dbconn ();

function bark($msg) {
	global $tracker_lang;
	stdhead ( "Ошибка!" );
	stdmsg ( $tracker_lang ['error'], $msg, 'error' );
	stdfoot ();
	exit ();
}
function barka($msg) {
	global $tracker_lang;
	stdhead ( "Успешно!" );
	stdmsg ( "Успешно", $msg, 'success' );
	stdfoot ();
	exit ();
}
validcan ( false, 'can_deldon' );
$dud = sqlesc ( $_POST ["dud"] );
$raz = sqlesc ( $_POST ["raz"] );
if (empty ( $dud ) || empty ( $raz )) {
	bark ( "Все поля обязательны для заполнения" );
} else {
	$kolv = sql_query ( "SELECT donated FROM users WHERE username = $dud LIMIT 1" ) or sqlerr ( __FILE__, __LINE__ );
	$kolva = mysql_fetch_row ( $kolv );
	$kolvo = $kolva ['donated'] - $raz;
	sql_query ( "UPDATE users SET donated = $kolvo WHERE username = $dud LIMIT 1" ) or sqlerr ( __FILE__, __LINE__ );
	barka ( "Вы успешно удалили пользователя из пожертвования!" );
	stdhead ( "Успешно!" );

}

stdfoot ();

?>