function get_last_user_wars($userid,$game=''){ $s = ''; $erg = db_query("SELECT game FROM prefix_wars WHERE game = '".$game."' LIMIT 1"); if (db_num_rows($erg) > 0) { $db_game = 'AND game = \'".$game."\''; } else { $db_game = ''; } $q = db_query("SELECT `wid` FROM `prefix_warmember` WHERE uid = '".$userid."' AND aktion = '1' ORDER BY wid DESC LIMIT 5"); if (db_num_rows($q) > 0 ) { $wids = array(); while ($row = db_fetch_object($q)) { $wids[] = $row->wid; } $wids = implode(', ',$wids); } if( !empty($wids) ) { $erg = db_query("SELECT id, gegner, tag, wlp, land, owp, opp, gegner, game, mtyp FROM prefix_wars WHERE id IN ($wids) AND status = '3' ".$db_game.""); if (db_num_rows($erg) > 0 ) { while ($r = db_fetch_assoc($erg)) { if ($class == 'Cmite') { $class = 'Cnorm'; } else { $class = 'Cmite'; } $r['tag'] = ( empty($r['tag']) ? $r['gegner'] : $r['tag'] ); if ($r['wlp'] == 1) { $bild = 'include/images/icons/win.gif'; $color = '#558e3d'; } elseif ($r['wlp'] == 2) { $bild = 'include/images/icons/los.gif'; $color = '#a91d1d'; } elseif ($r['wlp'] == 3) { $bild = 'include/images/icons/pad.gif'; $color = '#f0770d'; } $s .= '<tr class="Cmite"> <td align="left" valign="bottom"><img src="include/images/flags/'.$r['land'].'" alt="'.$r['land'].'"/> <a href="index.php?wars-more-'.$r['id'].'">'.((strlen($r['gegner'])<20) ? $r['gegner'] : substr($r['gegner'],0,20).'...').'</a></td> <td>'.$r['mtyp'].'</td> </tr>'; } } else { $s .= ''; } } else { $s .= '<td class="Cmite" align="left" colspan="2">Keine Wars</td>'; } return ($s); }
Zuletzt modifiziert von Lord|Schirmer am 28.11.2011 - 17:16:16