$clan = mysql_fetch_array(mysql_query("SELECT geld FROM clan WHERE id='$user_ida[clan]' LIMIT 1"));
$user = mysql_fetch_array(mysql_Query("SELECT nickname, clan_geld, geld FROM user WHERE id='$user_ida[id]' LIMIT 1"));
if ($charm == 1) {
if($clan_geld <= 0) {
mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())");
displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', '<ahref="index.php?as=clan/spende">weiter...</a>');
exit;
}
displayErrorMessage(NULL,'<p>Willst du wirklich "<strong>'.$clan_geld.'</strong>¥" an deinen Clan spenden ?</p><p><ahref="index.php?as=clan/spende&charm=2&clan_geld='.$clan_geld.'">Ja</a> | <ahref="index.php?as=clan/spende">Nein</a></p>','');
exit;
} elseif($charm == 2) {
14 years ago
// Um Pufferueberlaeufe zu vermeiden, einfach die Laenge der Zeichenkette abfragen, ab der 8ten stelle also uerbe 99 Mio geht nicht aufeinmal!
if(strlen($clan_geld)>8) {
mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr als 99.999.999 aufeinmal zu Spenden! (Eingabe:".$clan_geld.")',now())");
//$sql = 'select u.id, item_id, count(c.id) from clan_ware cw inner join user u on cw.clan = u.clan inner join chars c on u.id = c.besitzer where u.clan = '.$user_ida['clan'].' group by u.id, item_id';
//$sql = 'SELECT miete as mietkosten, item_id from clan_ware inner join clan_item on clan_item.id = clan_ware.item_id where clan = '.$user_ida['clan'].' group by clan';
$sql ='SELECT miete, item_id, name, clan_ware.id from clan_ware inner join clan_item on clan_item.id = clan_ware.item_id where clan = '.$user_ida['clan'].' order by item_id asc';
//echo $sql.'<br>';
$qry = mysql_query($sql);
$clanraum = array();
$clanraum_a = array();
while($row = mysql_fetch_assoc($qry)){
$clanraum[$row['id']] = $row;
// print_r($row);
$clanraum_a[] = $row;
}
$raumanzahl = count($clanraum_a);
//echo 'Raumanzahl = '.$raumanzahl.'<br>';
$sql = 'SELECT chars.clan_train, count(chars.id) as anzahl from chars inner join user on chars.besitzer = user.id where user.clan = '.$user_ida['clan'].' and chars.clan_train != 0 group by chars.clan_train';
//echo $sql.'<br>';
$qry = mysql_query($sql);
$clanrauminfo = array();
while($row = mysql_fetch_assoc($qry)){
$clanrauminfo[$row['clan_train']] = $row;
}
//print_r($clanrauminfo);
$sql = 'select clan_ware.id as clan_warenid, user.id as userid, count(chars.id) as anzahl, clan.id as clanid from clan inner join clan_ware on clan.id = clan_ware.clan inner join clan_item on clan_item.id = clan_ware.item_id inner join user on clan.id = user.clan left join chars on user.id = chars.besitzer and clan_ware.id = chars.clan_train where clan.id = '.$user_ida['clan'].' group by userid, clan_warenid order by userid, clan_warenid';
$clans_spend = mysql_query('SELECT spende, nickname, user.id as userid FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC');
$member = mysql_num_rows($clans_spend);
$sql = 'select besitzer, round(sum(1/(1+exp(3-level/12)) * nutzung)) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan = '.$user_ida['clan'].' group by besitzer order by besitzer';