forked from HackedK/ProjectPUBG
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.php
More file actions
56 lines (43 loc) · 1.51 KB
/
Copy pathupdate.php
File metadata and controls
56 lines (43 loc) · 1.51 KB
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
56
<?php
//$server = "localhost";
//$username = "root";
//$password = "root";
//$db = "pubg";
require "config.php";
$conn = mysqli_connect($server, $username, $password, $db);
$file = "output.json";
$json = file_get_contents($file);
$data = json_decode($json, true);
$name = $data['playerName'];
$region = $data['region'];
$season = $data['season'];
$match = $data['match'];
$update = $data['lastUpdated'];
$rate = (int)$data['skillRating']['rating'];
$rounds = (int)$data['performance']['roundsPlayed'];
$wins = (int)$data['performance']['wins'];
$top10 = (int)$data['performance']['top10s'];
$kills = (int)$data['combat']['kills'];
$suidices = (int)$data['combat']['suicides'];
$teamkills = (int)$data['combat']['teamKills'];
$headshots = (int)$data['combat']['headshotsKills'];
$roadkills = (int)$data['combat']['roadKills'];
$assists = (int)$data['combat']['assists'];
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
function query_to_db($conn, $sql){
$result = mysqli_query($conn, $sql);
if ($result) {
echo "Your query was successful";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
}
$sql = "UPDATE mydb
SET `name`='$name', region='$region', season='$season', `match`='$match', `update`='$update', rate=$rate, rounds=$rounds,
wins=$wins, top10=$top10, kills=$kills, suicides=$suidices, teamkills=$teamkills, headshots=$headshots,
roadkills=$roadkills, assists=$assists";
query_to_db($conn, $sql);
mysqli_close($conn);
?>