$costs ) { if($costs!="") { if(mysql_num_rows(safe_query("SELECT payedID FROM ".PREFIX."cash_box_payed WHERE userID='$usID' AND cashID='$id'"))) { safe_query("UPDATE ".PREFIX."cash_box_payed SET costs='$costs' WHERE userID='$usID' AND cashID='$id'"); } else { safe_query("INSERT INTO ".PREFIX."cash_box_payed (cashID, userID, costs, date, payed) VALUES ('$id', '$usID', '$costs', '$date', '1')"); } } } header("Location: index.php?site=cash_box&id=$id"); } elseif($_GET['action']=="new") { echo'

CASH-BOX

'; $anz=0; $ergebnis = safe_query("SELECT * FROM ".PREFIX."user ORDER BY nickname"); while($du=mysql_fetch_array($ergebnis)) { if(isclanmember($du[userID])) $anz++; } if($_GET['euro']=="") $euro="0.00"; if($_GET['usereuro']=="") $usereuro="0.00"; $squads = ''.getsquads(); eval ("\$cash_box_new = \"".gettemplate("cash_box_new")."\";"); echo $cash_box_new; } elseif($_GET['action']=="edit") { echo'

CASH-BOX

'; $id = $_GET['id']; $ergebnis=safe_query("SELECT * FROM ".PREFIX."cash_box WHERE cashID='$id'"); $ds=mysql_fetch_array($ergebnis); $day=date("d", $ds[paydate]); $month=date("m", $ds[paydate]); $year=date("Y", $ds[paydate]); $anz=0; $ergebnis = safe_query("SELECT * FROM ".PREFIX."user ORDER BY nickname"); while($du=mysql_fetch_array($ergebnis)) { if(iscashadmin($du[userID])) $anz++; } $squads = ''.getsquads(); $squads=str_replace('value="'.$ds[squad].'"', 'value="'.$ds[squad].'" selected', $squads); eval ("\$cash_box_edit = \"".gettemplate("cash_box_edit")."\";"); echo $cash_box_edit; } else { if(!isclanmember($userID) AND !iscashadmin($userID)) die ("ONLY FOR MEMBERS!"); echo'

CASH-BOX

'; $ergebnis = safe_query("SELECT * FROM ".PREFIX."cash_box_payed WHERE payed='1'"); $anz = mysql_num_rows($ergebnis); $costs=0.00; if($anz) { while($ds=mysql_fetch_array($ergebnis)) { $costs+=$ds[costs]; } } $ergebnis = safe_query("SELECT * FROM ".PREFIX."cash_box "); $anz = mysql_num_rows($ergebnis); if($anz) { while($ds=mysql_fetch_array($ergebnis)) { $costs-=$ds[totalcosts]; } } if($costs<0) $fontcolor=$loosecolor; else $fontcolor=$wincolor; $bg1=BG_1; $bg2=BG_2; if(iscashadmin($userID)) $cashadmin=''; eval ("\$cash_box_top = \"".gettemplate("cash_box_top")."\";"); echo $cash_box_top; $id = $_GET['id']; if(!isset($id)) { print_cashbox(0,0); $squadergebnis=safe_query("SELECT squadID FROM ".PREFIX."squads_members WHERE userID='$userID'"); while($da=mysql_fetch_array($squadergebnis)) { print_cashbox($da[squadID],0); } } else{ print_cashbox(0,$id); } } function print_cashbox($squadID,$id) { $bg1=BG_1; $bg2=BG_2; $pagebg=PAGEBG; $border=BORDER; $bghead=BGHEAD; $bgcat=BGCAT; global $wincolor; global $loosecolor; global $drawcolor; global $userID; if($id) { $squadergebnis=safe_query("SELECT squad FROM ".PREFIX."cash_box WHERE cashID='$id'"); $dv=mysql_fetch_array($squadergebnis); $squadID = $dv[squad]; } if($squadID == 0) $usersquad = "Clan"; else { $ergebnis_squad = safe_query("SELECT * FROM ".PREFIX."cash_box_payed, ".PREFIX."cash_box WHERE ".PREFIX."cash_box_payed.payed='1' AND ".PREFIX."cash_box_payed.cashID=".PREFIX."cash_box.cashID AND ".PREFIX."cash_box.squad = '".$squadID."'"); $anz_squad = mysql_num_rows($ergebnis_squad); $costs_squad=0.00; if($anz_squad) { while($dss=mysql_fetch_array($ergebnis_squad)) { $costs_squad+=$dss[costs]; } } $ergebnis_squad = safe_query("SELECT * FROM ".PREFIX."cash_box WHERE squad='$squadID'"); $anz_squad = mysql_num_rows($ergebnis_squad); if($anz_squad) { while($dss=mysql_fetch_array($ergebnis_squad)) { $costs_squad-=$dss[totalcosts]; } } $costs_squad = ' ('.$costs_squad.' euro)'; $usersquad = "Squad: ".getsquadname($squadID); } $ergebnis=safe_query("SELECT * FROM ".PREFIX."cash_box WHERE squad='".$squadID."' ORDER BY paydate DESC LIMIT 0,1"); echo'

'; echo '
'.$usersquad.$costs_squad.'
'; if(mysql_num_rows($ergebnis)) { $ds=mysql_fetch_array($ergebnis); if(!$id) $id = $ds[cashID]; $ergebnis=safe_query("SELECT * FROM ".PREFIX."cash_box WHERE cashID='$id'"); $ds=mysql_fetch_array($ergebnis); $date=date("d.m.Y", $ds[date]); $paydate=date("d.m.Y", $ds[paydate]); $bezahlen = safe_query("SELECT * FROM ".PREFIX."cash_box_payed WHERE cashID='$id' AND payed='1' "); $payed = mysql_num_rows($bezahlen); $konto = cleartext($ds[konto]); $usage=$ds[usedfor]; if(iscashadmin($userID)) $adminaction=' '; eval ("\$cash_box_usage = \"".gettemplate("cash_box_usage")."\";"); echo $cash_box_usage; $all=safe_query("SELECT * FROM ".PREFIX."cash_box WHERE squad='".$squadID."' ORDER BY paydate DESC"); echo'

'; while($ds=mysql_fetch_array($all)) { echo'• '.$ds[usedfor].'
'; } echo'
  '; $ergebnis = safe_query("SELECT * FROM ".PREFIX."user ORDER BY nickname"); while($du=mysql_fetch_array($ergebnis)) { if($squadID == 0) { if(isclanmember($du[userID],$squadID)) $members[]=$du[userID]; } else if(issquadmember($du[userID],$squadID)) $members[]=$du[userID]; } eval ("\$cash_box_head = \"".gettemplate("cash_box_head")."\";"); echo $cash_box_head; foreach($members as $usID) { $ergebnis = safe_query("SELECT * FROM ".PREFIX."cash_box_payed WHERE userID='$usID' AND cashID='$id'"); $du=mysql_fetch_array($ergebnis); $user=''.getnickname($usID).''; if($du[payed]) { $paydate=date("d.m.Y", $du[date]); $payed='payed: '.$paydate.''; } else { $payed='not payed yet!'; } if(iscashadmin($userID)) { if($du[costs]) { $bg=BG_1; $costs=$du[costs]; } else { $costs=""; $bg=BG_2; } $payment=' €'; } else { if($du[costs]) { $costs=''.$du[costs].' €'; $bg=BG_1; } else { $costs='0.00 €'; $bg=BG_2; } $payment=$costs; } eval ("\$cash_box_content = \"".gettemplate("cash_box_content")."\";"); echo $cash_box_content; } if(iscashadmin($userID)) $admin=''; eval ("\$cash_box_foot = \"".gettemplate("cash_box_foot")."\";"); echo $cash_box_foot; }else echo'no entries'; echo'
'; } ?>