Verfasst: 31.08.2005 13:43
und noch eine Frage: gehen die bereits getippten und ausgewerteten Ergebnisse bei dem Datenbankupdate verloren?
phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
Nein habe ich nicht explizit, da man sowieso die statischen tpl-Files lesen kann, soweit man den Namen des Templates kennt. Das klappt bei jedem Board. Damit das Layout, wie auf meiner Seite, gut mit dem MOD zusammenpasst waren noch ein paar Kürzungen an der lang_tippspiel.php nötig, wobei der Sinn natürlich erhalten blieb. Manchmal kommt es eben zu mehreren Zeilenumbrüchen innerhalb einer Tabellenzelle, was das ganze dann vertikal aufbläst.Budman hat geschrieben:@plACEbo
Danke, jetzt hab ich's kapiert, Du hast die files freigegeben. Danke!
Code: Alles auswählen
Parse error: parse error, unexpected $ in /usr/export/www/vhosts/funnetwork/hosting/dsmagic1/admin/processspieltagergebnisse.php on line 964
Code: Alles auswählen
<?php
/***************************************************************************
* processspieltagergebnisse.php
* -------------------
* begin : Monday, Mai 02, 2005
* copyright : (C) 2005 shop.werkanndennnochfahren mods
* email : lechon@arcor.de
*
* $Id: mod_tippspiel,v 1.0.0 BETA 2005/05/02 17:00:00 Eric Mispelbaum Exp $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path.'language/lang_' . $board_config['default_lang'] . '/lang_tippspiel.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
include($phpbb_root_path . 'admin/page_header_admin.'.$phpEx);
$Heimtore = $_POST["Heimtore"];
$Auswartstore = $_POST["Auswartstore"];
$Spielid = $_POST["spielid"];
$Heim = $_POST["heim"];
$Auswarts = $_POST["auswarts"];
$Tabelle = $_POST["tabelle"];
$mode = $_POST["mode"];
$ausgefallen = $_POST["ausgefallen"];
$sonntag = $_POST["sonntag"];
if ($Spielid[0] > 1000){
$Spieltag = substr($Spielid[0],0,2);}else{
$Spieltag = substr($Spielid[0],0,1);}
$Spieltaganfang = $Spieltag * '100';
$Spieltagende = $Spieltaganfang + '100';
////////////////////////////////
if ($mode == 'tabellesonntag'){
for ($i = 0; $i < count($Spielid); $i++){
$heimgew = '0';$heimpunkte = '0';$ausverl = '0';$heimunent = '0';$ausunent = '0';$auspunkte = '0';$heimverl = '0';$ausgew = '0';
if ($Heimtore[$i] > $Auswartstore[$i]){
$heimgew = '1';$heimpunkte = '3';$ausverl = '1';}
if ($Heimtore[$i] == $Auswartstore[$i]){
$heimunent = '1';$ausunent = '1';$heimpunkte = '1';$auspunkte = '1';}
if ($Heimtore[$i] < $Auswartstore[$i]){
$heimverl = '1';$auspunkte = '3';$ausgew = '1';}
$sql = "UPDATE tippspiel_tabelle SET gewonnen = gewonnen + '$heimgew', unentschieden = unentschieden + '$heimunent', verloren = verloren + '$heimverl', punkte = punkte + '$heimpunkte', spiele = spiele + '1', tore = tore + '$Heimtore[$i]', gegentore = gegentore + '$Auswartstore[$i]', diff = tore - gegentore WHERE name = '$Heim[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE tippspiel_tabelle SET gewonnen = gewonnen + '$ausgew', unentschieden = unentschieden + '$ausunent', verloren = verloren + '$ausverl', punkte = punkte + '$auspunkte', spiele = spiele + '1', tore = tore + '$Auswartstore[$i]', gegentore = gegentore + '$Heimtore[$i]', diff = tore - gegentore WHERE name = '$Auswarts[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE tippspiel_spieltage SET tabelle = '1' WHERE spielid = '$Spielid[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$useridtipp = array();
$heimtipp = array();
$austipp = array();
$sql = "SELECT userid, heimtipp, auswartstipp FROM tippspiel_usertips WHERE spielid = '$Spielid[$i]' ORDER BY userid ASC";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$useridtipp[] = $row['userid'];
$heimtipp[] = $row['heimtipp'];
$austipp[] = $row['auswartstipp'];
}
for ($t = 0; $t < count($useridtipp);$t++){
$punkte = 0;
if (($heimtipp[$t] == '') && ($austipp[$t] == '')){
$sql = "UPDATE tippspiel_usertips SET bewertet = NULL , tabelle = 1 WHERE spielid = '$Spielid[$i]' AND userid = '$useridtipp[$t]'";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
if (($Heimtore[$i] == $heimtipp[$t]) && ($Auswartstore[$i] == $austipp[$t])){
$punkte = $board_config['tipp_trefferpkt'];}else{
if (($Heimtore[$i] > $Auswartstore[$i]) && ($heimtipp[$t] > $austipp[$t])){
$punkte = $board_config['tipp_tendenzpkt'];
$diff = $Heimtore[$i] - $Auswartstore[$i];$difftipp = $heimtipp[$t] - $austipp[$t];
if ( $diff == $difftipp){
$punkte = $punkte + $board_config['tipp_differenzpkt'];}
}
if (($Heimtore[$i] < $Auswartstore[$i]) && ($heimtipp[$t] < $austipp[$t])){
$punkte = $board_config['tipp_tendenzpkt'];
$diff = $Auswartstore[$i] - $Heimtore[$i];$difftipp = $austipp[$t] - $heimtipp[$t];
if ( $diff == $difftipp){
$punkte = $punkte + $board_config['tipp_differenzpkt'];}
}
if (($Heimtore[$i] == $Auswartstore[$i]) && ($heimtipp[$t] == $austipp[$t])){
$punkte = $board_config['tipp_unentschpkt'];
if ($Heimtore[$i] > $heimtipp[$t]){
$undiff = $Heimtore[$i] - $heimtipp[$t];}else{ $undiff = $heimtipp[$t] - $Heimtore[$i];}
if ($undiff < 2){ $punkte = $punkte + $board_config['tipp_unentschpktextra'];}
}
}
$sql = "UPDATE tippspiel_usertips SET bewertet = '$punkte', tabelle = 1 WHERE spielid = '$Spielid[$i]' AND userid = '$useridtipp[$t]'";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}
if( $punkte == $board_config['tipp_trefferpkt']){$treffer= 1;}else{$treffer= 0;}
$sql = "UPDATE ". USERS_TABLE ." SET tipp_punkte = tipp_punkte + '$punkte', tipp_getippt = tipp_getippt + 1, tipp_treffer = tipp_treffer + '$treffer' WHERE user_id = '$useridtipp[$t]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT userid FROM tippspiel_user_spieltage WHERE spieltag = '$Spieltag' AND userid = '$useridtipp[$t]' ";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$closecheck = $row['userid'];
}
if ($closecheck != $useridtipp[$t]){
$sql = "INSERT INTO tippspiel_user_spieltage (userid, spieltag, punkte, treffer) VALUES('".$useridtipp[$t]."', '$Spieltag', '$punkte', '$treffer')";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
$sql = "UPDATE tippspiel_user_spieltage SET punkte = punkte + '$punkte', treffer = treffer + '$treffer' WHERE userid = '$useridtipp[$t]' AND spieltag = '$Spieltag' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}
$treffer= 0;
}}
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 0 WHERE spieltag = '$Spieltag' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$usersieg = array();
$usertotalpoints = array();
$usertreffer = array();
$sql = "SELECT userid, punkte, treffer FROM tippspiel_user_spieltage WHERE spieltag = '$Spieltag' ORDER BY punkte DESC, treffer DESC ";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$usersieg[] = $row['userid'];
$usertotalpoints[] = $row['punkte'];
$usertreffer[] = $row['treffer'];
}
if ($usertotalpoints[0] != $usertotalpoints[1]){
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[0]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
if ($usertreffer[0] != $usertreffer[1]){
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[0]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
$t=1;
for ( $u = 0; $u < count($usersieg);$u++){
if ($usertotalpoints[$u] == $usertotalpoints[$t]){
if ($usertreffer[$u] == $usertreffer[$t]){
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[$u]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[$t]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}
if ($usertotalpoints[$u] != $usertotalpoints[$t]){break;}
if ($usertreffer[$u] != $usertreffer[$t]){break;}
$t++;
}
}
?>
<br>
<table width="95%" height="40" cellpadding="2" cellspacing="1" border="0" class="forumline" align="center" valign="center">
<tr><td class="row1" align="center"><span class="gensmall">
<? echo $lang['tipp_admin_sonntagclosed_success']; ?><br>
</span></td></tr></table>
<?
}
////////////////////////
if ($mode == 'sonntagergebnisse'){
for ($i = 0; $i < count($Spielid); $i++){
if ($Heimtore[$i] != ''){
if ($Auswartstore[$i] != ''){
$sql = "UPDATE tippspiel_spieltage SET heimtore = '$Heimtore[$i]', auswartstore = '$Auswartstore[$i]' WHERE spielid = '$Spielid[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}
if ($Heimtore[$i] == ''){
if ($Auswartstore[$i] == ''){
$sql = "UPDATE tippspiel_spieltage SET heimtore = NULL, auswartstore = NULL WHERE spielid = '$Spielid[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}
}
?>
<br>
<table width="95%" height="40" cellpadding="2" cellspacing="1" border="0" class="forumline" align="center" valign="center">
<tr><td class="row1" align="center"><span class="gensmall">
<? echo $lang['tipp_admin_result_success']; ?><br>
</span></td></tr></table>
<?
}
if ($mode == 'tabellenachhol'){
$heimgew = '0';$heimpunkte = '0';$ausverl = '0';$heimunent = '0';$ausunent = '0';$auspunkte = '0';$heimverl = '0';$ausgew = '0';
if ($Heimtore > $Auswartstore){
$heimgew = '1';$heimpunkte = '3';$ausverl = '1';}
if ($Heimtore == $Auswartstore){
$heimunent = '1';$ausunent = '1';$heimpunkte = '1';$auspunkte = '1';}
if ($Heimtore < $Auswartstore){
$heimverl = '1';$auspunkte = '3';$ausgew = '1';}
$sql = "UPDATE tippspiel_tabelle SET gewonnen = gewonnen + '$heimgew', unentschieden = unentschieden + '$heimunent', verloren = verloren + '$heimverl', punkte = punkte + '$heimpunkte', spiele = spiele + '1', tore = tore + '$Heimtore', gegentore = gegentore + '$Auswartstore', diff = tore - gegentore WHERE name = '$Heim' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE tippspiel_tabelle SET gewonnen = gewonnen + '$ausgew', unentschieden = unentschieden + '$ausunent', verloren = verloren + '$ausverl', punkte = punkte + '$auspunkte', spiele = spiele + '1', tore = tore + '$Auswartstore', gegentore = gegentore + '$Heimtore', diff = tore - gegentore WHERE name = '$Auswarts' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE tippspiel_spieltage SET tabelle = '1' WHERE spielid = '$Spielid' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$useridtipp = array();
$heimtipp = array();
$austipp = array();
$sql = "SELECT userid, heimtipp, auswartstipp FROM tippspiel_usertips WHERE spielid = '$Spielid' ORDER BY userid ASC";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$useridtipp[] = $row['userid'];
$heimtipp[] = $row['heimtipp'];
$austipp[] = $row['auswartstipp'];
}
for ($t = 0; $t < count($useridtipp);$t++){
$punkte = 0;
if (($heimtipp[$t] == '') && ($austipp[$t] == '')){
$sql = "UPDATE tippspiel_usertips SET bewertet = NULL , tabelle = 1 WHERE spielid = '$Spielid' AND userid = '$useridtipp[$t]'";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
if (($Heimtore == $heimtipp[$t]) && ($Auswartstore == $austipp[$t])){
$punkte = $board_config['tipp_trefferpkt'];}else{
if (($Heimtore > $Auswartstore) && ($heimtipp[$t] > $austipp[$t])){
$punkte = $board_config['tipp_tendenzpkt'];
$diff = $Heimtore - $Auswartstore;$difftipp = $heimtipp[$t] - $austipp[$t];
if ( $diff == $difftipp){
$punkte = $punkte + $board_config['tipp_differenzpkt'];}
}
if (($Heimtore < $Auswartstore) && ($heimtipp[$t] < $austipp[$t])){
$punkte = $board_config['tipp_tendenzpkt'];
$diff = $Auswartstore - $Heimtore;$difftipp = $austipp[$t] - $heimtipp[$t];
if ( $diff == $difftipp){
$punkte = $punkte + $board_config['tipp_differenzpkt'];}
}
if (($Heimtore == $Auswartstore) && ($heimtipp[$t] == $austipp[$t])){
$punkte = $board_config['tipp_unentschpkt'];
if ($Heimtore > $heimtipp[$t]){
$undiff = $Heimtore - $heimtipp[$t];}else{ $undiff = $heimtipp[$t] - $Heimtore;}
if ($undiff < 2){ $punkte = $punkte + $board_config['tipp_unentschpktextra'];}
}
}
$sql = "UPDATE tippspiel_usertips SET bewertet = '$punkte', tabelle = 1 WHERE spielid = '$Spielid' AND userid = '$useridtipp[$t]'";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
if( $punkte == $board_config['tipp_trefferpkt']){$treffer= 1;}else{$treffer= 0;}
$sql = "UPDATE ". USERS_TABLE ." SET tipp_punkte = tipp_punkte + '$punkte', tipp_getippt = tipp_getippt + 1, tipp_treffer = tipp_treffer + '$treffer' WHERE user_id = '$useridtipp[$t]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT userid FROM tippspiel_user_spieltage WHERE spieltag = '$Spieltag' AND userid = '$useridtipp[$t]' ";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$closecheck = $row['userid'];
}
if ($closecheck != $useridtipp[$t]){
$sql = "INSERT INTO tippspiel_user_spieltage (userid, spieltag, punkte, treffer) VALUES('".$useridtipp[$t]."', '$Spieltag', '$punkte', '$treffer')";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
$sql = "UPDATE tippspiel_user_spieltage SET punkte = punkte + '$punkte', treffer = treffer + '$treffer' WHERE userid = '$useridtipp[$t]' AND spieltag = '$Spieltag' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}
$treffer= 0;
}}
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 0 WHERE spieltag = '$Spieltag' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$usersieg = array();
$usertotalpoints = array();
$usertreffer = array();
$sql = "SELECT userid, punkte, treffer FROM tippspiel_user_spieltage WHERE spieltag = '$Spieltag' ORDER BY punkte DESC, treffer DESC ";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$usersieg[] = $row['userid'];
$usertotalpoints[] = $row['punkte'];
$usertreffer[] = $row['treffer'];
}
if ($usertotalpoints[0] != $usertotalpoints[1]){
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[0]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
if ($usertreffer[0] != $usertreffer[1]){
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[0]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
$t=1;
for ( $u = 0; $u < count($usersieg);$u++){
if ($usertotalpoints[$u] == $usertotalpoints[$t]){
if ($usertreffer[$u] == $usertreffer[$t]){
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[$u]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[$t]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}
if ($usertotalpoints[$u] != $usertotalpoints[$t]){break;}
if ($usertreffer[$u] != $usertreffer[$t]){break;}
$t++;
}
}
?>
<br>
<table width="95%" height="40" cellpadding="2" cellspacing="1" border="0" class="forumline" align="center" valign="center">
<tr><td class="row1" align="center"><span class="gensmall">
<? echo $lang['tipp_admin_gameclosed_success']; ?><br>
</span></td></tr></table>
<?
}
if ($mode == 'ergebnissenachhol'){
if ($Heimtore != ''){
if ($Auswartstore != ''){
$sql = "UPDATE tippspiel_spieltage SET heimtore = '$Heimtore', auswartstore = '$Auswartstore' WHERE spielid = '$Spielid' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}
if ($Heimtore == ''){
if ($Auswartstore == ''){
$sql = "UPDATE tippspiel_spieltage SET heimtore = NULL, auswartstore = NULL WHERE spielid = '$Spielid' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}
?>
<br>
<table width="95%" height="40" cellpadding="2" cellspacing="1" border="0" class="forumline" align="center" valign="center">
<tr><td class="row1" align="center"><span class="gensmall">
<? echo $lang['tipp_admin_result_success']; ?><br>
</span></td></tr></table>
<?
}
if ($mode == 'ergebnisse'){
for ($i = 0; $i < $board_config['tipp_spielespieltag']; $i++){
if ($Heimtore[$i] != ''){
if ($Auswartstore[$i] != ''){
if ($Tabelle[$i] != 1){
if ($Tabelle[$i] != 2){
$sql = "UPDATE tippspiel_spieltage SET heimtore = '$Heimtore[$i]', auswartstore = '$Auswartstore[$i]', tabelle = 0 WHERE spielid = '$Spielid[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}}}
if ($Heimtore[$i] == ''){
if ($Auswartstore[$i] == ''){
if ($Tabelle[$i] != 1){
if ($Tabelle[$i] != 2){
$sql = "UPDATE tippspiel_spieltage SET heimtore = NULL, auswartstore = NULL, tabelle = 0 WHERE spielid = '$Spielid[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}}}
if ($Heimtore[$i] != ''){
if ($Auswartstore[$i] != ''){
if ($Tabelle[$i] == 2){
$sql = "UPDATE tippspiel_spieltage SET heimtore = '$Heimtore[$i]', auswartstore = '$Auswartstore[$i]', tabelle = 2 WHERE spielid = '$Spielid[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}}
if ($Heimtore[$i] == ''){
if ($Auswartstore[$i] == ''){
if ($Tabelle[$i] == 2){
$sql = "UPDATE tippspiel_spieltage SET heimtore = NULL, auswartstore = NULL, tabelle = 2 WHERE spielid = '$Spielid[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}}
if (isset($ausgefallen)){
if (in_array ("$Spielid[$i]", $ausgefallen)) {
$sql = "UPDATE tippspiel_spieltage SET heimtore = NULL, auswartstore = NULL, tabelle = 99 WHERE spielid = '$Spielid[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}
}
if (isset($sonntag)){
if (in_array ("$Spielid[$i]", $sonntag)) {
$sql = "UPDATE tippspiel_spieltage SET heimtore = NULL, auswartstore = NULL, tabelle = 77 WHERE spielid = '$Spielid[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}
}
}
?>
<br>
<table width="95%" height="40" cellpadding="2" cellspacing="1" border="0" class="forumline" align="center" valign="center">
<tr><td class="row1" align="center"><span class="gensmall">
<? echo $lang['tipp_admin_result_success']; ?><br>
</span></td></tr></table>
<?
}
if ($mode == 'tabelle'){
$u_punktecheck = "";
$sql = "SELECT user_id, tipp_punkte, tipp_treffer FROM ". USERS_TABLE ." WHERE tipp_spieltagtipps = 1 ORDER BY tipp_punkte DESC,tipp_treffer DESC";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$pos_counter++;
if (($u_punktecheck == $row['tipp_punkte']) && ($u_treffercheck == $row['tipp_treffer']))
{$poscheck++; $pos_count = $pos_counter - $poscheck;}
else{$pos_count = $pos_counter;$poscheck = 0;}
$useridlastpos[] = $row['user_id'];
$userlastpos[] = $pos_count;
$u_punktecheck = $row['tipp_punkte'];
$u_treffercheck = $row['tipp_treffer'];
}
for ( $p = 0; $p < count($userlastpos);$p++){
$sql = "UPDATE ". USERS_TABLE ." SET tipp_lastpos = '$userlastpos[$p]' WHERE user_id = '$useridlastpos[$p]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}
$punktecheck = "";
$sql = 'SELECT teamid,punkte,diff,tore,gegentore FROM tippspiel_tabelle ORDER BY punkte DESC, diff DESC, tore DESC, gegentore ASC';
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$platzcounter++;
if (($punktecheck == $row['punkte']) && ($diffcheck == $row['diff']) && ($torecheck == $row['tore']) && ($gegentorecheck == $row['gegentore']))
{$platzcheck++; $platz_count = $platzcounter - $platzcheck;}
else{$platz_count = $platzcounter;$platzcheck = 0;}
$teamlastpos[] = $platz_count;
$teamidlastpos[] = $row['teamid'];
$punktecheck = $row['punkte'];
$diffcheck = $row['diff'];
$torecheck = $row['tore'];
$gegentorecheck = $row['gegentore'];
}
for ( $p = 0; $p < count($teamidlastpos);$p++){
$sql = "UPDATE tippspiel_tabelle SET posbefore = '$teamlastpos[$p]' WHERE teamid = '$teamidlastpos[$p]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}
for ($i = 0; $i < $board_config['tipp_spielespieltag']; $i++){
if ( $Tabelle[$i] != '99'){
if ( $Tabelle[$i] != '77'){
$heimgew = '0';$heimpunkte = '0';$ausverl = '0';$heimunent = '0';$ausunent = '0';$auspunkte = '0';$heimverl = '0';$ausgew = '0';
if ($Heimtore[$i] > $Auswartstore[$i]){
$heimgew = '1';$heimpunkte = '3';$ausverl = '1';}
if ($Heimtore[$i] == $Auswartstore[$i]){
$heimunent = '1';$ausunent = '1';$heimpunkte = '1';$auspunkte = '1';}
if ($Heimtore[$i] < $Auswartstore[$i]){
$heimverl = '1';$auspunkte = '3';$ausgew = '1';}
$sql = "UPDATE tippspiel_tabelle SET gewonnen = gewonnen + '$heimgew', unentschieden = unentschieden + '$heimunent', verloren = verloren + '$heimverl', punkte = punkte + '$heimpunkte', spiele = spiele + '1', tore = tore + '$Heimtore[$i]', gegentore = gegentore + '$Auswartstore[$i]', diff = tore - gegentore WHERE name = '$Heim[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE tippspiel_tabelle SET gewonnen = gewonnen + '$ausgew', unentschieden = unentschieden + '$ausunent', verloren = verloren + '$ausverl', punkte = punkte + '$auspunkte', spiele = spiele + '1', tore = tore + '$Auswartstore[$i]', gegentore = gegentore + '$Heimtore[$i]', diff = tore - gegentore WHERE name = '$Auswarts[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE tippspiel_spieltage SET tabelle = '1' WHERE spielid = '$Spielid[$i]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$useridtipp = array();
$heimtipp = array();
$austipp = array();
$sql = "SELECT userid, heimtipp, auswartstipp FROM tippspiel_usertips WHERE spielid = '$Spielid[$i]' ORDER BY userid ASC";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$useridtipp[] = $row['userid'];
$heimtipp[] = $row['heimtipp'];
$austipp[] = $row['auswartstipp'];
}
for ($t = 0; $t < count($useridtipp);$t++){
$punkte = 0;
if (($heimtipp[$t] == '') && ($austipp[$t] == '')){
$sql = "UPDATE tippspiel_usertips SET bewertet = NULL , tabelle = 1 WHERE spielid = '$Spielid[$i]' AND userid = '$useridtipp[$t]'";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
if (($Heimtore[$i] == $heimtipp[$t]) && ($Auswartstore[$i] == $austipp[$t])){
$punkte = $board_config['tipp_trefferpkt'];}else{
if (($Heimtore[$i] > $Auswartstore[$i]) && ($heimtipp[$t] > $austipp[$t])){
$punkte = $board_config['tipp_tendenzpkt'];
$diff = $Heimtore[$i] - $Auswartstore[$i];$difftipp = $heimtipp[$t] - $austipp[$t];
if ( $diff == $difftipp){
$punkte = $punkte + $board_config['tipp_differenzpkt'];}
}
if (($Heimtore[$i] < $Auswartstore[$i]) && ($heimtipp[$t] < $austipp[$t])){
$punkte = $board_config['tipp_tendenzpkt'];
$diff = $Auswartstore[$i] - $Heimtore[$i];$difftipp = $austipp[$t] - $heimtipp[$t];
if ( $diff == $difftipp){
$punkte = $punkte + $board_config['tipp_differenzpkt'];}
}
if (($Heimtore[$i] == $Auswartstore[$i]) && ($heimtipp[$t] == $austipp[$t])){
$punkte = $board_config['tipp_unentschpkt'];
if ($Heimtore[$i] > $heimtipp[$t]){
$undiff = $Heimtore[$i] - $heimtipp[$t];}else{ $undiff = $heimtipp[$t] - $Heimtore[$i];}
if ($undiff < 2){ $punkte = $punkte + $board_config['tipp_unentschpktextra'];}
}
}
$sql = "UPDATE tippspiel_usertips SET bewertet = '$punkte', tabelle = 1 WHERE spielid = '$Spielid[$i]' AND userid = '$useridtipp[$t]'";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}
}}}
$sql = "SELECT user_id FROM ". USERS_TABLE ." WHERE tipp_spieltagtipps = 1 ORDER BY user_id ASC";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$useridtotal[] = $row['user_id'];
}
$countuser = count($useridtotal);
for ( $r = 0; $r < $countuser; $r++){
$bewertet = array();
$treffer = 0;
$sql = "SELECT bewertet FROM tippspiel_usertips WHERE userid = '$useridtotal[$r]' AND spielid > '$Spieltaganfang' AND spielid < '$Spieltagende' AND tabelle = 1 ORDER BY spielid ASC ";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$treffercheck = $row['bewertet'];
if($treffercheck != ''){
if( $treffercheck == $board_config['tipp_trefferpkt']){$treffer++;}
$bewertet[] = $row['bewertet'];}
}
$totaltipps = count($bewertet);
$total = array_sum($bewertet);
$sql = "UPDATE ". USERS_TABLE ." SET tipp_punkte = tipp_punkte + '$total', tipp_getippt = tipp_getippt + '$totaltipps', tipp_treffer = tipp_treffer + '$treffer' WHERE user_id = '$useridtotal[$r]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "INSERT INTO tippspiel_user_spieltage (userid, spieltag, punkte, treffer) VALUES('".$useridtotal[$r]."', '$Spieltag', '$total', '$treffer')";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}
$usersieg = array();
$usertotalpoints = array();
$usertreffer = array();
$sql = "SELECT userid, punkte, treffer FROM tippspiel_user_spieltage WHERE spieltag = '$Spieltag' ORDER BY punkte DESC, treffer DESC ";
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, $lang['tipp_Sql_Error'], $lang['Error'], __LINE__, __FILE__, $sql);
while($row = $db->sql_fetchrow($result))
{
$usersieg[] = $row['userid'];
$usertotalpoints[] = $row['punkte'];
$usertreffer[] = $row['treffer'];
}
if ($usertotalpoints[0] != $usertotalpoints[1]){
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[0]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
if ($usertreffer[0] != $usertreffer[1]){
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[0]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}else{
$t=1;
for ( $u = 0; $u < count($usersieg);$u++){
if ($usertotalpoints[$u] == $usertotalpoints[$t]){
if ($usertreffer[$u] == $usertreffer[$t]){
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[$u]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE tippspiel_user_spieltage SET tagessieg = 1 WHERE spieltag = '$Spieltag' AND userid = '$usersieg[$t]' ";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Konnte keine Verbindung erstellen', '', __LINE__, __FILE__, $sql);
}
}}
if ($usertotalpoints[$u] != $usertotalpoints[$t]){break;}
if ($usertreffer[$u] != $usertreffer[$t]){break;}
$t++;
}
}
?>
<br>
<table width="95%" height="40" cellpadding="2" cellspacing="1" border="0" class="forumline" align="center" valign="center">
<tr><td class="row1" align="center"><span class="gensmall">
<? echo $lang['tipp_admin_resultclosed_success']; ?><br>
</span></td></tr></table>
<?
}
include('./page_footer_admin.'.$phpEx);
?>
Das ist in der nächsten Version behoben.n3bUr hat geschrieben:ups, da hab ich leider keine Ahnung!
Mein Problem ist nun aber, ich habe die Dateien hochgeladen, also geupdatet, danach dann das Datenbankupdate durchgeführt, wobei hier komische Fehler auftauchten, mh, keine Ahnung, hat aber wohl funktioniert.
Mein Problem ist aber auch das mit der userid und dem n/a anzeigen, daher kann man leider auch in meinen Statistiken nicht sehen wieviel Punkte man am letzten Spieltag gemacht hat und auf wieviel Tagessiege man es schon gebracht hat!
Wie lautet der Fehler?n3bUr hat geschrieben:Mir fällt jetzt noch ein Fehler auf.
Wenn ich auf meine Statistic gehen möchte, kommt ein Datenbankfehler in der Tippspielstatistik.
Was könnte dies sein?