Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //required for stats
- require_once('php/wdlgame.php');
- //required for db
- require_once('common.php');
- //declare variables
- $filepaths = array();
- $gameId = $_POST['$gameId'];
- $playerNames = array();
- //Loop through each file
- for($i=0; $i<count($_FILES['upload']['name']); $i++) {
- //Get the temp file path
- $tmpFilePath = $_FILES['upload']['tmp_name'][$i];
- //Make sure we have a filepath
- if ($tmpFilePath != "") {
- //Setup our new file path
- $newFilePath = "./upload/logs" . $_FILES['upload']['name'][$i];
- //Upload the file into the temp dir
- if(move_uploaded_file($tmpFilePath, $newFilePath)) {
- array_push($filepaths,$newFilePath);
- }
- }
- }
- $wdlgame = NULL;
- // Create WDLGame objects holding stats
- $wdlgame = new WDLGame($filepaths);
- // Get WDLGame playernames
- /* Get fields for WDLGame here */
- foreach ($wdlgame->roundsArray as $wdlround) {
- //Insert power stats
- $STH = $DBH -> prepare(
- "INSERT INTO statsRounds (
- redPowerPercent, bluePowerPercent
- ) VALUES (
- $wdlround->redPowerPercent, $wdlround->bluePowerPercent
- )"
- );
- //Execute query
- $STH -> execute();
- //Insert red team stats
- $STH = $DBH -> prepare(
- "INSERT INTO statsGames (
- redAllCaptures, redTotalCaptures, redTotalPickupCaptures, redTotalAssists, redTotalTouches, redTotalFrags, redTotalDamage, redTotalDeaths, redTotalFlagDefenses, redPowerPercent, redAccuracyOverallHitRatioAverage, redAccuracyOverallSpriteAverage, redAccuracyOverallPinpointAverage, redTotalAllCapturesPerMinute, redCapturesPerMinute, redCapturesDoneWithSuperPickups, redTotalDamageOutput, redTotalFlagCarrierDamageOutput, redDamageToDeathRatio, redTotalFlagReturns, redFlagReturnsPerMinute, redTotalFlagCarrierKills, redTotalEnviroDeaths, redTotalEnviroCarrierDeaths, redSpreeKillingSpreeCount, redSpreeRampageCount, redSpreeDominatingCount, redSpreeUnstoppableCount, redSpreeGodlikeCount, redSpreeWickedSickCount, redMultiDoubleKillCount, redMultiMultiKillCount, redMultiUltraKillCount, redMultiMonsterKillCount, redTotalPickupTouches, redOverallTouchesPerMinute, redAccuracySpriteRatioFlagOutAvg, redAccuracyPinpointRatioFlagOutAvg, redAccuracyHitMissRatioFlagOutAvg, redLongestSpree, redLongestMultikill
- ) VALUES (
- $wdlround->redTeam->allCaptures, $wdlround->redTeam->totalCaptures, $wdlround->redTeam->totalPickupCaptures, $wdlround->redTeam->totalAssists, $wdlround->redTeam->totalTouches, $wdlround->redTeam->totalFrags, $wdlround->redTeam->totalDamage, $wdlround->redTeam->totalDeaths, $wdlround->redTeam->totalFlagDefenses, $wdlround->redTeam->teamAccuracyOverallHitRatioAverage, $wdlround->redTeam->teamAccuracyOverallSpriteAverage, $wdlround->redTeam->teamAccuracyOverallPinpointAverage, $wdlround->redTeam->teamTotalAllCapturesPerMinute, $wdlround->redTeam->teamCapturesPerMinute, $wdlround->redTeam->teamCapturesDoneWithSuperPickups, $wdlround->redTeam->teamTotalDamageOutput,
- $wdlround->redTeam->teamTotalFlagCarrierDamageOutput, $wdlround->redTeam->teamDamageToDeathRatio, $wdlround->redTeam->teamTotalFlagReturns, $wdlround->redTeam->teamFlagReturnsPerMinute, $wdlround->redTeam->teamTotalFlagCarrierKills, $wdlround->redTeam->teamTotalEnviroDeaths, $wdlround->redTeam->teamTotalEnviroCarrierDeaths, $wdlround->redTeam->teamSpreeKillingSpreeCount, $wdlround->redTeam->teamSpreeRampageCount, $wdlround->redTeam->teamSpreeDominatingCount, $wdlround->redTeam->teamSpreeUnstoppableCount, $wdlround->redTeam->teamSpreeGodlikeCount, $wdlround->redTeam->teamSpreeWickedSickCount, $wdlround->redTeam->teamMultiDoubleKillCount,$wdlround->redTeam->teamMultiMultiKillCount, $wdlround->redTeam->teamMultiUltraKillCount, $wdlround->redTeam->teamMultiMonsterKillCount, $wdlround->redTeam->teamTotalPickupTouches, $wdlround->redTeam->teamOverallTouchesPerMinute, $wdlround->redTeam->teamEfficiencyPoints, $wdlround->redTeam->teamEfficiencyPointsAvg, $wdlround->redTeam->teamAccuracySpriteRatioFlagOutAvg, $wdlround->redTeam->teamAccuracyPinpointRatioFlagOutAvg, $wdlround->redTeam->teamAccuracyHitMissRatioFlagOutAvg, $wdlround->redTeam->teamLongestSpree, $wdlround->redTeam->teamLongestMultikill
- )"
- );
- //Execute query
- $STH -> execute();
- //Insert blue team stats
- $STH = $DBH -> prepare(
- "INSERT INTO statsGames (
- blueAllCaptures, blueTotalCaptures, blueTotalPickupCaptures, blueTotalAssists, blueTotalTouches, blueTotalFrags, blueTotalDamage, blueTotalDeaths, blueTotalFlagDefenses, bluePowerPercent, blueAccuracyOverallHitRatioAverage, blueAccuracyOverallSpriteAverage, blueAccuracyOverallPinpointAverage, blueTotalAllCapturesPerMinute, blueCapturesPerMinute, blueCapturesDoneWithSuperPickups, blueTotalDamageOutput, blueTotalFlagCarrierDamageOutput, blueDamageToDeathRatio, blueTotalFlagReturns, blueFlagReturnsPerMinute, blueTotalFlagCarrierKills, blueTotalEnviroDeaths, blueTotalEnviroCarrierDeaths, blueSpreeKillingSpreeCount, blueSpreeRampageCount, blueSpreeDominatingCount, blueSpreeUnstoppableCount, blueSpreeGodlikeCount, blueSpreeWickedSickCount, blueMultiDoubleKillCount, blueMultiMultiKillCount, blueMultiUltraKillCount, blueMultiMonsterKillCount, blueTotalPickupTouches, blueOverallTouchesPerMinute, blueAccuracySpriteRatioFlagOutAvg, blueAccuracyPinpointRatioFlagOutAvg, blueAccuracyHitMissRatioFlagOutAvg, blueLongestSpree, blueLongestMultikill
- ) VALUES (
- $wdlround->blueTeam->allCaptures, $wdlround->blueTeam->totalCaptures, $wdlround->blueTeam->totalPickupCaptures, $wdlround->blueTeam->totalAssists, $wdlround->blueTeam->totalTouches, $wdlround->blueTeam->totalFrags, $wdlround->blueTeam->totalDamage, $wdlround->blueTeam->totalDeaths, $wdlround->blueTeam->totalFlagDefenses, $wdlround->blueTeam->teamAccuracyOverallHitRatioAverage, $wdlround->blueTeam->teamAccuracyOverallSpriteAverage, $wdlround->blueTeam->teamAccuracyOverallPinpointAverage, $wdlround->blueTeam->teamTotalAllCapturesPerMinute, $wdlround->blueTeam->teamCapturesPerMinute, $wdlround->blueTeam->teamCapturesDoneWithSuperPickups, $wdlround->blueTeam->teamTotalDamageOutput,
- $wdlround->blueTeam->teamTotalFlagCarrierDamageOutput, $wdlround->blueTeam->teamDamageToDeathRatio, $wdlround->blueTeam->teamTotalFlagReturns, $wdlround->blueTeam->teamFlagReturnsPerMinute, $wdlround->blueTeam->teamTotalFlagCarrierKills, $wdlround->blueTeam->teamTotalEnviroDeaths, $wdlround->blueTeam->teamTotalEnviroCarrierDeaths, $wdlround->blueTeam->teamSpreeKillingSpreeCount, $wdlround->blueTeam->teamSpreeRampageCount, $wdlround->blueTeam->teamSpreeDominatingCount, $wdlround->blueTeam->teamSpreeUnstoppableCount, $wdlround->blueTeam->teamSpreeGodlikeCount, $wdlround->blueTeam->teamSpreeWickedSickCount, $wdlround->blueTeam->teamMultiDoubleKillCount,$wdlround->blueTeam->teamMultiMultiKillCount, $wdlround->blueTeam->teamMultiUltraKillCount, $wdlround->blueTeam->teamMultiMonsterKillCount, $wdlround->blueTeam->teamTotalPickupTouches, $wdlround->blueTeam->teamOverallTouchesPerMinute, $wdlround->blueTeam->teamEfficiencyPoints, $wdlround->blueTeam->teamEfficiencyPointsAvg, $wdlround->blueTeam->teamAccuracySpriteRatioFlagOutAvg, $wdlround->blueTeam->teamAccuracyPinpointRatioFlagOutAvg, $wdlround->blueTeam->teamAccuracyHitMissRatioFlagOutAvg, $wdlround->blueTeam->teamLongestSpree, $wdlround->blueTeam->teamLongestMultikill
- )"
- );
- // Get each red team player
- foreach ($wdlround->redTeam->playersArray as $wdlplayer) {
- /* Player stuff here */
- }
- // Get each blue team player
- foreach ($wdlround->blueTeam->playersArray as $wdlplayer) {
- /* Player stuff here */
- }
- }
- ?>
- <!doctype html>
- <html>
- <head></head>
- <body>
- <?php
- include('nav.php');
- ?>
- <div style="width: auto; float: left;">
- <h1>Upload Logs</h1>
- <form enctype="multipart/form-data" action="addLogExec.php" method="post">
- Select logs to upload:
- <p>
- <input name="upload[]" type="file" multiple />
- </p>
- Select which game these logs belong to:
- <p>
- <?php require_once('getGames.php'); ?>
- </p>
- <p>
- <input type="submit" value="Submit">
- </p>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement