-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuser.php
380 lines (357 loc) · 15.4 KB
/
user.php
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<?php
require_once 'inc/func.php';
require_once 'inc/SteamUserFunctions.php';
$Time = new TimePlayers();
$id = fl($_GET['id']);
if ( !$id ) {
$url = $main['url'];
header("Location: $url");
}
$sql = DB::run('SELECT * FROM `csstats` WHERE `id` = ?', [$id]);
if ( $sql->rowCount() == 0 ) {
$url = $main['url'];
header("Location: $url");
}
$row = $sql->fetch(PDO::FETCH_ASSOC);
$kdratio = round($row['kills'] / ($row['deaths'] +1), 2);
// geoip
if ( $main['phpGeoip'] == 1 ) {
$country_code = mb_strtolower(geoip_country_code_by_name($row['ip']));
$country_name = geoip_country_name_by_name($row['ip']);
} else {
$json = file_get_contents('http://ip-api.com/json/'.$row['ip'].'?lang=us');
$array = json_decode($json, true);
$country_code = mb_strtolower($array['countryCode']);
$country_name = mb_strtolower($array['country']);
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<!-- Font Awesome Icons -->
<link rel="stylesheet" href="https://use.fontawesome.com/64ff6e1601.css">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap&subset=latin-ext" rel="stylesheet">
<!-- https://github.com/stanlemon/jGrowl -->
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.1/jquery.jgrowl.min.css" />
<!-- Main CSS -->
<link rel="stylesheet" href="<?=$main['url']?>template/css/main-fc.css">
<link rel="stylesheet" href="<?=$main['url']?>template/css/flag-icon.css">
<title><?=$row['name']?></title>
</head>
<body>
<div class="container">
<div class="row">
<nav class="navbar navbar-expand-md fixed-top navbar-dark bg-dark">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navBar1337" aria-controls="navBar1337" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navBar1337">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<span class="navbar-brand mb-0 h1"><i class="fa fa-bar-chart fa-1x" aria-hidden="true"></i> <?=$main['name']?></span>
<?php require 'menu.php';?>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" id="inputSearch" placeholder="Ник / SteamID / IP" aria-label="Search">
<button class="btn btn-warning my-2 my-sm-0" id="btnSearch" type="submit">Найти</button>
</form>
</div>
</nav>
</div>
<div id="searchResult"></div>
<div class="row mx-md-n1 mt-1" id="1">
<?php
// статус бана
if ( $main['userIconBan'] == 1 ) {
$ban = DB::run('SELECT `ban_reason`, `ban_created`, `ban_length`, `expired` FROM `amx_bans` WHERE `ban_length` != -1 AND `ban_length` != 1 AND `player_id` = ? OR `player_nick` = ?', [ $row['steamid'], $row['name'] ])->fetch(PDO::FETCH_ASSOC);
if ( $ban ) {
if ( $ban['ban_length'] == -1 ) {
$ban_status = '';
} elseif ( $ban['expired'] == 1 ) {
$ban_status = '';
} elseif ( $ban['ban_length'] == 0 ) {
$ban_status = 'навсегда';
echo '
<div class="col-md-12 px-md-1 py-md-1">
<div class="block" style="padding: 5px;background-color: #ffcbcb;">
<span class="fa-stack fa-lg">
<i class="fa fa-user-o fa-stack-1x"></i>
<i class="fa fa-ban fa-stack-2x text-danger"></i>
</span> Игрок забанен <b>'.$ban_status.'</b>. Причина <b>'.$ban['ban_reason'].'</b>
</div>
</div>
';
} elseif ( ($ban['ban_created'] + $ban['ban_length'] * 60) < time() ) {
$ban_status = '';
} else {
$ban_status = 'на ' . $ban['ban_length'] . ' мин.';
echo '
<div class="col-md-12 px-md-1 py-md-1">
<div class="block" style="padding: 5px;background-color: #ffcbcb;">
<span class="fa-stack fa-lg">
<i class="fa fa-user-o fa-stack-1x"></i>
<i class="fa fa-ban fa-stack-2x text-danger"></i>
</span> Игрок забанен <b>'.$ban_status.'</b>. Причина <b>'.$ban['ban_reason'].'</b>
</div>
</div>
';
}
}
}
?>
<div class="col-md-12 px-md-1 py-md-1">
<div class="block">
<div class="row">
<div class="col-md-6">
<?php
$steam1 = 'STEAM_0';
$steam2 = substr($row['steamid'], 0, 7);
if ( $steam1 == $steam2 )
{
$url = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=A4BA25A5FA6A9C74239A408079127082&steamids='.toCommunityID($row['steamid']);
$shit = file_get_contents($url);
$json = json_decode($shit);
$steam_url_ava = "<img src=\"{$json->response->players[0]->avatarfull}\" class='mr-3' style='width:60px;border-radius:3px;'>";
$steam_url = '<a href="https://steamcommunity.com/profiles/'.toCommunityID($row['steamid']).'" target="_blank">Профиль Steam</a>';
}
?>
<div class="media">
<!-- <img src="" class="mr-3"> -->
<?=@$steam_url_ava;?>
<div class="media-body">
<?php
// выводим иконку возле ника
if ( $main['userIcons'] == 1 ) {
$info = DB::run('SELECT * FROM `amx_amxadmins` WHERE `steamid` = ? OR `nickname` = ?', [ $row['steamid'], $row['name'] ])->fetch(PDO::FETCH_ASSOC);
if ( $info ) {
echo '<span style="position: relative;bottom: 2px;">'.userIcon($info['access']).'</span>';
}
}
?>
<b><?=$row['name'];?></b><br><?=@$steam_url;?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col text-right">
<span style="padding: 0 0 0 24px;">Первая игра <b><?=mb_substr($row['first_join'], 0, 10)?></b></span>
</div>
<div class="col text-left">
<span style="padding: 0 0 0 24px;">Последняя игра <b><?=mb_substr($row['last_join'], 0, 10)?></b></span>
</div>
</div>
</div>
</div>
<hr>
<span style="padding: 0 24px 0 0;">Килов <b><?=number_format($row['kills']);?></b></span>
<span style="padding: 0 24px 0 0;">В голову <b><?=number_format($row['hs']);?></b></span>
<span style="padding: 0 24px 0 0;">Смертей <b><?=number_format($row['deaths']);?></b></span>
<span style="padding: 0 24px 0 0;">Урон <b><?=number_format($row['dmg']);?></b></span>
<span style="padding: 0 24px 0 0;">Скилл <b><?=$row['skill'];?></b></span>
<span style="padding: 0 24px 0 0;">K/D <b><?=$kdratio;?></b></span>
</div>
</div>
</div>
<div class="row mx-md-n1" id="2">
<div class="col-md-6 px-md-1 py-md-1">
<div class="block">
<?php
$eff = floor((100 * $row['kills']) / ($row['kills'] + $row['deaths'])); // эффективность
$acc = floor(100 * $row['hits'] / $row['shots']); // точность
$hss = floor(100 * $row['hs'] / ($row['kills'] + $row['deaths'])); // эффективность в hs
?>
<div style="padding-bottom: 14px;">
Точность
<div class="progress">
<div class="progress-bar progress-bar-striped bg-success" role="progressbar" style="width: <?=$eff;?>%" aria-valuenow="<?=$eff;?>" aria-valuemin="0" aria-valuemax="100"><?=$eff;?>%</div>
</div>
</div>
<div style="padding-bottom: 14px;">
Эффективность
<div class="progress">
<div class="progress-bar progress-bar-striped" role="progressbar" style="width: <?=$acc;?>%" aria-valuenow="<?=$acc;?>%" aria-valuemin="0" aria-valuemax="100"><?=$acc;?>%</div>
</div>
</div>
<div style="padding-bottom: 14px;">
Эффективность в HS
<div class="progress">
<div class="progress-bar progress-bar-striped bg-info" role="progressbar" style="width: <?=$hss;?>%" aria-valuenow="<?=$hss;?>" aria-valuemin="0" aria-valuemax="100"><?=$hss;?>%</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 px-md-1 py-md-1">
<div class="block">
<div>
<div class="input-group mb-3" data-toggle="tooltip" data-placement="left" title="SteamID">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1" style="width: 50px;justify-content: center;"><i class="fa fa-steam"></i></span>
</div>
<input type="text" class="form-control" value="<?=$row['steamid']?>" aria-describedby="basic-addon1" disabled>
</div>
</div>
<div>
<div class="input-group mb-3" data-toggle="tooltip" data-placement="left" title="IP адрес">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1" style="width: 50px;justify-content: center;"><i class="fa fa-globe"></i></span>
</div>
<input type="text" class="form-control" value="<?=$row['ip']?>" aria-describedby="basic-addon1" disabled>
</div>
</div>
<div>
<div class="input-group mb-3" data-toggle="tooltip" data-placement="left" title="Страна">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1" style="width: 50px;justify-content: center;">
<span class="flag-icon flag-icon-<?=$country_code;?>"></span>
</span>
</div>
<input type="text" class="form-control" value="<?=$country_name;?>" aria-describedby="basic-addon1" disabled>
</div>
</div>
</div>
</div>
</div>
<?php if ( $stats_weapons == 1 || $stats_maps == 1 ) { ?>
<div class="row mx-md-n1" id="3">
<?php if ( $stats_weapons == 1 ) { ?>
<div class="col-md-6 px-md-1 py-md-1">
<div class="block">
<h5>Топ 3 оружия</h5>
<?php
$w_id = $row['id'];
$weapons = DB::run('SELECT `player_id`, `weapon`, `kills`, `deaths`, `dmg`, `hits` FROM `csstats_weapons` WHERE `player_id` = ? ORDER BY `kills` DESC LIMIT 3', [ $w_id ]);
$w_count = $weapons->rowCount();
if ( $w_count > 0 ) {
$weapons = $weapons->FetchAll(PDO::FETCH_ASSOC);
foreach ($weapons as $r) {
echo '<div class="media">';
echo '<img src="w_img/'.$r['weapon'].'.png" title="'.$r['weapon'].'" class="circle_weapons mr-3">';
echo '<div class="media-body">';
echo 'Название <b>' . $r['weapon'] . '</b></br>';
echo 'Килов <b>' . number_format($r['kills']) . '</b></br>';
echo 'Смертей <b>' . number_format($r['deaths']) . '</b></br>';
echo 'Урон <b>' . number_format($r['dmg']) . '</b><br>';
echo 'Попаданий <b>' . number_format($r['hits']) . '</b>';
echo '</div>';
echo '</div><hr>';
}
} else {
echo '<div class="orange_alert">Нет информации</div>';
}
?>
</div>
</div>
<?php } ?>
<?php if ( $stats_maps == 1 ) { ?>
<div class="col-md-6 px-md-1 py-md-1">
<div class="block">
<h5>Топ 3 карты</h5>
<?php
$m_id = $row['id'];
$maps = DB::run('SELECT `player_id`, `map`, `kills`, `deaths`, `dmg`, `connection_time` FROM `csstats_maps` WHERE `player_id` = ? GROUP BY `map` ORDER BY `connection_time` DESC LIMIT 3', [ $m_id ]);
$m_count = $maps->rowCount();
if ( $m_count > 0 ) {
$maps = $maps->FetchAll(PDO::FETCH_ASSOC);
foreach ($maps as $r) {
// map images
$url = 'https://image.gametracker.com/images/maps/160x120/cs/'.$r['map'].'.jpg';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.4");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$output = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
//echo $httpcode;
$mapimage = ( $httpcode == 200 ) ? $url : 'https://image.gametracker.com/images/maps/160x120/nomap.jpg';
echo '<div class="media">';
echo '<img src="'.$mapimage.'" class="rounded mr-3">';
echo '<div class="media-body">';
echo 'Название <b>' . $r['map'] . '</b></br>';
echo 'Всего килов <b>' . number_format($r['kills']) . '</b></br>';
echo 'Всего смертей <b>' . number_format($r['deaths']) . '</b></br>';
echo 'Нанес урона <b>' . number_format($r['dmg']) . '</b></br>';
echo 'Играл на карте <b>' . $Time->TimeOn($r['connection_time']) . '</b>';
echo '</div>';
echo '</div><hr>';
}
} else {
echo '<div class="orange_alert">Нет информации</div>';
}
?>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<!-- JavaScript -->
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<!-- JS -->
<script type="text/javascript">
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
<!-- search -->
<!-- https://github.com/stanlemon/jGrowl -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.1/jquery.jgrowl.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#btnSearch').on('click', function(){
var search = $('#inputSearch').val().trim();
if ( search == '' ) {
//mess();
$.jGrowl('Запрос не может быть пустым', {
theme: 'bg-danger',
position: 'bottom-right',
life: '3000'
});
return false;
}
if ( search.length < 3 ) {
//mess();
$.jGrowl('Запрос должен быть больше чем 2 символа', {
theme: 'bg-danger',
position: 'bottom-right',
life: '3000'
});
return false;
}
$.ajax({
url: 'inc/js_stats_search.php',
type: 'POST',
cache: false,
data: { 'search':search },
dataType: 'html',
beforeSend: function() {
$('#btnSearch').prop('disabled', true);
},
success: function(data) {
$("#1").remove();
$("#2").remove();
$("#3").remove();
$("#searchResult").html(data);
$('#btnSearch').prop('disabled', false);
},
error: function() {
alert('ajax error. js_stats_search');
$('#btnSearch').prop('disabled', false);
}
});
});
});
</script>
</body>
</html>