Hallo Ilch Gemeinschaft,
Ich wollte ein Kleines Tippspiel unter Freunden für die Fußball WM mit diesem Modul organisieren was auch gut bis jetzt geklappt hat. Hab es Installiert und die Fehler behoben die hier beschrieben worden sind, wobei ich sagen muss das jetzt zwar man auf die nächste Seite kommt ohne Fehlermeldung aber dafür funktioniert jetzt das anwählen von einzelnen Spieltagen nicht mehr was nicht so schlimm ist und auch nicht der Grund ist weshalb ich hier schreibe.
Ich habe Festgestellt das wenn ein Spiel z.B. um 13:30 Uhr Startet dann kann ich ja kein Tipp ab 13:30 Uhr mehr abgeben. So jetzt kommts wenn ich das Spiel öffne zum tippen und
offen lasse bis Spielende sind die Felder wo man das Ergebnis Tippen soll immer noch beschreibbar und wenn ich dann mein Tipp schreibe (Ergebnis da ja das Spiel vorbei ist
) und dann auf Tippen drücke wird es akzeptiert
.
Der ersteller des Moduls schreibt selber:
Zitat geschrieben von
DaStIaC
naja das ding is käse, hab aber noch ne fast fertige bessere version, nur wie gesagt nie fertig gemacht.
vielleicht lad ich die mal so wie sie ist hoch
Kann man das Teil noch irgendwie retten vor beginn der WM. Ich dachte mal so eine Art Prüfung ob die Uhrzeit und das Datum noch stimmen wenn man auf Tippen drückt. Kenne mich mit PHP nicht aus wehre aber sehr dankbar wenn einer hier mal eine Lösung Posten könnte.
PS.:
hier noch die include/contents/matches.php
<?php
# Copyright by: Tobias Schwarz
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
$title = $allgAr['title'].' :: Tipp abgeben';
$hmenu = 'Tippen';
$design = new design ( $title , $hmenu );
$design->addheader('<script language="javascript" type="text/javascript">
<!--
var win=null;
onerror = stopError;
function stopError(){
return true;
}
function I1213894128(id, match){
myleft=20;
mytop=20;
settings="width=200,height=200,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
win=window.open("?matches-delete-" + id + "-" + match,"Delete",settings);
win.focus();
}
// -->
</script>
');
$design->header();
if($menu->get(1) == "tipp") {
$nav1 = "Cnorm";
} else {
$nav1 = "Chead";
}
if($menu->get(1) == "ligaID" OR $menu->get(1) == "") {
$nav2 = "Cnorm";
} else {
$nav2 = "Chead";
}
if($menu->get(1) == "statistic") {
$nav3 = "Cnorm";
} else {
$nav3 = "Chead";
}
?>
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<table width="100%" cellpadding="1" cellspacing="1" border="0" class="border">
<tr>
<td width="33%" class="<?php echo $nav2; ?>"><a href="index.php?matches-ligaID">Übersicht</a></td>
<td width="33%" class="<?php echo $nav1; ?>">Tippen</td>
<td width="33%" class="<?php echo $nav3; ?>"><a href="index.php?matches-statistic">Statistik</td>
</tr>
</table>
<?php
if($menu->get(1) == "tipp") {
if(loggedin()) {
$matchID = $menu->get(2);
$ligaID = $menu->get(3);
$select = "SELECT * FROM prefix_matches WHERE matchID = $matchID";
$ergebnis = db_query($select);
$match = db_fetch_assoc($ergebnis);
$score1 = $match['score1'];
$score2 = $match['score2'];
$select_i="SELECT * FROM prefix_tipps WHERE userID = $_SESSION[authid] AND matchID = $matchID";
$erg_i=@db_query($select_i);
$tipps = db_fetch_assoc($erg_i);
$now = time();
if($match['timestamp'] > $now) {
$tippen1 = '<input style="background: #edeeee; height: 17px; border: 1px solid #999999;" type="text" name="score1" size="2" maxlength="2" value="'.$tipps['score1'].'">';
$tippen2 = '<input style="background: #edeeee; height: 17px; border: 1px solid #999999;" type="text" name="score2" size="2" maxlength="2" value="'.$tipps['score2'].'">';
$tippen3 = "Kein Tipp abgegeben";
} else {
$tippen1 = $tipps['score1'];
$tippen2 = $tipps['score2'];
$tippen3 = '';
}
if($match['status'] == 1) {
$matchstatus = "Status: closed";
$tipp_team1 = $tipps['score1'];
$tipp_team2 = $tipps['score2'];
$button = "";
} else {
$matchstatus = "Status: open";
$tipp_team1 = $tippen1;
$tipp_team2 = $tippen2;
$button = '<input style="background: #edeeee; height: 20px; border: 1px solid #999999;" type="submit" name="change" value="Tippen" />';
}
if($match['timestamp'] < $now) {
$button = "";
}
if($tipps['pointsgot'] == 1) {
$punkte4 = "Punkt";
} else {
$punkte4 = "Punkte";
}
$punkte2 = db_query("SELECT pointsgot FROM prefix_tipps WHERE matchID = $matchID");
while($punkte3 = db_fetch_assoc($punkte2)) {
$punkte_ges = $punkte_ges + $punkte3['pointsgot'];
}
$stats = db_result(db_query("SELECT count(tippID) FROM prefix_tipps WHERE matchID = $matchID"),0);
$goals = db_query("SELECT score1, score2 FROM prefix_tipps WHERE matchID = $matchID");
while($tore = db_fetch_assoc($goals)) {
$goal = $goal + $tore['score1'] + $tore['score2'];
}
if($stats != 0) {
$durchschnittlichetore = $goal / $stats;
}
if($match['text'] == "") {
$text = "Keine Bemerkungen";
} else {
$text = bbcode($match['text']);
}
$tipsabg = db_result(db_query("SELECT count(tippID) FROM prefix_tipps WHERE matchID = $matchID AND userID = $_SESSION[authid]"),0);
if($tipsabg == 1) {
$tipp_score1 = $tipp_team1;
$tipp_score2 = $tipp_team2;
$status2 = 'Du hast <font color="#00FF00">+'.$tipps['pointsgot'].'</font> '.$punkte4.' bekommen';
} elseif($tippsabg == 0 AND $match['status'] == 1 AND $match['timestamp'] < $now) {
$tipp_score1 = '-';
$tipp_score2 = '-';
$status2 = 'Kein Tipp abgegeben!';
} else {
$tipp_score1 = $tippen1;
$tipp_score2 = $tippen2;
}
$liga = "SELECT * FROM prefix_ligen WHERE ligaID = $match[liga]";
$ligaque= db_query($liga);
$ligarow=db_fetch_assoc($ligaque);
$match['liganame'] = $ligarow['ligaNAME'];
$game = "SELECT * FROM prefix_games WHERE gameID = $match[liga]";
$gameque=db_query($game);
$gamerow=db_fetch_assoc($gameque);
$match['gamename'] = $gamerow['name'];
if(empty($gamerow['url']))
{
$match['gameicon'] = "";
} else {
$match['gameicon'] = '<img src="'.$gamerow['url'].'" border="0" alt="'.$gamerow['name'].'" />';
}
?>
<form name="result" method="post" action="?matches-savetipp-<?php echo $matchID.'-'.$ligaID; ?>">
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td width="100%" colspan="2" class="Chead">Begegnung</td>
</tr>
<tr>
<td width="100%" colspan="2"> </td>
</tr>
<tr>
<td width="60%" class="Cnorm" align="center"><b>Teams & Ergebnis</b></td>
<td width="40%" class="Cnorm" align="center"><b>Daten</b></td>
</tr>
<tr>
<td width="60%" class="Cmite" valign="top">
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td width="100%" colspan="3" class="Chead"><?php echo $match['gameicon'].' '.$match['gamename']; ?></td>
</tr>
<tr>
<td width="45%" class="Cnorm" style="font-size: 15px;">
<?php echo '<img src="include/images/flags/'.$match['land1'].'" /> '.$match['team1']; ?>
</td>
<td width="10%" class="Cmite" style="font-size: 15px;" align="center"><b>vs.</b></td>
<td width="45%" class="Cnorm" style="font-size: 15px;">
<?php echo '<img src="include/images/flags/'.$match['land2'].'" /> '.$match['team2']; ?>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td width="100%" colspan="3" align="center" class="Cnorm"><b>Ergebnis</b></td>
</tr>
<tr>
<td width="100%" colspan="3" align="center" valign="top">
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td width="40%"> </td>
<td width="5%" style="background-color: #ffffff;"><?php echo $match['score1']; ?></td>
<td width="10%" class="Cmite" style="font-size: 15px;" align="center"><b>:</b></td>
<td width="5%" style="background-color: #ffffff;"><?php echo $match['score2']; ?></td>
<td width="40%"> </td>
</tr>
</table>
<tr>
<td> </td>
</tr>
<tr>
<td width="100%" colspan="3" align="center" class="Cnorm"><b>Tipp</b></td>
</tr>
<tr>
<td width="100%" colspan="3" align="center" valign="top">
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td width="40%"> </td>
<td width="5%" style="background-color: #ffffff;"><?php echo $tipp_score1; ?></td>
<td width="10%" class="Cmite" style="font-size: 15px;" align="center"><b>:</b></td>
<td width="5%" style="background-color: #ffffff;"><?php echo $tipp_score2; ?></td>
<td width="40%"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php
if($match['status'] == 1) {
?>
<tr>
<td width="100%" align="center" colspan="3"><i> <?php echo $status2; ?> </i></td>
</tr>
<?php
}
?>
</table>
</td>
<td width="40%" class="Cmite" valign="top">
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td width="100%" align="center" colspan="2" class="Cmite" style="font-size: 18px;"><?php echo $matchstatus; ?></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2" class="Cmite" style="font-size: 18px;"> </td>
</tr>
<tr>
<td width="33%" class="Cmite">Match ID:</td>
<td width="67%" style="background-color: #ffffff; padding-left: 10px;"><?php echo $matchID; ?></td>
</tr>
<tr>
<td width="33%" class="Cmite">Datum:</td>
<td width="67%" style="background-color: #ffffff; padding-left: 10px;"><?php echo $match['datum']; ?></td>
</tr>
<tr>
<td width="33%" class="Cmite">Spiel:</td>
<td width="67%" style="background-color: #ffffff; padding-left: 10px;"><?php echo $match['gamename']; ?></td>
</tr>
<tr>
<td width="33%" class="Cmite">Liga:</td>
<td width="67%" style="background-color: #ffffff; padding-left: 10px;"><?php echo $match['liganame']; ?></td>
</tr>
<tr>
<td width="33%" class="Cmite">Ort:</td>
<td width="67%" style="background-color: #ffffff; padding-left: 10px;"><?php echo $match['ort']; ?></td>
</tr>
<?php
if($match['status'] == 1) {
?>
<tr>
<td width="33%" class="Cmite">Tipps:</td>
<td width="67%" style="background-color: #ffffff; padding-left: 10px;"><?php echo $stats; ?></td>
</tr>
<tr>
<td width="33%" class="Cmite">Punkte:</td>
<td width="67%" style="background-color: #ffffff; padding-left: 10px;"><?php echo $punkte_ges; ?></td>
</tr>
<tr>
<td width="33%" class="Cmite">Tore/Tipp:</td>
<td width="67%" style="background-color: #ffffff; padding-left: 10px;"><?php echo $durchschnittlichetore; ?></td>
</tr>
<?php
}
?>
<tr>
<td width="100%" align="center" colspan="2" class="Cmite" style="font-size: 18px;"> </td>
</tr>
</table>
</td>
</tr>
<?php
if($match['text'] != "") {
?>
<tr>
<td width="100%" colspan="3" class="Cnorm" align="center">Bemerkungen</td>
</tr>
<tr>
<td width="100%" colspan="3" class="Cmite" align="left"><?php echo $text; ?></td>
</tr>
<?php
}
?>
<tr>
<td width="100%" colspan="3" class="Chead" align="center"><?php echo $button; ?></td>
</tr>
</table>
</form>
<?php
if($match['koms'] == 1) {
?>
<form name="kommentar" method="POST" action="?matches-tipp-<?php echo $match['matchID'].'-'.$ligaID; ?>">
<fieldset>
<legend>Kommentar verfassen</legend>
<textarea style="width: 98%; border: 1px solid #999999;" cols="50" rows="2" name="kom_txt"></textarea><br />
<input style="border: 1px solid #999999;" type="submit" value="Abschicken" name="kom_submit"><br />
</fieldset>
</form>
<?php
if(isset($_POST['kom_submit'])) {
$name = db_fetch_assoc(db_query("SELECT * FROM prefix_user WHERE id = $_SESSION[authid]"));
$text = bbcode($_POST['kom_txt']);
db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (".$match['matchID'].",'TIPPS','".$name['name']."','".$text."')");
}
$koms = "SELECT * FROM prefix_koms WHERE cat = 'TIPPS' AND uid = $match[matchID] ORDER BY id DESC";
$komerg = db_query($koms);
$count = db_result(db_query("SELECT count(id) FROM prefix_koms WHERE cat = 'TIPPS' AND uid = $matchID"),0);;
while ($coms = db_fetch_assoc($komerg)) {
?>
<table width="100%" cellspacing="1" cellpadding="1" border="0">
<tr>
<td width="100%" class="Cmite"><?php
$url = '?matches-delete-'.$coms['id'].'-'.$match['matchID'];
echo '#'.$count.' '.$coms['name'].' ';
if(has_right(-7)) {?>
<a href="javascript:I1213894128('<?php echo $coms['id']; ?>','<?php echo $match['matchID']; ?>');"><img src="include/images/icons/del.gif" border="0" /></a></td>
<?php
}
?>
</tr>
<tr>
<td width="100%" class="Cnorm"> <?php echo $coms['text']; ?></td>
</tr>
</table>
<br />
<?php
$count--;
}
} else {
echo '<b>Kommentare gesperrt!</b><br />';
}
} else {
echo 'Du musst angemeldet sein, um am Tippspiel teilnehmen zu können!';
}
} elseif($menu->get(1) == "delete" AND has_right(-7)) {
db_query("DELETE FROM prefix_koms WHERE uid = ".$menu->get(3)." AND cat = 'TIPPS' AND id = ".$menu->get(2));
} elseif($menu->get(1) == "savetipp") {
if(loggedin()) {
$tippscore1=$_POST['score1'];
$tippscore2=$_POST['score2'];
$matchID = $menu->get(2);
$ligaID = $menu->get(3);
$getippt = db_result(db_query("SELECT count(tippID) FROM prefix_tipps WHERE matchID = $matchID AND userID = $_SESSION[authid]"),0);
if($getippt == 0) {
$abf = "INSERT INTO prefix_tipps (matchID, userID, score1, score2) VALUES ('$matchID', '$_SESSION[authid]', '$tippscore1', '$tippscore2')";
$erg = db_query($abf);
wd('?matches-ligaID-'.$ligaID.'', "Tipp gespeichert!", 1);
} else {
$abf2= "SELECT tipps FROM prefix_tipps WHERE matchID = $matchID AND userID = $_SESSION[authid]";
$erg2= db_query($abf2);
$tipps=db_fetch_assoc($erg2);
$anztipps = $tipps['tipps'] + 1;
$abf = "UPDATE prefix_tipps Set score1 = $tippscore1, score2 = $tippscore2, tipps = $anztipps WHERE matchID = $matchID AND userID = $_SESSION[authid]";
$erg = db_query($abf);
wd("?matches-ligaID-$ligaID", "Tipp geändert!", 1);
}
}
} elseif($menu->get(1) == "statistic")
{
$tipps_total = @db_result(db_query("SELECT count(tippID) FROM prefix_tipps"));
$players_without_points = @db_result(db_query("SELECT count(points) FROM prefix_user WHERE points = 0"));
$players_with_points = @db_result(db_query("SELECT count(points) FROM prefix_user WHERE points > 0"));
?>
<br />
<table width="100%" cellspacing="1" cellpadding="1" border="0" class="border">
<tr>
<td width="100%" class="Chead" colspan="2">Tippspiel-Statistiken</td>
</tr>
<tr>
<td width="40%" class="Cdark">Abgegebene Tipps:</td>
<td width="60%" class="Cnorm"><?php echo $tipps_total; ?></td>
</tr>
<tr>
<td width="40%" class="Cdark">Spieler ohne Punkte:</td>
<td width="60%" class="Cnorm"><?php echo $players_without_points; ?></td>
</tr>
<tr>
<td width="40%" class="Cdark">Spieler mit Punkten:</td>
<td width="60%" class="Cnorm"><?php echo $players_with_points; ?></td>
</tr>
<tr>
<td width="40%" class="Cdark">Array</td>
<td width="60%" class="Cnorm"><?php //echo $tipps_total; ?>to be continued...</td>
</tr>
</table>
<?php
} else {
?>
<br />
<div width="50%">
<span>Liga:</span>
<form name="form1">
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<option value="index.php?matches-ligaID-all">Alle anzeigen</option>
<p>
<?php
$ligen = "SELECT * FROM prefix_ligen";
$ligenins = db_query($ligen);
while($row=db_fetch_assoc($ligenins)) {
if($menu->get(2) == $row['ligaID']) {
$selected = "selected";
} else {
$selected = "";
}
echo '<option value="index.php?matches-ligaID-'.$row['ligaID'].'" '.$selected.'>'.$row['ligaNAME'].'</option>';
}
?>
</p>
</select>
</form>
<?php
if($menu->get(2) != "") {
?>
<br />
<span>Spieltag:</span>
<form name="form2">
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<p>
<?php
$ligaid = $menu->get(2);
?>
<option value="index.php?matches-ligaID-<?php echo $ligaid; ?>-all">Alle anzeigen</option>
<?php
$ligen = "SELECT * FROM prefix_tipp_spieltage WHERE ligaID = $ligaid";
$ligenins = db_query($ligen);
while($row=db_fetch_assoc($ligenins)) {
if($menu->get(3) == $row['dayID']) {
$selected = "selected";
} else {
$selected = "";
}
echo '<option value="index.php?matches-ligaID-'.$ligaid.'-'.$row['dayID'].'" '.$selected.'>'.$row['name'].'</option>';
}
?>
</p>
</select>
</form>
<?php
}
?>
</div>
<br />
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr class="Cnorm">
<td width="20%" align="center">Datum</td>
<td width="20%" align="center">Heimmannschaft</td>
<td width="20%" align="center">Gastmannschaft</td>
<td width="5%" align="center">Ergebnis</td>
<td width="10%" align="center">Getippt?</td>
<td width="8%" align="center">Status</td>
<td width="10%" align="center">Punkte</td>
<td width="7%" align="center"> </td>
</tr>
<?php
$ligenid = escape($menu->get(2), "integer");
if($ligenid == "") {
$ligenid = 1;
}
$ligenid = $menu->get(2);
$dayid = $dayid;
if(empty($ligenid) OR $ligenid == "all")
{
$part1 = '';
}
else
{
$part1 = 'liga = '.$ligenid.'';
}
if(empty($dayid) OR $dayid == "all")
{
$part2 = '';
}
else
{
$part2 = 'spieltag = '.$dayid.'';
}
if((empty($ligenid) OR $ligenid == "all") AND empty($dayid))
{
$and = "";
$where = "";
} elseif(!empty($ligenid) AND empty($dayid))
{
$and = "";
$where="WHERE";
} elseif(!empty($ligenid) AND !empty($dayid))
{
$and = "AND";
$where="WHERE";
}
$fullwhere = $where.' '.$part1.' '.$and.' '.$part2;
$limit = 20; // Limit
$page = ($menu->getA(3) == 'p' ? $menu->getE(3) : 1 );
$MPL = @db_make_sites ($page , "$fullwhere" , $limit , '?matches-ligaID-'.$ligenid.'' , 'matches' );
$anfang = ($page - 1) * $limit;
$select = "SELECT * FROM prefix_matches $fullwhere ORDER BY timestamp LIMIT $anfang, $limit";
$ergebnis = @db_query($select);
while($row=db_fetch_assoc($ergebnis)) {
$score1 = $row['score1'];
$score2 = $row['score2'];
$tipp = "SELECT * FROM prefix_tipps WHERE userID = $_SESSION[authid] AND matchID = $row[matchID]";
$tipperg=db_query($tipp);
$mytipp = db_fetch_assoc($tipperg);
if($mytipp['score1'] == "" AND $mytipp['score2'] == "") {
$tippscore1 = '<img src="include/images/icons/no.png" />';
} else {
$tippscore1 = '<img src="include/images/icons/yes.png" />';
}
$now = time();
if($row['timestamp'] < $now OR $row['status'] == 1) {
$tippen = '<a href="?matches-stats-'.$row['matchID'].'">Statistik</a> <br />';
} else {
$tippen = '<a href="?matches-tipp-'.$row['matchID'].'-'.$ligenid.'">Tippen</a> <br />';
}
if($row['status'] == 1) {
$status = '<img src="include/images/icons/closed.png" />';
} else {
$status = '<img src="include/images/icons/open.png" />';
}
$pts = db_query("SELECT pointsgot FROM prefix_tipps WHERE userID = $_SESSION[authid] AND matchID = $row[matchID]");
$pkts = db_fetch_assoc($pts);
if($pkts['pointsgot'] == "" OR $pkts['pointsgot'] == 0 AND $row['status'] == 0) {
$pkts['pointsgot'] = "0*";
} elseif($row['status'] == "1" AND $pkts['pointsgot'] == 0) {
$pkts['pointsgot'] = $pkts['pointsgot'];
} elseif($row['status'] == "1") {
$pkts['pointsgot'] = $pkts['pointsgot'];
}
$fav1 = db_result(db_query("SELECT count(tippID) FROM prefix_tipps WHERE matchID = $row[matchID] AND score1 > score2"),0);
$fav2 = db_result(db_query("SELECT count(tippID) FROM prefix_tipps WHERE matchID = $row[matchID] AND score1 < score2"),0);
if($fav1 > $fav2) {
$row['team1'] = '<strong>'.$row['team1'].'</strong>';
} elseif($fav1 < $fav2) {
$row['team2'] = '<strong>'.$row['team2'].'</strong>';
}
?>
<tr>
<td width="20%" class="Cmite" align="center"><?php echo $row['datum']; ?></td>
<td width="20%" class="Cmite" align="left"><?php echo '<img src="include/images/flags/'.$row['land1'].'" /> '.$row['team1']; ?></td>
<td width="20%" class="Cmite" align="left"><?php echo '<img src="include/images/flags/'.$row['land2'].'" /> '.$row['team2']; ?></td>
<td width="5%" class="Cnorm" align="center"><?php echo ''.$score1.':'.$score2.''; ?>
<td width="10%" class="Cmite" align="center"><?php echo $tippscore1; ?></td>
<td width="8%" class="Cmite" align="center"><?php echo $status; ?></td>
<td width="10%" class="Cmite" align="center"><?php echo $pkts['pointsgot']; ?></td>
<td width="7%" class="Cmite" align="center"><a href="?matches-tipp-<?php echo $row['matchID'].'-'.$ligenid; ?>">mehr</a></td>
</tr>
<?php
}
?>
<tr>
<td width="100%" colspan="8" class="Chead" align="center"><?php echo $MPL; ?></td>
</tr>
</table>
* Entweder kein Tipp abgegeben oder Spiel noch nicht abgeschlossen!<br />
<b>Dick</b> gedruckt sind die jeweiligen Favoriten!
<?php
}
$design->footer();
?>
Vielen dank wor
Zuletzt modifiziert von wor am 30.05.2010 - 22:09:34