Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.18 KB | None | 0 0
  1. <?php
  2.  
  3. //required for stats
  4. require_once('php/wdlgame.php');
  5.  
  6. //required for db
  7. require_once('common.php');
  8.  
  9. //declare variables
  10. $filepaths = array();
  11. $gameId = $_POST['$gameId'];
  12. $playerNames = array();
  13.  
  14. //Loop through each file
  15. for($i=0; $i<count($_FILES['upload']['name']); $i++) {
  16.    
  17.     //Get the temp file path
  18.     $tmpFilePath = $_FILES['upload']['tmp_name'][$i];
  19.    
  20.     //Make sure we have a filepath
  21.     if ($tmpFilePath != "") {
  22.        
  23.         //Setup our new file path
  24.         $newFilePath = "./upload/logs" . $_FILES['upload']['name'][$i];
  25.        
  26.         //Upload the file into the temp dir
  27.         if(move_uploaded_file($tmpFilePath, $newFilePath)) {
  28.             array_push($filepaths,$newFilePath);
  29.         }
  30.     }
  31. }
  32.  
  33. $wdlgame = NULL;
  34. // Create WDLGame objects holding stats
  35. $wdlgame =  new WDLGame($filepaths);
  36.  
  37.  
  38. // Get WDLGame playernames
  39.  
  40. /* Get fields for WDLGame here */
  41. foreach ($wdlgame->roundsArray as $wdlround) {
  42.  
  43.     //Insert power stats
  44.     $STH = $DBH -> prepare(
  45.         "INSERT INTO statsRounds (
  46.             redPowerPercent, bluePowerPercent
  47.         ) VALUES (
  48.             $wdlround->redPowerPercent, $wdlround->bluePowerPercent
  49.         )"
  50.     );
  51.        
  52.     //Execute query
  53.     $STH -> execute();
  54.    
  55.     //Insert red team stats    
  56.     $STH = $DBH -> prepare(
  57.         "INSERT INTO statsGames (
  58. 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
  59.         ) VALUES (
  60. $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,
  61. $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
  62.         )"
  63.     );
  64.        
  65.     //Execute query
  66.     $STH -> execute();
  67.                
  68.     //Insert blue team stats       
  69.     $STH = $DBH -> prepare(
  70.         "INSERT INTO statsGames (
  71.     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
  72.         ) VALUES (
  73.     $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,
  74.     $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
  75.         )"
  76.     );    
  77.          
  78.         // Get each red team player
  79.         foreach ($wdlround->redTeam->playersArray as $wdlplayer) {
  80.                 /* Player stuff here */
  81.         }
  82.        
  83.         // Get each blue team player
  84.         foreach ($wdlround->blueTeam->playersArray as $wdlplayer) {
  85.                 /* Player stuff here */
  86.         }
  87. }
  88.  
  89. ?>
  90.  
  91.  
  92. <!doctype html>
  93. <html>
  94. <head></head>
  95.  
  96. <body>
  97.     <?php
  98.         include('nav.php');
  99.     ?>
  100.    
  101.     <div style="width: auto; float: left;">
  102.         <h1>Upload Logs</h1>
  103.         <form enctype="multipart/form-data" action="addLogExec.php" method="post">
  104.            
  105.             Select logs to upload:
  106.             <p>
  107.                 <input name="upload[]" type="file" multiple />
  108.             </p>
  109.              
  110.             Select which game these logs belong to:
  111.             <p>
  112.                 <?php require_once('getGames.php'); ?>  
  113.             </p>
  114.            
  115.             <p>
  116.                 <input type="submit" value="Submit">
  117.             </p>
  118.            
  119.         </form>
  120.     </div>
  121. </body>
  122. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement