Ja klar die Datei ist oben...
Hier mal meine vollkommen bearbeitete Datei, vielleicht kannst du sie dir mal anschauen. Hab an jeder Stelle die ich gefunden hab ergänzt...
<?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
function get_erg_liste($wid) {
$list = ''; $enar = array ( 'jpg', 'gif', 'png', 'jpeg');
$erg = db_query("SELECT * FROM prefix_warmaps WHERE wid = ".$wid);
while($row = db_fetch_assoc($erg) ) {
if ( $row['opp'] == $row['owp'] ) {
$farbe = 'FDFBB7'; #pat
} elseif ( $row['opp'] < $row['owp'] ) {
$farbe = 'C8E1B8'; #win
} elseif ( $row['opp'] > $row['owp'] ) {
$farbe = 'D8B9B9'; #los
} elseif ( $row['opp'] > $row['owp'] ) {
$farbe = '9999FF'; #fun
}
foreach($enar as $v) {
if ( file_exists ( 'include/images/wars/'.$wid.'_'.$row['mnr'].'.'.$v ) ) {
$row['map'] = '<a href="include/images/wars/'.$wid.'_'.$row['mnr'].'.'.$v.'" target="_blank">'.$row['map'].'</a>';
break;
}
}
$list .= '<tr bgcolor="#'.$farbe.'">';
$list .= '<td><font color="#000000">'.$row['map'].'</font></td>';
$list .= '<td><font color="#000000">'.$row['opp'].'</font></td>';
$list .= '<td><font color="#000000">'.$row['owp'].'</font></td>';
$list .= '<td><font color="#000000">'.$row['owp'].'</font></td>';
$list .= '</tr>';
}
return ($list);
}
if ( empty ($_GET['mehr']) ) {
$title = $allgAr['title'].' :: Wars';
$hmenu = 'Wars';
$design = new design ( $title , $hmenu );
$design->header();
$ergWin = db_query('SELECT COUNT(id) FROM `prefix_wars` WHERE wlp = "1"');
$anzWin = db_result($ergWin,0);
$ergLos = db_query('SELECT COUNT(id) FROM `prefix_wars` WHERE wlp = "2"');
$anzLos = db_result($ergLos,0);
$ergPat = db_query('SELECT COUNT(id) FROM `prefix_wars` WHERE wlp = "3"');
$anzPat = db_result($ergPat,0);
$tpl = new tpl ( 'wars.htm' );
$tpl->set_ar_out ( array('PAT' => $anzPat, 'WIN' => $anzWin, 'LOS' => $anzLos, 'FUN' => $anzFun ) , 0 );
$akttime = date('Y-m-d');
$class = '';
$erg = db_query("SELECT a.id,a.gegner,a.page,b.name as team,DATE_FORMAT(datime,'%d.%m.%Y - %H:%i:%s') as time FROM prefix_wars a left join prefix_groups b ON a.tid = b.id WHERE status = 1 AND a.datime > '".$akttime."' ORDER BY a.datime");
if ( db_num_rows ( $erg ) == 0 ) {
echo '<tr class="Cmite"><td colspan="4"><strong>kein Next War vorhanden</strong></td></tr>';
} else {
while ($row = db_fetch_assoc($erg) ) {
if ( $class == 'Cmite' ) { $class = 'Cnorm'; } else { $class = 'Cmite'; }
$row['class'] = $class;
$tpl->set_ar_out($row,1);
}
}
$tpl->out(2);
$class = '';
# seiten funktion
$limit = 15; // Limit
if(empty($_GET['page'])) { $_GET['page'] = 1; }
$MPL = db_make_sites ($_GET['page'] , "WHERE status = 2" , $limit , "?m=wars" , 'wars' );
$anfang = ($_GET['page'] - 1) * $limit;
# seiten funktion
$farbe1wlpar = array(1=>'C8E1B8',2=>'D8B9B9',3=>'FDFBB7',4=>'9999FF');
$farbe2wlpar = array(1=>'00FF00',2=>'FF0000',3=>'FFFF00',4=>'9999FF');
$erg = db_query("SELECT a.owp,a.opp,a.wlp,a.land,a.mtyp,a.game,a.id,a.gegner,a.page,b.name as team,DATE_FORMAT(datime,'%d.%m.%Y') as time FROM prefix_wars a left join prefix_groups b ON a.tid = b.id WHERE status = 2 ORDER BY a.datime DESC, id DESC LIMIT ".$anfang.",".$limit);
while ($row = db_fetch_assoc($erg) ) {
$row['erg'] = $row['owp'].':'.$row['opp'];
$row['farbe'] = $farbe1wlpar[$row['wlp']];
$row['farbe2'] = $farbe2wlpar[$row['wlp']];
if ( $class == 'Cmite' ) { $class = 'Cnorm'; } else { $class = 'Cmite'; }
$row['class'] = $class;
$tpl->set_ar_out($row,3);
}
$tpl->out(4);
echo $MPL;
} else {
$_GET['mehr'] = escape($_GET['mehr'],'integer');
$erg = db_query("SELECT DATE_FORMAT(datime,'%d.%m.%Y') as datum,a.tid,a.status,a.owp,a.opp,a.wlp, DATE_FORMAT(datime,'%H:%i:%s') as zeit,a.gegner,a.page,a.`mod`,a.mtyp,a.game,a.land,a.txt,b.name as team FROM prefix_wars a left join prefix_groups b ON a.tid = b.id WHERE a.id = ".$_GET['mehr']);
$row = db_fetch_assoc($erg);
$row['txt'] = bbcode($row['txt']);
if ( $row['status'] == 1 ) {
# nextwars
$title = $allgAr['title'].' :: Wars :: Nextwars';
$hmenu = '<a href="?m=wars" class="smalfont">Wars</a><b> » </b>Nextwars';
$design = new design ( $title , $hmenu );
$design->header();
$tpl = new tpl ('wars_next');
$tpl->set_ar_out($row,0);
if ( $_SESSION['authright'] <= -2 ) {
# get benoetige member
$bm = substr($row['mod'],0,3); $needed = '';
for($i=0;$i<=2;$i++) {
if ( is_numeric($bm{$i}) ) {
$needed .= $bm{$i};
}
}
$ck = db_count_query("SELECT COUNT(wid) FROM prefix_warmember WHERE wid = ".$_GET['mehr']." AND uid = ".$_SESSION['authid']);
# den zustand wechseln
if ( $_GET['change'] == true AND check_rights(array($row['tid'])) == true AND $ck == 1) {
$na = ( 1 == db_count_query("SELECT COUNT(aktion) FROM prefix_warmember WHERE wid = ".$_GET['mehr']." AND uid = ".$_SESSION['authid']." AND aktion = 1") ? 0 : 1 );
db_query("UPDATE prefix_warmember SET aktion = ".$na." WHERE wid = ".$_GET['mehr']." AND uid = ".$_SESSION['authid']);
}
$available = db_count_query("SELECT COUNT(uid) FROM prefix_warmember WHERE wid = ".$_GET['mehr']." AND aktion = 1");
$aout1 = array (
'needed' => $needed,
'available' => $available,
'id' => $_GET['mehr']
);
$tpl->set_ar_out($aout1,1);
if ( $ck == 0 AND check_rights(array($row['tid'])) == true ) {
if ( isset ($_POST['sub']) ) {
$aktion = ( $_POST['sub'] == 'zusagen' ? 1 : 0 );
$kom = escape($_POST['kom'],'string');
db_query("INSERT INTO prefix_warmember (uid,wid,aktion,kom) VALUES (".$_SESSION['authid'].",".$_GET['mehr'].",".$aktion.",'".$kom."')");
} else {
$tpl->out(2);
}
}
$class = '';
$aktionar = array ('abgesagt','zugesagt');
$erg1 = db_query("SELECT b.id as uid, b.name, a.aktion, a.kom FROM prefix_warmember a left join prefix_user b ON b.id = a.uid WHERE a.wid = ".$_GET['mehr']);
while ($row1 = db_fetch_assoc($erg1) ) {
if ( $class == 'Cmite' ) { $class = 'Cnorm'; } else { $class = 'Cmite'; }
$row1['class'] = $class;
$row1['aktion'] = $aktionar[$row1['aktion']];
$row1['name'] = ( $row1['uid'] == $_SESSION['authid'] ? '<a href="?m=wars&mehr='.$_GET['mehr'].'&change=true" title="ins Gegenteil aendern">'.$row1['name'].'</a>' : $row1['name'] );
$tpl->set_ar_out($row1,3);
}
}
$tpl->out(4);
} elseif ($row['status'] == 2) {
# lastwars
$wlpar = array(1=>'gewonnen',2=>'verloren',3=>'unentschieden',4=>'funwar');
$row['erg'] = $row['owp'].' zu '.$row['opp'];
$row['ergliste'] = get_erg_liste($_GET['mehr']);
$row['wlp'] = $wlpar[$row['wlp']];
$title = $allgAr['title'].' :: Wars :: Nextwars';
$hmenu = '<a href="?m=wars" class="smalfont">Wars</a><b> » </b>Lastwars';
$design = new design ( $title , $hmenu );
$design->header();
$tpl = new tpl ('wars_last');
$tpl->set_ar_out($row,0);
}
}
$design->footer();
?>