Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Access-Control-Allow-Origin: *');
- header('Access-Control-Allow-Methods: GET, POST');
- if(!isset($_REQUEST['usernick'])) { http_response_code(404); die; }
- if(!isset($_REQUEST['type'])) { http_response_code(404); die; }
- mysql_connect("localhost", "roydl7", "lolwtf");
- mysql_select_db("exmv6");
- $user = mysql_real_escape_string($_REQUEST['usernick']);
- $type = $_REQUEST['type'];
- $queryResult = mysql_query("SELECT playerAccID, playerAccountDisabled, playerNick, playerAdminLevel, playerLastFPS, playerLastCountry FROM `exm_player_acc_data` WHERE `playerNick` = '$user'");
- if(mysql_num_rows($queryResult) == 0) { http_response_code(404); die; }
- $queryResult = mysql_fetch_row($queryResult);
- $playerAccData = array();
- $playerAccData['accountid'] = $queryResult[0];
- $playerAccData['accountstatus'] = intval($queryResult[1]) == 0 ? "Enabled" : "Disabled";
- $playerAccData['username'] = $queryResult[2];
- $playerAccData['level'] = $queryResult[3];
- $playerAccData['fps'] = $queryResult[4];
- $playerAccData['country'] = $queryResult[5];
- switch($type)
- {
- case "account" : echo json_encode($playerAccData);
- break;
- case "basic" : {
- $queryResult = mysql_query("SELECT `kills` , `deaths` , `timePlayed` , `missionsPassed` , `missionsFailed` , `cash` , `points` , `rank` , `reactionTestWin`, `splDel` as specialDeliveries , `hs` as headshots, `hsd` as bestHeadshotDistance, `sT` shotsOnTarget, `sM` as shotsMissed, sT+sM as shotsFired FROM `exm_player_sts_data` WHERE `accID` = '" . $playerAccData['accountid'] . "'");
- $queryResult = mysql_fetch_assoc($queryResult);
- echo json_encode($queryResult);
- break;
- }
- case "mission" : {
- $queryResult = mysql_query("SELECT `fixes` , `lcps` , `race1` as 1stPos, `race2` as 2ndPos, `race3` as 3rdPos, `racef` as racesFinished, `racet` as raceObjectsSpawned, `surviveNoRes` as survivedNoRespawn, `cpCap` as checkpointsCaptured , `cpBomb` as checkpointsBombed, `vehSteal` as vehiclesStolen, `adminKills` as adminsKilled, `reactionTestWin` as reactionTestsWon, `recordsBroken` , `gunGameWins` , `flags` , `sumot` as sumoTime , `sumow` as sumoWins , `dmwin` as dmWins, `leaderkills` , `trcp` as teamRaceCheckpoints FROM `exm_player_sts_data` WHERE `accID` = '" . $playerAccData['accountid'] . "'");
- $queryResult = mysql_fetch_assoc($queryResult);
- echo json_encode($queryResult);
- break;
- }
- case "weapons" : {
- $queryResult = mysql_query("SELECT `0` , `1` , `2` , `3` , `4` , `5` , `6` , `7` , `8` , `9` , `10` , `11` , `12` , `13` , `14` , `15` , `16` , `17` , `18` , `19` , `20` , `21` , `22` , `23` , `24` , `25` , `26` , `27` , `28` , `29` , `30` , `31` , `32` , `33` , `34` , `35` , `36` , `37` , `38` , `39` , `40` , `41` , `42` , `43` , `44` , `45` , `46` , `47` , `48` , `49` , `50` , `51` , `52` , `53` , `54` , `55`, `seaSpr` as SeaSparrow, (`sT`/(`sT`+`sM`))*100 as accuracy FROM `exm_player_sts_data` WHERE `accID` = '" . $playerAccData['accountid'] . "'");
- $queryResult = mysql_fetch_assoc($queryResult);
- echo json_encode($queryResult);
- break;
- }
- default: { http_response_code(404); }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement