ilch Forum » Ilch Clan 1.1 » Module und Modifikationen » Liga Module doppelt nehmen!

Geschlossen
  1. #1
    User Pic
    Excalibu Mitglied
    Registriert seit
    16.03.2007
    Beiträge
    114
    Beitragswertungen
    0 Beitragspunkte
    Hallihallo

    ich wuerde gerne weil wir ein Multigaming Clan sind und in 2 Squads gerade interne Ligen veranstalten das Liga Module doppelt nehmen, habe die Tabellen usw. geaendert aber es geht nicht es kommt auch kein Fehler sondern einfahc nur wieder die Startseite auf der Page so wie im Admin Menu!

    Vielen Dank shconmal fuer eure Hilfe


    Hier die Dateien:

    1. zum runterladen: externer Link

    2. zum hier anschauen:

    install_liga_css.php

    <?php
    
    define ( 'main' , TRUE );
    require_once('include/includes/config.php');
    require_once('include/includes/func/db/mysql.php');
    
    db_connect();
    
    $sql_file = implode('',file('liga_css.sql'));
    $sql_file = preg_replace ("/(\015\012|\015|\012)/", "\n", $sql_file);
    $sql_statements = explode(";\n",$sql_file);
    foreach ( $sql_statements as $sql_statement ) {
      if ( trim($sql_statement) != '' ) {
        echo '<pre>'.$sql_statement.'</pre>';
        $e = db_query($sql_statement);
        if (!$e) { echo '<font color="#FF0000"><b>Es ist ein Fehler aufgetreten</b></font>, bitte alles auf dieser Seite kopieren und auf ilch.de im Forum fragen...:<div style="border: 1px dashed grey; padding: 5px; background-color: #EEEEEE">'. mysql_error().'<hr>'.$sql_statement.'</div><br /><br />'; }
        echo '<hr>';
    	}
    }
    
    echo 'Datenbank erfolgreich upgedatet!<br />';
    echo 'Das Updatefile "liga.sql" und die "install_liga.php" k&ouml;nnen gel&ouml;scht werden!';
    
    ?>


    liga_css.sql

     CREATE TABLE `prefix_liga_matches_css` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `stag` tinyint(4) NOT NULL,
      `tid1` mediumint(9) NOT NULL,
      `tid2` mediumint(9) NOT NULL,
      `points1` tinyint(4) default NULL,
      `points2` tinyint(4) default NULL,
      `datum` date default NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=23 ;
    
    CREATE TABLE `prefix_liga_teams_css` (
      `id` mediumint(9) unsigned NOT NULL,
      `points` smallint(6) default NULL,
      `opoints` smallint(6) default NULL,
      `s` smallint(6) default NULL,
      `n` smallint(6) default NULL,
      `u` smallint(6) default NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
    
    INSERT INTO `prefix_modules` (`id`, `url`, `name`, `gshow`, `ashow`, `fright`) VALUES (NULL, 'liga_css', 'Liga CSS', '1', '1', '1');


    include\admin\liga_css.php


    <?php
    #######################
    # Liga Modul          #
    # angepasst für Ilch  #
    # von Mairu           #
    # Adminbereich        #
    #######################
    error_reporting(E_ALL);
    defined ('main') or die ( 'no direct access' );
    defined ('admin') or die ( 'only admin access' );
    
    $design = new design ( 'Admins Area', 'Admins Area', 2 );
    $design->header();
    
    $menue = array(
      "Spieler eintragen" => "insertplayer",
      "Spieler l&ouml;schen" => "delete",
      "Spiel eintragen" => "insert",
      "Spiel&uuml;bersicht" => "stat",
      "Tabelle" => "tabelle",
    );
    
    echo '<table width="100%">';
    foreach($menue as $eintrag =>$datei){ 
     if ($datei == $menu->get(1)) {
       echo '<td align="center" bgcolor="#78B1D9">';
       echo $eintrag;
       echo '</td>';
       } else {
       echo '<td align="center" bgcolor="#c0c0c0">';
       echo '<a href="admin.php?liga_css-'.$datei.'">'.$eintrag.'</a>';
       echo '</td>';
       }
    }
    echo '</tr></table>';
    
    switch ($menu->get(1)) {
      default: case 'stat':
        $stage = array();
        $sql = db_query("SELECT DISTINCT stag FROM `prefix_liga_matches_css` ORDER BY stag");
        while ($row = @db_fetch_object($sql)) $stage[] = $row->stag;
        $anzst = count($stage);
        $aktstag = @db_result(db_query("SELECT stag FROM `prefix_liga_matches_css` WHERE points1 IS NOT NULL ORDER BY stag DESC LIMIT 1"),0);
        $aktstag = (is_numeric($aktstag)?$aktstag:1);
            if ($anzst == 0) {
        echo '<br /><center><h2>Es wurden noch keine Spiele eingetragen</h2></center><br />';
        break;
        }
        if ($menu->get(2) == 'alle') $stag = 'alle';
        else $stag = ($menu->getA(2) == 's' ? $menu->getE(2) : $aktstag);//$stage[$anzst-1]);
        echo "<center><h2>Spieltag: $stag</h2></center>";
        ?>
        <table width="100%" border="1" cellspacing="0" cellpadding="1">
        <tr>
          <td><b>ST</b></td>
          <td><b>Datum</b></td>
        	<td><b>Spieler A</b></td>
          <td><b>Spieler B</b></td>
          <td><b>Ergebnis</b></td>
          <td></td>
          </tr>
        <?
        $sql = db_query("SELECT a.id,a.stag,a.points1,a.points2,DATE_FORMAT(a.datum,'%d.%m.%Y') as datum,b.name as team1,c.name as team2
         FROM `prefix_liga_matches_css` a 
         LEFT JOIN `prefix_user` b ON a.tid1 = b.id
         LEFT JOIN `prefix_user` c ON a.tid2 = c.id
         ".($stag == 'alle'? '':"WHERE a.stag = $stag ")
         ."ORDER BY stag, datum DESC");
        while ($ds = db_fetch_object($sql)) 
        {
          echo "<tr><td>$ds->stag</td><td>$ds->datum</td><td>$ds->team1</td><td>$ds->team2</td><td align=\"center\">$ds->points1 : $ds->points2</td><td>
          <a href=\"admin.php?liga_css-insert-change-$ds->id\"><img src=\"include/images/icons/edit.gif\"/></a> 
          <a href=\"admin.php?liga_css-insert-del-$ds->id\"><img src=\"include/images/icons/del.gif\"/></a></td></tr>";
        }
        echo '</table><br /><center>[<a href="admin.php?liga_css-stat-alle">alle</a>|';
        foreach ($stage as $key => $st) echo '<a href="admin.php?liga_css-stat-s'.$st.'">'.$st.'</a>'.($key+1 == $anzst ? '':'|');
        echo ']<br /><br /><a href="admin.php?liga_css-insert-delall">Alle Spiele l&ouml;schen</a></center>';
        break;
      case 'tabelle':
        ?>
        <table width="100%" border="1" cellspacing="0" cellpadding="4" style="border-collapse: collapse" bordercolor="#000000">
        <tr align="center">
            <td><b>Platz</b></td>
            <td><b>Spielername</b></td>
            <td><b>Sp.</b></td>
            <td><b>S</b></td>
            <td><b>U</b></td>
            <td><b>N</b></td>
            <td><b>Runden</b></td>
            <td ><b>Punkte</b></td></tr>   
        <?
        $sql = db_query("SELECT a.id,a.points,a.opoints,a.s,a.u,a.n,(a.s*3+a.u) as punkte,b.name FROM `prefix_liga_teams_css` a
         LEFT JOIN `prefix_user` b ON a.id = b.id
         ORDER BY punkte DESC, (points-opoints) DESC, points DESC");
        $rank = 0;
        $count = db_result(db_query("SELECT COUNT(*) FROM `prefix_liga_teams_css`"),0);
        while ($ds = db_fetch_object($sql)) 
        {
          $rank ++;
          if ($rank == 1) $color = ' bgcolor="#008000"';
          elseif ($rank > $count - 3) $color = ' bgcolor="#FF0000"';
          else $color = '';
          echo "<tr align=\"center\"$color><td><b>$rank</td><td><b>$ds->name</td><td>".($ds->s+$ds->u+$ds->n)."</td><td>$ds->s</td><td>$ds->u</td><td>$ds->n</td><td>$ds->points : $ds->opoints</td><td><b>$ds->punkte</b></td></tr>";
        }
        echo '</table>';  
        break;
      case 'insert':
        if ($menu->get(2) == 'auswertung') {
           $heim = $_POST['heim'];
           $ausw = $_POST['auswaerts'];
           $theim = $_POST['t1'];
           $tausw = $_POST['t2'];
           $stag = $_POST['stag'];
           // Fehlerabfrage
           if ($heim == $ausw) {
           echo 'Das sollte nicht gehen, gegen sich selbst zu spielen ;)<br />';
           echo '<input type="button" value="zur&uuml;ck" onClick="history.back()">';
           }
           elseif (!is_numeric($stag) OR 
           (!is_numeric($tausw) OR !is_numeric($theim)) XOR 
           ($theim=='' AND $tausw=='')) echo 'Spieltag und Tore m&uuml;ssen Zahlen sein<br />
           Tore k&ouml;nnen auch leer gelassen werden.<br />
           <input type="button" value="zur&uuml;ck" onClick="history.back()">'; 
           elseif (preg_match("/\d\d.\d\d.\d\d\d\d/",$_POST['date']) == 0 AND $_POST['date'] != '') {
            echo 'Datum TT.MM.JJJJ muss richtig angegeben sein, es ist auch m&ouml;glich kein Datum anzugeben.';
           }
           else {
          //In Datenbank eintragen
          if ($_POST['date'] == '') $datum = 'NULL';
          else {
            $d = explode('.',$_POST['date']);
            $datum = "'".date('Y-m-d',mktime(0,0,0,$d[1],$d[0],$d[2]))."'";
            }
          //Spiel eintragen
          if ($_POST['t1'] == '' AND $_POST['t2'] == '') {$theim='NULL';$tausw='NULL';}
          db_query("INSERT INTO `prefix_liga_matches_css` (stag, tid1, tid2, points1, points2, datum) VALUES ($stag, $heim, $ausw, ".$theim.", ".$tausw.", ".$datum.")");
          //Manschaften anpassen
          if (is_numeric($theim) AND is_numeric($tausw)) {
           //Auswerten
           if ($theim > $tausw) //Sieg Heim
            {
            $sh = 1;  $sa = 0;       
            $uh = 0;  $ua = 0;
            $nh = 0;  $na = 1;
            }
           elseif ($tausw > $theim) //Sieg Auswärts
            {
            $sh = 0;  $sa = 1;       
            $uh = 0;  $ua = 0;
            $nh = 1;  $na = 0;
            }
          else //Unentschieden
            {
            $sh = 0;  $sa = 0;       
            $uh = 1;  $ua = 1;
            $nh = 0;  $na = 0;
            }
          db_query("UPDATE `prefix_liga_teams_css` SET points = points + $theim, opoints = opoints + $tausw, s = s + $sh, u = u + $uh, n = n + $nh WHERE id = ".$heim);
          db_query("UPDATE `prefix_liga_teams_css` SET points = points + $tausw, opoints = opoints + $theim, s = s + $sa, u = u + $ua, n = n + $na WHERE id = ".$ausw);       
          }
          echo 'Spiel eingetragen<br />
          <form action="admin.php?liga_css-insert" method="post">
          <input type="button" value="zur&uuml;ck" onClick="history.back()"/> 
          <input type="hidden" name="date" value="'.$_POST['date'].'"/>
          <input type="hidden" name="stag" value="'.$stag.'"/>
          <input type="submit" value="noch ein Spiel eintragen"/>
          </form>';
          }
        } elseif ($menu->get(2) == 'del'){
          $id = $menu->get(3);
          $todel = db_fetch_object(db_query("SELECT * FROM `prefix_liga_matches_css` WHERE id = ".$id));
          db_query("DELETE FROM `prefix_liga_matches_css` WHERE id = ".$id);
          $erg = $todel->points1 - $todel->points2;
          $s1 = 0; $u1 = 0; $n1 = 0; $s2 = 0; $u2 = 0; $n2 = 0;
          if ($erg > 0) {$s1 = 1; $n2 = 1;}
          elseif ($erg < 0) {$n1 = 1; $s2 = 1;}
          else {$u1 = 1; $u2 = 1;}
            db_query("UPDATE `prefix_liga_teams_css` SET points = points - $todel->points1, opoints = opoints - $todel->points2, s = s - $s1, u = u - $u1, n = n - $n1 WHERE id = ".$todel->tid1);
            db_query("UPDATE `prefix_liga_teams_css` SET points = points - $todel->points2, opoints = opoints - $todel->points1, s = s - $s2, u = u - $u2, n = n - $n2 WHERE id = ".$todel->tid2);
          echo "Datensatz erfolgreich gel&ouml;scht<br />";
          echo '<input type="button" value="zurück" onClick="history.back()">';
        }
        elseif ($menu->get(2) == 'delall'){
          db_query("DELETE FROM `prefix_liga_matches_css`");
          db_query("UPDATE `prefix_liga_teams_css` SET points = 0, opoints = 0, s = 0, u = 0, n = 0");
          echo "Alle Datens&auml;tze erfolgreich gel&ouml;scht<br />";
          echo '<input type="button" value="zur&uuml;ck" onClick="history.back()">';   
        }
        elseif ($menu->get(2) == 'change') {
          $id = $menu->get(3); 
          $sp = db_fetch_object(db_query("SELECT a.id,a.stag,a.points1,a.points2,a.datum,b.name as team1,c.name as team2
         FROM `prefix_liga_matches_css` a 
         LEFT JOIN `prefix_user` b ON a.tid1 = b.id
         LEFT JOIN `prefix_user` c ON a.tid2 = c.id
         WHERE a.id = $id"));
         $d = explode('-',$sp->datum);
         $date = (is_null($sp->datum) ? date('d.m.Y') : date('d.m.Y',mktime(0,0,0,$d[1],$d[2],$d[0])));
        echo "<form action=\"admin.php?liga_css-insert-changeset\" method=\"post\">
        <input type=\"hidden\" name=\"id\" value=\"$id\" />
        <br /><b>$sp->team1  :  $sp->team2</b><br />"; 
        echo '<table border="0" width="400"><tr align="center"><th width="100">Spieltag</th><th>Ergebnis</th><th>Datum</th></tr>
          <tr align="center"><td>'.$sp->stag.'</td>
          <td><input name="t1" size="3" value="'.(($sp->points1 == 0 AND $sp->points2 == 0) ? '':$sp->points1).'"> : <input name="t2" size="3" value="'.(($sp->points1 == 0 AND $sp->points2 == 0) ? '':$sp->points2).'"></td>
          <td><input name="date" value="'.$date.'" size="10"/></td>
          </tr></table><br /><input type="submit" value="&auml;ndern" />'; 
        }
        elseif ($menu->get(2) == 'changeset'){
          $id = $_POST['id'];
           if (((!is_numeric($_POST['t1']) OR !is_numeric($_POST['t2'])) AND ((!empty($_POST['t1']) AND !empty($_POST['t2'])) OR !(empty($_POST['t1']) AND empty($_POST['t2']))))) echo 'Tore m&uuml;ssen Zahlen oder beide leer sein<br />
                  <input type="button" value="zur&uuml;ck" onClick="history.back()">'; 
           elseif (preg_match("/\d\d.\d\d.\d\d\d\d/",$_POST['date']) == 0 AND $_POST['date'] != '')
            echo 'Datum TT.MM.JJJJ muss richtig angegeben sein, es ist auch m&ouml;glich kein Datum anzugeben
                  <input type="button" value="zur&uuml;ck" onClick="history.back()">';
           else { 
          if ($_POST['date'] == '') $datum = 'NULL';
          else {
            $d = explode('.',$_POST['date']);
            $datum = "'".date('Y-m-d',mktime(0,0,0,$d[1],$d[0],$d[2]))."'";
            }
          $t = db_fetch_object(db_query("SELECT tid1,tid2,points1,points2,stag FROM `prefix_liga_matches_css` WHERE id = ".$id));
          $points1 = ($_POST['t1']!='' ? $_POST['t1'] : 'NULL');
          $points2 = ($_POST['t2']!='' ? $_POST['t2'] : 'NULL');      
          db_query("UPDATE `prefix_liga_matches_css` SET points1 = ".$points1.", points2 = ".$points2.", datum = ".$datum." WHERE id = ".$id);
          if (is_numeric($points1) AND is_numeric($points2)) {
            $t1 = db_fetch_object(db_query("SELECT id,points,opoints,s,u,n FROM `prefix_liga_teams_css` WHERE id = ".$t->tid1));
            $t2 = db_fetch_object(db_query("SELECT id,points,opoints,s,u,n FROM `prefix_liga_teams_css` WHERE id = ".$t->tid2));
              //Auswertung
              if (is_null($t->points1) AND is_null($t->points2)){ //Noch nichts eingetragen
                if ($points1 > $points2) {$sh=1;$sa=0;$uh=0;$ua=0;$nh=0;$na=1;}
                elseif ($points2 > $points1) {$sh=0;$sa=1;$uh=0;$ua=0;$nh=1;$na=0;}
                else {$sh=0;$sa=0;$uh=1;$ua=1;$nh=0;$na=0;}
                db_query("UPDATE `prefix_liga_teams_css` SET points = points + $points1, opoints = opoints + $points2, s = s + $sh, u = u + $uh, n = n + $nh WHERE id = ".$t->tid1);
                db_query("UPDATE `prefix_liga_teams_css` SET points = points + $points2, opoints = opoints + $points1, s = s + $sa, u = u + $ua, n = n + $na WHERE id = ".$t->tid2);
                }
              else{
                if ($t->points1 > $t->points2) { //Ergebnis verändern
                  if ($points1 > $_POST['t2']) {$sh=0;$uh=0;$nh=0;$sa=0;$ua=0;$na=0;}
                  elseif ($points1 < $points2) {$sh=-1;$uh=0;$nh=1;$sa=1;$ua=0;$na=-1;}
                  elseif ($points1 == 'NULL' AND $points2 == 'NULL') {$points1=0;$points2=0;$sh=-1;$uh=0;$nh=0;$sa=0;$ua=0;$na=-1;}
                  else {$sh=-1;$uh=1;$nh=0;$sa=0;$ua=1;$na=-1;}
                  }
                elseif ($t->points1 < $t->points2) {
                  if ($points1 > $points2) {$sh=1;$uh=0;$nh=-1;$sa=-1;$ua=0;$na=1;}
                  elseif ($points1 < $points2) {$sh=0;$uh=0;$nh=0;$sa=0;$ua=0;$na=0;}
                  elseif ($points1 == 'NULL' AND $points2 == 'NULL') {$points1=0;$points2=0;$sh=0;$uh=0;$nh=-1;$sa=-1;$ua=0;$na=0;}
                  else {$sh=0;$uh=1;$nh=-1;$sa=-1;$ua=1;$na=0;}
                  }
                else {
                  if ($points1 > $points2) {$sh=1;$uh=-1;$nh=0;$sa=0;$ua=-1;$na=1;}
                  elseif ($points1 < $points2) {$sh=0;$uh=-1;$nh=1;$sa=1;$ua=-1;$na=0;}
                  elseif ($points1 == 'NULL' AND $points2 == 'NULL') {$points1=0;$points2=0;$sh=0;$uh=-1;$nh=0;$sa=0;$ua=-1;$na=0;}
                  else {$sh=0;$uh=0;$nh=0;$sa=0;$ua=0;$na=0;}
                  }
               db_query("UPDATE `prefix_liga_teams_css` SET points = points + $points1 - $t->points1, opoints = opoints + $points2 - $t->points2, s = s + $sh, u = u + $uh, n = n + $nh WHERE id = ".$t->tid1);
               db_query("UPDATE `prefix_liga_teams_css` SET points = points + $points2 - $t->points2, opoints = opoints + $points1 - $t->points1, s = s + $sa, u = u + $ua, n = n + $na WHERE id = ".$t->tid2);
               }       
            }
            elseif ($points1 == 'NULL' AND $points2 == 'NULL' AND !(is_null($t->points1) AND is_null($t->points2))) {
              if ($t->points1 > $t->points2) {$points1=0;$points2=0;$sh=-1;$uh=0;$nh=0;$sa=0;$ua=0;$na=-1;} 
            	elseif ($t->points1 < $t->points2) {$points1=0;$points2=0;$sh=0;$uh=0;$nh=-1;$sa=-1;$ua=0;$na=0;}
            	else {$points1=0;$points2=0;$sh=0;$uh=-1;$nh=0;$sa=0;$ua=-1;$na=0;}
            	db_query("UPDATE `prefix_liga_teams_css` SET points = points - $t->points1, opoints = opoints - $t->points2, s = s + $sh, u = u + $uh, n = n + $nh WHERE id = ".$t->tid1);
              db_query("UPDATE `prefix_liga_teams_css` SET points = points - $t->points2, opoints = opoints - $t->points1, s = s + $sa, u = u + $ua, n = n + $na WHERE id = ".$t->tid2); 
            }
           echo 'Daten ge&auml;ndert<br /><input type="button" value="zur&uuml;ck" onClick="location.replace(\'admin.php?liga_css-stat-s'.$t->stag.'\')">';
          }}
        else {
        ?>
          <br />
          <br /><center>
          <?
          $teamsopt = '';
          $date = (!isset($_POST['date']) ? date("d.m.Y") : $_POST['date']);
          $stag = (!isset($_POST['stag']) ? ($menu->getA(2) == 's'?$menu->getE(2):'') : $_POST['stag']);
          $sql = db_query("SELECT a.id,b.name FROM `prefix_liga_teams_css` a LEFT JOIN `prefix_user` b ON a.id = b.id");
          if (is_numeric($stag)) {
            while ($ds = db_fetch_object($sql)) {
              if (db_result(db_query("SELECT COUNT(*) FROM `prefix_liga_matches_css` WHERE stag = $stag AND (tid1 = $ds->id OR tid2 = $ds->id)"),0) == 0)   
                  $teamsopt .= "<option value=\"$ds->id\">$ds->name</option>";
              }
            }
          else {
            while ($ds = db_fetch_object($sql)) $teamsopt .= "<option value=\"$ds->id\">$ds->name</option>";
            }
          echo '<form action="admin.php?liga_css-insert-auswertung" method="post">
                <select name="heim">'.$teamsopt.
          '</select> vs <select name="auswaerts">'.$teamsopt.'</select>
          <table border="0" width="400"><tr align="center"><th width="100">Spieltag</th><th>Ergebnis</th><th>Datum</th></tr>
          <tr align="center"><td><input type="text" size="2" name="stag" value="'.$stag.'"/></td>
          <td><input name="t1" size="3"> : <input name="t2" size="3"></td>
          <td><input name="date" value="'.$date.'" size="10"/></td>
          </tr></table>
          <input type="submit" value="Spiel eintragen"> <input type="button" value="Zur&uuml;cksetzen" onclick="location.replace(\'admin.php?liga_css-insert\');"/><br />
          </form></center>';
        }
        break;  
      case 'insertplayer':
        echo '<form action="admin.php?liga_css-player" method="post" name="form">
        <b>Spieler:</b> 
        <select name="name">';
        
          $regteams = array();
          $sql_t1 = db_query("SELECT id FROM `prefix_liga_teams_css`");    
          while ($row_1 = db_fetch_object($sql_t1)) $regteams[] = $row_1->id;
          $sql_t3 = db_query("SELECT id,name FROM `prefix_user`");
          while ($row_3 = db_fetch_object($sql_t3)) if (!in_array($row_3->id, $regteams)) echo "<option value=\"$row_3->id\">$row_3->name</option>";
    
        echo '</select><br><p><input type="submit" value="eintragen"></p><br>
        </form>';   
        	break;
      case 'delete':
        if ($menu->get(2) == 'auswertung') {
          $tid = $_POST['tid'];
          $query = "DELETE FROM `prefix_liga_teams_css` WHERE id = ".$tid;      
          $dummy = db_query($query);
          echo"Spieler wurde erfolgreich gel&ouml;scht";
          echo '<br /><input type="button" value="zurück" onClick="history.back()">';    
        }
        else {
        echo "Spieler l&ouml;schen";
        echo "<form action=\"admin.php?liga_css-delete-auswertung\" method=\"post\">";
        echo "<select name=\"tid\">";
        $sql = db_query("SELECT a.id,a.name FROM `prefix_user` a LEFT JOIN `prefix_liga_teams_css` b ON a.id = b.id WHERE a.id = b.id");
        while ($ds = db_fetch_object($sql)) echo "<option value=\"$ds->id\">$ds->name</option>";
        echo"</select>";
        
        echo "<p><input type=\"submit\" value=\"Spieler l&ouml;schen\"></p><br></form>";
        }  
      	break;
      case 'player':
        $neuerspieler = $_POST['name'];
        $query = "INSERT INTO `prefix_liga_teams_css` (id,points,opoints,s,u,n) VALUES ($neuerspieler,0,0,0,0,0)";
        $dummy = db_query($query);
        echo "Spieler erfolgreich eingetragen!<br />";
        echo '<input type="button" value="zurück" onClick="history.back()">';  
        break;
    }
    $design->footer();
    ?>


    include\contents\liga_css.php
    <?php
    #######################
    # Liga Modul          #
    # angepasst für Ilch  #
    # von Mairu           #
    # Content             #
    #######################
    defined ('main') or die ( 'no direct access' );
    
    $menue = array(
      "Tabelle" => "table",
      "Spiele" => "showmatches",
      );
    
    $auswahl = ($menu->get(1) == '' ? 'table' : $menu->get(1));
    
    $title = $allgAr['title'].' :: Liga :: '.array_search($auswahl,$menue);
    $hmenu  = 'Liga <b> &raquo; </b> '.array_search($auswahl,$menue);
    $design = new design ( $title , $hmenu, 1, 'liga/index.htm' );
    $design->header();
    
    echo '<table width="100%">';
    foreach($menue as $eintrag =>$datei){ 
     if ($datei == $auswahl) {
       echo '<td align="center" bgcolor="#CC0000"><font size="1" face="Verdana" color="#FFFFFF"><b>';
       echo $eintrag;
       echo '</b></font></td>';
       } else {
       echo '<td align="center" bgcolor="#c0c0c0"><font size="1" face="Verdana" color="#FFFFFF"><b>';
       echo '<a href="index.php?liga_css-'.$datei.'">'.$eintrag.'</a>';
       echo '</b></font></td>';
       }
    }
    echo '</tr></table>';
        
    
    
    switch ($auswahl) {
      case 'showmatches':
        $stage = array();
        $sql = db_query("SELECT DISTINCT stag FROM `prefix_liga_matches_css` ORDER BY stag");
        while ($row = @db_fetch_object($sql)) $stage[] = $row->stag;
        $anzst = count($stage);
        $aktstag = @db_result(db_query("SELECT stag FROM `prefix_liga_matches_css` WHERE points1 IS NOT NULL ORDER BY stag DESC LIMIT 1"),0);
        $aktstag = (is_numeric($aktstag)?$aktstag:1);
        if ($anzst == 0) {
        echo '<br /><center><h2>Es wurden noch keine Spiele eingetragen</h2></center><br />';
        break;
        }
        if ($menu->get(2) == 'alle') $stag = 'alle';
        else $stag = ($menu->getA(2) == 's' ? $menu->getE(2) : $aktstag);
        echo "<center><h2>Spieltag: $stag</h2></center>";
        ?>
        <br />
        <div align="center">
        <table width="99%" border="0" cellspacing="1" cellpadding="4" style="border-collapse: collapse" bordercolor="#FFFFFF">
        <tr class="Chead" height="30" valign="middle">
          <td width="25"><b><font size="1" face="Verdana" color="#FFFFFF">ST</font></b></td>
          <td width="75"><b><font size="1" face="Verdana" color="#FFFFFF">Datum</font></b></td>
        	<td width="175"><b><font size="1" face="Verdana" color="#FFFFFF">Spieler A</font></b></td>
          <td width="175"><b><font size="1" face="Verdana" color="#FFFFFF">Spieler B</font></b></td>
          <td width="75"><b><font size="1" face="Verdana" color="#FFFFFF">Ergebnis</font></b></td>
        <?php
        $sql = db_query("SELECT a.id,a.tid1,a.tid2,a.stag,a.points1,a.points2,DATE_FORMAT(a.datum,'%d.%m.%Y') as datum,b.name as team1,c.name as team2
             FROM `prefix_liga_matches_css` a 
             LEFT JOIN `prefix_user` b ON a.tid1 = b.id
             LEFT JOIN `prefix_user` c ON a.tid2 = c.id
             ".($stag == 'alle'? '':"WHERE a.stag = $stag ")."
             ORDER BY stag, datum DESC");
        while ($ds = db_fetch_object($sql)) 
        {
          echo "<tr class=\"Cnorm\"><td align=\"center\">$ds->stag</td><td>$ds->datum</td><td><a href=\"index.php?user-details-$ds->tid1\">$ds->team1</a></td><td><a href=\"index.php?user-details-$ds->tid2\">$ds->team2</a></td><td align=\"center\">$ds->points1 : $ds->points2</td></tr>";  
        }
        echo '</table></div><br /><center>[<a href="?liga_css-showmatches-alle">alle</a>|';
        foreach ($stage as $key => $st) echo '<a href="?liga_css-showmatches-s'.$st.'">'.$st.'</a>'.($key+1 == $anzst ? '':'|');    
        echo ']</center>';    
      break;
      
      case 'table':
      ?>
        <center><br />
    	<table width="99%" border="0" cellspacing="1" cellpadding="4" style="border-collapse: collapse">
        <tr class="Chead" height="30" valign="middle"> 
          <td width="25"><b><font size="1" face="Verdana" color="#FFFFFF">Plz</font></b></td>
          <td width="280"><b><font face="Verdana" size="1" color="#FFFFFF">Spielername</font></b></td>
          <td width="30"><b><font size="1" face="Verdana" color="#FFFFFF">Sp.</font></b></td>
          <td align="center" width="30"><b>
    		<font size="1" face="Verdana" color="#FFFFFF">S</font></b></td>
          <td align="center" width="30"><b>
    		<font size="1" face="Verdana" color="#FFFFFF">U</font></b></td>
          <td align="center" width="30"><b>
    		<font size="1" face="Verdana" color="#FFFFFF">N</font></b></td>
          <td align="center" width="75"><b>
    		<font size="1" face="Verdana" color="#FFFFFF">Runden</font></b></td>
          <td width="30"><b><font size="1" face="Verdana" color="#FFFFFF">Pkt</font></b></td>
        <?
        $count = db_result(db_query("SELECT COUNT(*) FROM `prefix_liga_teams_css`"),0);
        $sql = db_query("SELECT a.id,a.points,a.opoints,a.s,a.u,a.n,(a.s*3+a.u) as punkte,b.name FROM `prefix_liga_teams_css` a
         LEFT JOIN `prefix_user` b ON a.id = b.id
         ORDER BY punkte DESC, (points-opoints) DESC, points DESC");
        while ($ds = db_fetch_object($sql)) 
        {
          $rank ++;
          if ($rank == 1) $bg = 'bgcolor="green"';
          elseif ($rank > $count - 3) $bg = 'bgcolor="red"';
          else $bg = '';
          echo "<tr $bg align=\"center\"$color><td><b>$rank</b></td><td align=\"left\"><b><a href=\"index.php?user-details-$ds->id\">$ds->name</a></b></td><td>".($ds->s+$ds->u+$ds->n)."</td><td>$ds->s</td><td>$ds->u</td><td>$ds->n</td><td>$ds->points : $ds->opoints</td><td><b>$ds->punkte</b></td></tr>\n";
        }
        echo '</table></center>'; 
      break;
    }
    $design->footer();
    ?>


    betroffene Homepage: externer Link
    0 Mitglieder finden den Beitrag gut.
  2. #2
    User Pic
    Mairu Coder
    Registriert seit
    16.06.2006
    Beiträge
    15.334
    Beitragswertungen
    386 Beitragspunkte
    Du darfst die Dateien nicht liga_css.php nennen, da ilch den Unterstrich löscht, also nenn sie nur ligacss, also nur die Dateien, die Datenbanken kannst du so lassen.
    Und auch immer mal ein Blick auf die FAQ werfen. | Mairus Ilchseite
    0 Mitglieder finden den Beitrag gut.
  3. #3
    User Pic
    Excalibu Mitglied
    Registriert seit
    16.03.2007
    Beiträge
    114
    Beitragswertungen
    0 Beitragspunkte
    thx
    0 Mitglieder finden den Beitrag gut.
Geschlossen

Zurück zu Module und Modifikationen

Optionen: Bei einer Antwort zu diesem Thema eine eMail erhalten