示例#1
0
function DeleteUnfinishedSixserverGame($sixGameId)
{
    $appRoot = realpath(dirname(__FILE__)) . '/';
    require $appRoot . './../variables.php';
    require $appRoot . './../variablesdb.php';
    require_once $appRoot . './../functions.php';
    // current season
    $sql = "SELECT season FROM six_stats";
    $sixSeason = mysql_fetch_array(mysql_query($sql))[0];
    $sql = "SELECT * FROM six_matches_status WHERE id={$sixGameId} AND season={$sixSeason}";
    $row = mysql_fetch_array(mysql_query($sql));
    $profiles = array();
    $resultMsg = "";
    if (empty($row)) {
        $resultMsg .= "Unfinished Sixserver game {$sixGameId} not found";
    } else {
        $profiles[] = $row['profileHome'];
        $profiles[] = $row['profileHome2'];
        $profiles[] = $row['profileHome3'];
        $profiles[] = $row['profileAway'];
        $profiles[] = $row['profileAway2'];
        $profiles[] = $row['profileAway3'];
        // Delete game
        $sql = "DELETE FROM six_matches_status WHERE id={$sixGameId}";
        mysql_query($sql);
        $resultMsg .= "<p>SQL: {$sql} - Affected: " . mysql_affected_rows() . "</p>";
        foreach ($profiles as $profile) {
            if (!empty($profile)) {
                $resultMsg .= RecalculateDcForProfile($profile);
                $sql = "SELECT disconnects, points, rating FROM six_profiles WHERE id={$profile}";
                $result = mysql_query($sql);
                $resultMsg .= "<p>SQL: {$sql} - Affected: " . mysql_affected_rows() . "</p>";
                if ($row = mysql_fetch_array($result)) {
                    $resultMsg .= RecalculatePointsForProfile($profile, $row['disconnects'], $row['points'], $row['rating']);
                    $resultMsg .= RecalculateStreak($profile);
                } else {
                    $resultMsg .= "<p>No profile found for profileId={$profileId}!</p>";
                }
            }
        }
    }
    return $resultMsg;
}
<?php

$page = "recalculatePointsForProfiles";
require '../../variables.php';
require '../../variablesdb.php';
require_once '../functions.php';
require_once './../../functions.php';
require '../../top.php';
$log = new KLogger('/var/www/yoursite/http/log/runonce/', KLogger::INFO);
echo getOuterBoxTop($leaguename . " <span class='grey-small'>&raquo;</span> Recalculate Points For Profiles", "");
?>
<?

$sql = "SELECT * FROM six_profiles where id=591 ORDER BY Id ASC";
$resultX = mysql_query($sql);
while ($profile = mysql_fetch_array($resultX)) {
  $profileId = $profile['id'];
  $log->logInfo('profileId='.$profileId);
  $log->logInfo('RecalculatePointsForProfile='.RecalculatePointsForProfile($profile['id'], $profile['disconnects'], $profile['points'], $profile['rating']));
  $log->logInfo('RecalculateStreak='.RecalculateStreak($profile['id']));
}

?>
<?php 
echo getOuterBoxBottom();
?>
<?


require ('../../bottom.php');
?>
示例#3
0
    $sql = "UPDATE six_matches SET played_on=played_on, score_home=".$scoreHome.", score_away=".$scoreAway.", score_home_reg=".$scoreHomeReg.", score_away_reg=".$scoreAwayReg." ".
      "WHERE id=".$sixEditGameId;
    echo "<p>SQL: $sql</p>";
    
    mysql_query($sql);
    
    $sql = "SELECT smp.profile_id, sp.disconnects, sp.points, sp.rating FROM six_matches_played smp ".
      "LEFT JOIN six_profiles sp ON sp.id=smp.profile_id ".
      "WHERE smp.match_id=".$sixEditGameId;
    echo "<p>SQL: $sql</p>";
    $result = mysql_query($sql);
    while ($row = mysql_fetch_array($result)) {
      $profileId = $row['profile_id'];
      $msg = RecalculatePointsForProfile($profileId, $row['disconnects'], $row['points'], $row['rating']);
      echo "<p>$msg</p>";
      $msg = RecalculateStreak($profileId);
      echo "<p>$msg</p>";
    }
    $sql = "UPDATE six_matches_played SET points=NULL, pointsDiff=NULL, rating=NULL, ratingDiff=NULL WHERE match_id=".$sixEditGameId;
    echo "<p>SQL: $sql</p>";
    
    mysql_query($sql);
    
    echo '<br><a target="_new" href="http://www.yoursite/sixserver/games.php?id='.$sixEditGameId.'">Check game</a>';
	}
	elseif (!empty($_POST['sixEditGameId'])) {
		$sixEditGameId = $_POST['sixEditGameId'];
    
		$sql = "SELECT * FROM six_matches where id=$sixEditGameId";
		$result = mysql_query($sql);