} ///event log OCmysql_query("INSERT INTO racedataeventsv2 SET steamid='{$steamid}' , raceshort='{$raceshort}' , ipport='{$ip}' , event='timeplayed' , data1='{$data1}' , data2='{$data2}' , killerlvl='{$level}' , processed='1'"); //event log OCmysql_query("INSERT INTO timeplayedlog SET steamid='{$steamid}' , game='{$game}', raceshort='{$raceshort}' , lvl='{$level}' , ipport='{$ip}' "); ///////////////// $query = "INSERT INTO perplayerraceplaytimelongv2 SET steamid='{$steamid}' , raceshort='{$raceshort}' ON DUPLICATE KEY UPDATE "; if (strcmp($data2, "alive") == 0) { $query .= " timealive=timealive+1"; } else { $query .= " timedead=timedead+1"; } OCmysql_query($query); /////////// $query = "UPDATE playerinfoperserver SET timeplayed=timeplayed+1 WHERE steamid='{$steamid}' AND ipport='{$ip}'"; OCmysql_query($query); //////////////// $query = "UPDATE agg_racekill_day SET "; if (strcmp($data2, "alive") == 0) { $query .= " timeplayed=timeplayed+1 "; } else { $query .= " timeplayed_dead=timeplayed_dead+1 "; } $query .= " WHERE raceshort='{$raceshort}' AND date=CURDATE()"; OCmysql_query($query); ////////////////// $query = "INSERT INTO playerinfoperday SET steamid='{$steamid}' , date=CURDATE() ON DUPLICATE KEY UPDATE timeplayed=timeplayed+1 "; OCmysql_query($query); $query = "INSERT INTO timeplayed_day SET date=CURDATE() ON DUPLICATE KEY UPDATE timeplayed=timeplayed+1 "; OCmysql_query($query); echo "success timeplayed";
$iponly = $remoteip; } function is_private_ip($ip) { if (empty($ip) or !ip2long($ip)) { return NULL; } $private_ips = array(array('10.0.0.0', '10.255.255.255'), array('172.16.0.0', '172.31.255.255'), array('192.168.0.0', '192.168.255.255')); $ip = ip2long($ip); foreach ($private_ips as $ipr) { $min = ip2long($ipr[0]); $max = ip2long($ipr[1]); if ($ip >= $min && $ip <= $max) { return true; } } return false; } if (is_private_ip($iponly) || $iponly == "0.0.0.0") { $ip = $remoteip . $port; } $remoteip = $remoteip . $port; // $querystring="SELECT * FROM serverinfo WHERE ip LIKE '$ip' AND timestamp > NOW() - INTERVAL 10 MINUTE"; // $result=OCmysql_query($querystring); // $rowsreturned=mysql_num_rows($result); // if($rowsreturned==0){ OCmysql_query("INSERT INTO serverinfo SET ip='{$ip}', timestamp_firstseen=NOW() ON DUPLICATE KEY UPDATE timestamp=NOW(), remoteip='{$remoteip}' , hostname='{$hostname}',version='{$version}',game='{$game}',map='{$map}',players='{$players}',maxplayers='{$maxplayers}',\tfromext='1' , postdataext='" . mysql_real_escape_string("HEADER:::: " . json_encode(getallheaders()) . " \$_REQUEST::serverinfoext.php:: " . json_encode($_REQUEST)) . "'"); // } //aggregate players is in funcaggregateplayrecount.php echo "success serverinfoext"; echo json_encode($_REQUEST) . "INSERT INTO serverinfo SET ip='{$ip}', timestamp_firstseen=NOW() ON DUPLICATE KEY UPDATE timestamp=NOW(), remoteip='{$remoteip}' , hostname='{$hostname}',version='{$version}',game='{$game}',map='{$map}',players='{$players}',maxplayers='{$maxplayers}',\tfromext='1' ";
<?php include "header.php"; mysql_select_db("<USERNAME_OMITTED>", $db); $steamid = $_GET['steamid']; $raceshort = $_GET['raceshort']; $ip = $_GET['ip']; $game = $_GET['game']; $win = $_GET['win']; $clientteam = $_GET['clientteam']; $lvl = $_GET['lvl']; $result = OCmysql_query("SELECT * FROM disabledservers WHERE ipport='{$ip}' and nostats='1' "); if (mysql_num_rows($result)) { die("success winloss disabled"); } $query = "INSERT INTO racedataeventsv2 SET steamid='{$steamid}' , raceshort='{$raceshort}' , ipport='{$ip}' , game='{$game}' , event='winloss',data1='{$win}'"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } $query = "INSERT INTO recentwins SET steamid='{$steamid}' , raceshort='{$raceshort}' , ip='{$ip}' , game='{$game}' , win='{$win}', clientteam='{$clientteam}' , lvl='{$lvl}'"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } $query = "INSERT INTO agg_racekill_day SET raceshort='{$raceshort}', date=CURDATE() ON DUPLICATE KEY UPDATE "; if (strcmp($win, "1") == 0) { $query .= "win=win+1"; } else { $query .= "loss=loss+1"; }
die('Invalid query: ' . mysql_error()); } while ($row = mysql_fetch_array($result)) { $count = $row['MAX(uni)'] - $maxrows - 1; } } for ($i = 0; $i < 5; $i++) { //$limit=$maxrows+; $result = mysql_query("SELECT * FROM racedataeventsv2 WHERE uni>{$count} ORDER BY uni ASC LIMIT {$maxrows}"); if (!$result) { die('Invalid query: ' . mysql_error()); } $rows = mysql_num_rows($result); if ($rows > 0) { for ($i = 0; $i < mysql_num_rows($result); $i++) { echo "[]event|0x" . strtoupper(dechex(intval(mysql_result($result, $i, "uni")))) . "|" . mysql_result($result, $i, "uni") . "|" . mysql_result($result, $i, "steamid") . "|" . mysql_result($result, $i, "raceshort") . "|" . mysql_result($result, $i, "event") . "|" . mysql_result($result, $i, "data1") . "|" . mysql_result($result, $i, "data2") . "|" . mysql_result($result, $i, "killerlvl") . "|" . mysql_result($result, $i, "victimlvl") . "|" . mysql_result($result, $i, "timestamp"); } break; } ///otherwise, sleep and try agin usleep(100000); } $querystring = "SELECT SUM(players),SUM(maxplayers) FROM serverinfo WHERE timestamp > NOW() - INTERVAL 60 SECOND"; $result = OCmysql_query($querystring); $rowsreturned = mysql_num_rows($result); for ($i = 0; $i < $rowsreturned; $i++) { $players = mysql_result($result, $i, "SUM(players)"); $maxplayers = mysql_result($result, $i, "SUM(maxplayers)"); echo "[]playercount|" . $players; } //usleep(500000);
$araceshort = array(); $aracename = array(); $racecount = mysql_num_rows($result); for ($i = 0; $i < $racecount; $i++) { $aracename[$i] = mysql_result($result, $i, "racename"); $araceshort[$i] = mysql_result($result, $i, "raceshort"); if (strlen(mysql_result($result, $i, "finalizedname")) > 1) { $aracename[$i] = mysql_result($result, $i, "finalizedname"); } } if ($nofilters) { //READ DATA FROM DAILY CACHE echo "Reading data from cache..."; for ($i = 0; $i < $racecount; $i++) { $raceshort = $araceshort[$i]; $result = OCmysql_query("SELECT SUM(kills) as kills, SUM(deaths) as deaths , SUM(win) as win, SUM(loss) as loss , sum(timeplayed) as timeplayed FROM agg_racekill_day WHERE raceshort='" . $raceshort . "' AND {$datelimit} "); if (mysql_num_rows($result)) { $all[$raceshort]['kills'] = mysql_result($result, 0, "kills"); $all[$raceshort]['deaths'] = mysql_result($result, 0, "deaths"); $all[$raceshort]['wins'] = mysql_result($result, 0, "win"); $all[$raceshort]['losses'] = mysql_result($result, 0, "loss"); $all[$raceshort]['timeplayed'] = mysql_result($result, 0, "timeplayed"); } } } else { //READ BY ROW SCANS echo "Reading raw data. KD: <span id='kdprogress'></span>"; //ROW SCANS // recentkills // do X at a time $n = 0;
include "header.php"; $steamid = $_GET['steamid']; $ip = $_GET['ip']; $raceshort = $_GET['raceshort']; $game = $_GET['game']; $data1 = $_GET['data1']; //vic steamid $data2 = $_GET['data2']; //vic race $killerlvl = $_GET['killerlvl']; $victimlvl = $_GET['victimlvl']; $statsversion = @$_GET['statsversion']; $war3revision = @$_GET['war3revision']; $result = OCmysql_query("SELECT * FROM disabledservers WHERE ipport='{$ip}' and nostats='1' "); if (mysql_num_rows($result)) { die("success kill disabled"); } $result = OCmysql_query("INSERT INTO racedataeventsv2 SET steamid='{$steamid}' , ipport='{$ip}' , raceshort='{$raceshort}' , game='{$game}', event='kill' , data1='{$data1}' , data2='{$data2}',killerlvl='{$killerlvl}',victimlvl='{$victimlvl}' , processed='1'"); $result = OCmysql_query("INSERT INTO recentkills SET steamid='{$steamid}',raceshort='{$raceshort}',killerlvl='{$killerlvl}',ipport='{$ip}', game='{$game}', vicsteamid='{$data1}' , vicrace='{$data2}',viclvl='{$victimlvl}' , war3revision='{$war3revision}' , statsversion='{$statsversion}'"); $query = "INSERT INTO perplayerraceplaytimelongv2 SET steamid='{$steamid}' , raceshort='{$raceshort}' ON DUPLICATE KEY UPDATE kills=kills+1"; $result = OCmysql_query($query); $query = "INSERT INTO perplayerraceplaytimelongv2 SET steamid='{$data1}' , raceshort='{$data2}' ON DUPLICATE KEY UPDATE deaths=deaths+1"; $result = OCmysql_query($query); $query = "INSERT INTO agg_racekill_day SET raceshort='{$raceshort}', date=CURDATE() ON DUPLICATE KEY UPDATE "; $query .= "kills=kills+1"; $result = OCmysql_query($query); $query = "INSERT INTO agg_racekill_day SET raceshort='{$data2}', date=CURDATE() ON DUPLICATE KEY UPDATE "; $query .= "deaths=deaths+1"; $result = OCmysql_query($query); echo "success kill";