Skip to content

Commit

Permalink
LGSL 6.1.0 Added server tracking (history of past 24 hours); Improved…
Browse files Browse the repository at this point in the history
… Discord querying; Added RedM support #44; FiveM now using http querying (for #43); Added Flag-icon script (for #38); Fixed Source protocol (added tags as extras and fixing Rust for 256 or more players)
  • Loading branch information
tltneon committed Jun 18, 2021
1 parent 419f1c1 commit 796d9df
Show file tree
Hide file tree
Showing 34 changed files with 376 additions and 150 deletions.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/tltneon/lgsl?color=green&style=for-the-badge)](https://github.com/tltneon/lgsl/releases)
![PHP](https://img.shields.io/badge/PHP-5.4--8.0-brightgreen?style=for-the-badge&logo=php)
![PHP](https://img.shields.io/badge/PHP-5.4--8.1.0-brightgreen?style=for-the-badge&logo=php)
![MySQL](https://img.shields.io/badge/MySQL-5.5.27--8.0.x-brightgreen?style=for-the-badge&logo=mysql)
![MariaDB](https://img.shields.io/badge/MariaDB-5.5--10.5.x-brightgreen?style=for-the-badge&logo=mariadb)
![MariaDB](https://img.shields.io/badge/MariaDB-5.5--10.6.x-brightgreen?style=for-the-badge&logo=mariadb)

[![GitHub followers](https://img.shields.io/github/followers/tltneon?style=for-the-badge)](https://github.com/tltneon?tab=followers)
[![GitHub stars](https://img.shields.io/github/stars/tltneon/lgsl?style=for-the-badge)](https://github.com/tltneon/lgsl/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/tltneon/lgsl?style=for-the-badge)](https://github.com/tltneon/lgsl/fork)
[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/tltneon/lgsl?style=for-the-badge)](https://github.com/tltneon/lgsl/archive/master.zip)
[![Packagist](https://img.shields.io/packagist/l/tltneon/lgsl?style=for-the-badge)](https://github.com/tltneon/lgsl/blob/master/LICENSE)
# LGSL v6.0.1 (Live Game Server List) for PHP 7+
Based-off LGSL v5.8 (stand-alone version) from www.greycube.com. This is almost original version of LGSL with [new features](https://github.com/tltneon/lgsl#changelog) and working on PHP 5.4-8.x and MySQL 5.5.27-8.0.x or MariaDB 5.5-10.5.x
# LGSL v6.1.0 (Live Game Server List)
Based-off LGSL v5.8 (stand-alone version) from www.greycube.com. This is almost original version of LGSL with [new features](https://github.com/tltneon/lgsl#changelog) and working on PHP 5.4-8.x and MySQL 5.5.27-8.0.x or MariaDB 5.5-10.6.x. May be upgraded from LGSL 5.8 and older.

## [Live Demos](http://lgsl-demo.freesite.vip/) | [Wiki](https://github.com/tltneon/lgsl/wiki) | [How to install]( https://github.com/tltneon/lgsl/wiki/How-to-install-LGSL) | [Supported games](https://github.com/tltneon/lgsl/wiki/Supported-Games) | [Custom styles](https://github.com/tltneon/lgsl/wiki/Styles)
## [Live Demos](http://lgsl-demo.freesite.vip/) | [Wiki](https://github.com/tltneon/lgsl/wiki) | [How to install]( https://github.com/tltneon/lgsl/wiki/How-to-install-LGSL) | [Supported games](https://github.com/tltneon/lgsl/wiki/Supported-Games,-Query-protocols,-Default-ports) | [Custom styles](https://github.com/tltneon/lgsl/wiki/Styles)

Feel free to make [pull request](https://github.com/tltneon/lgsl) with your custom styles or languages! Also you can suggest any [features](https://github.com/tltneon/lgsl/issues).

Expand All @@ -21,6 +21,14 @@ Feel free to make [pull request](https://github.com/tltneon/lgsl) with your cust
![lgsl Server List on mobile device](https://i.imgur.com/oui8Nya.png)

## [Changelog](https://github.com/tltneon/lgsl/wiki/Changelog)
#### v6.1.0
- **LGSL now has native history chart: records server status and players count at last 24 hours**
- **Available Flag-icon script: replacing standard icons to svg from flag-icon-css**
- **Available Refresh script: refresh server's data in details page without reloading**
- **Added RedM support**
- **New game icons**
- **Minor fixes**
- *Tested on PHP 8.1.0-dev
#### v6.0.1
- **New Style: Cards** [[Live Demo](http://lgsl-demo.freesite.vip/lgsl9/index.php)]
- **Selecting active scripts on install page**
Expand All @@ -33,7 +41,7 @@ Feel free to make [pull request](https://github.com/tltneon/lgsl) with your cust
- **Game icon now is a link to show all server of that game**
- **Admin panel: now you can add ip with port to ip input (LGSL split after ':' automatically)**
- **Now servers shows timestamps of last querying**
- **Added Arabic languages**
- **Added Arabic language**
- *Thanks to [@lamjed001](https://github.com/lamjed001)*
- **Updated all styles**
#### v5.10.3
Expand Down Expand Up @@ -63,12 +71,6 @@ Feel free to make [pull request](https://github.com/tltneon/lgsl) with your cust
- **Added installation script** [[How to install LGSL](https://github.com/tltneon/lgsl/wiki/How-to-install-LGSL)]
- **Styles now has better view on mobile devices**
- **Most popular game icons changed to 64x64 resolution**
#### v5.9.6
- **Added Parallax Style** [[Live Demo](http://lgsl-demo.freesite.vip/lgsl5/index.php)]
- **Added German languages**
- *Thanks to [@ctannurella](https://github.com/ctannurella)*
- **Default style was changed to: Darken**
- **Added support to including js files in _lgsl_config.php_**

##### [:: Older versions](https://github.com/tltneon/lgsl/wiki/Changelog)

Expand Down
77 changes: 77 additions & 0 deletions charts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
header("Content-Type: image/png");
require "lgsl_files/lgsl_class.php";
$lookup = lgsl_lookup_id($_GET['s']);
$server = lgsl_query_cached($lookup['type'], $lookup['ip'], $lookup['c_port'], $lookup['q_port'], $lookup['s_port'], "s");
$server['s']['playersmax'] = $server['s']['playersmax'] > 0 ? $server['s']['playersmax'] : 1;

// SETTINGS

$w = 400;
$h = 150;
$im = @imagecreate($w, $h);
$white = imagecolorallocate($im, 255, 255, 255);
$gray = imagecolorallocate($im, 225, 225, 225);
$black = imagecolorallocate($im, 0, 0, 0);
$green = imagecolorallocate($im, 20, 255, 0);
$red = imagecolorallocate($im, 255, 0, 0);
$x0 = 30;
$y0 = 20;
$xStep = 30;
$yStep = 30;
$period = 60 * 60 * 24; // 1 day

//

$s = array();
$x = array();
$y = array();
foreach($server['s']['history'] as $key){
array_push($s, $key['status']);
array_push($x, $key['time'] - time() + $period);
array_push($y, $key['players']);
}

$maxX = $w - $x0;
$maxY = $h - $y0;
$scaleX = ($maxX-$x0) / max($x);
$scaleY = ($maxY-$y0) / $server['s']['playersmax'];

// DRAW AXIS

imageline($im, $x0, $maxY, $maxX, $maxY, $black);
imageline($im, $x0, $y0, $x0, $maxY, $black);

// DRAW GRID

$xSteps = ($maxX-$x0) / $xStep-1;
$ySteps = ($maxY-$y0) / $yStep-1;
for($i=1; $i < $xSteps+1; $i++){
imageline($im, $x0+$xStep*$i, $y0, $x0+$xStep*$i, $maxY-1, $gray);
$str = Date("H:i", time() - $period + (int)($i * round($xStep/$scaleX, 1)));
imagestring($im, 1, (($x0+$xStep*$i) - 6), $maxY+2, $str, $black);
}

for($i=1; $i < $ySteps+1; $i++){
imageline($im, $x0+1, $maxY-$yStep*$i, $maxX, $maxY-$yStep*$i, $gray);
imagestring($im, 1, 3, ($maxY-$yStep*$i)-3, (int)($i * round($yStep/$scaleY, 1) ), $black);
}

// DRAW GRAPH

for($i=1; $i < count($x); $i++) {
if($s[$i-1]) {
imageline($im, (int) ($x0+$x[$i-1]*$scaleX), (int) ($maxY-$y[$i-1]*$scaleY), (int) ($x0+$x[$i]*$scaleX), (int) ($maxY-$y[$i]*$scaleY), $green);
}
else {
imagefilledellipse($im, (int) ($x0+$x[$i]*$scaleX), (int) ($maxY-$y[$i]*$scaleY), 4, 4, $red);
}
}

imagestring($im, 1, 10, 0, "Server: " . trim ($server['s']['name']), $black);
imagestring($im, 1, 9, 10, "IP: " . ($lookup['type'] == 'discord' ? $lookup['ip'] : $lookup['ip'].':'.$lookup['c_port']), $black);
imagestring($im, 1, $w - 80, 10, "Date: " . Date("d.m.y", time()), $black);

imagepng($im);
imagedestroy($im);
?>
32 changes: 23 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
"name": "tltneon/lgsl",
"description": "PHP library retrieve game servers status from various types of games.",
"homepage": "https://github.com/tltneon/lgsl",
"type": "project",
"type": "library",
"license": "GPL-3.0-only",
"keywords":
[
"gameserver",
"query",
"discord",
"fivem",
"csgo",
"counter-strike",
"team fortress",
"minecraft",
"cs",
"gmod",
"rust",
"dayz",
"ark",
"samp",
"minecraft"
"samp"
],
"authors": [
{
Expand All @@ -32,19 +32,33 @@
],
"support": {
"wiki": "https://github.com/tltneon/lgsl/wiki",
"games": "https://github.com/tltneon/lgsl/wiki/Supported-Games",
"forum": "https://github.com/tltneon/lgsl/discussions",
"source": "https://github.com/tltneon/lgsl",
"issues": "https://github.com/tltneon/lgsl/issues"
},
"funding": [
{
"type": "patreon",
"url": "https://www.patreon.com/user?u=22162275&fan_landing=true"
}
],
"require":
{
"php": ">=5.4"
"php": ">=5.4",
"ext-mysqli": "*",
"ext-bz2": "*",
"ext-curl": "*"
},
"suggest":
{
"ext-gd": "*",
"ext-mbstring": "*"
},
"autoload":
{
"psr-4":
{
"tltneon\\lgsl\\": "lgsl/"
"lgsl\\": "lgsl/lgsl_files/lgsl_class.php"
}
}
}
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<meta http-equiv='content-style-type' content='text/css' />
<link rel='stylesheet' href='lgsl_files/styles/<?php echo $lgsl_config['style']; ?>' type='text/css' />
<?php echo ($lgsl_config['autoreload'] ? "<META HTTP-EQUIV='REFRESH' CONTENT=" . $lgsl_config['cache_time'] + 1 . " />" : ""); ?>
<?php echo ($lgsl_config['autoreload'] ? "<META HTTP-EQUIV='REFRESH' CONTENT=" . ($lgsl_config['cache_time'] + 1) . " />" : ""); ?>
</head>

<body>
Expand Down
53 changes: 40 additions & 13 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
}
else {
try {
mysqli_report(MYSQLI_REPORT_ERROR);
$lgsl_database = mysqli_connect($mysql_server, $mysql_user, $mysql_password);

if (!$lgsl_database) {
Expand Down Expand Up @@ -56,17 +57,35 @@
}
}
}
if(isset($_GET['test_udp'])){
$fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr, 3);
if (!$fp) {
echo "ERROR: $errno - $errstr<br />\n";
echo "<l k='coutd'></l>\n";
} else {
fwrite($fp, "\n");
echo fread($fp, 26);
echo "<l k='consu'></l>";
fclose($fp);
}
if(isset($_GET['test'])){
if(function_exists("fsockopen")){
$fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr, 3);
if (!$fp) {
echo "ERROR: $errno - $errstr<br />\n";
echo "<l k='coutd'></l>\n";
} else {
fwrite($fp, "\n");
echo "<l k='consu'></l>\n";
fclose($fp);
}
}
else {
echo("FSOCKOPEN: FAILED\n");
}

if(function_exists("curl_init") && function_exists("curl_setopt") && function_exists("curl_exec")){
echo("CURL: SUCCESS\n");
}
else{
echo("CURL: FAILED\n");
}

if(function_exists("bzdecompress")){
echo("BZ2: SUCCESS\n");
}
else{
echo("BZ2: FAILED\n");
}
}

?>
Expand Down Expand Up @@ -130,7 +149,7 @@
//------------------------------------------------------------------------------------------------------------+

$output = '
<h6><a href="./"><l k="back"></l></a> | <a href="?test_udp">Test UDP</a></h6>
<h6><a href="./"><l k="back"></l></a> | <a href="?test">Check requirements</a></h6>
<h5><a href="https://github.com/tltneon/lgsl/wiki/How-to-install-LGSL" target="_blank"><l k="owiki"></l></a></h5>
<h4><l k="step1"></l></h4>
<form method="post" action="?">
Expand Down Expand Up @@ -209,9 +228,11 @@
</p>
<p>
<l k="selsc"></l>:
<l k="selsc"></l> <a href="https://github.com/tltneon/lgsl/wiki/scripts" target="_blank" class="hinfolink">?</a>:
<br /><input type="checkbox" id="parallax.js" name="scripts" onChange="changeCheckbox(event)" /> parallax (for Parallax Style)
<br /><input type="checkbox" id="preview.js" name="scripts" onChange="changeCheckbox(event)" /> map preview (on server list)
<br /><input type="checkbox" id="refresh.js" name="scripts" onChange="changeCheckbox(event)" /> refresh (manually refresh server status)
<br /><input type="checkbox" id="flag-icon.js" name="scripts" onChange="changeCheckbox(event)" /> flag-icon (replacing with svg)
</p>
<hr />
Expand Down Expand Up @@ -251,6 +272,10 @@
Time before a server needs updating:
<input type="number" min="0" max="3600" value="60" onChange="vars.cache_time = event.target.value" />
</p>
<p>
Enable server tracking (history):
<input type="checkbox" name="history" onChange="changeCheckbox(event)" />
</p>
<p>
<l k="hideo"></l>:
<input type="checkbox" name="hide_offline" onChange="changeCheckbox(event)" />
Expand Down Expand Up @@ -325,6 +350,7 @@ function reloadLocale(){
page_mod: false,
page_lim: 15,
autoreload: false,
history: false,
cache_time: 60,
hide_offline: false,
public_add: false,
Expand Down Expand Up @@ -446,6 +472,7 @@ function generateConfig()
"$lgsl_config['public_feed'] = 0; // 1=feed requests can add new servers to your list \n" +
"$lgsl_config['cache_time'] = "+ vars.cache_time +"; // seconds=time before a server needs updating \n" +
"$lgsl_config['autoreload'] = "+ vars.autoreload +"; // 1=reloads page when cache_time is passed \n" +
"$lgsl_config['history'] = "+ vars.history +"; // 1=reloads page when cache_time is passed \n" +
"$lgsl_config['live_time'] = 3; // seconds=time allowed for updating servers per page load \n" +
"$lgsl_config['timeout'] = 0; // 1=gives more time for servers to respond but adds loading delay \n" +
"$lgsl_config['retry_offline'] = 0; // 1=repeats query when there is no response but adds loading delay \n" +
Expand Down
Binary file added lgsl_files/icons/fivem/redm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions lgsl_files/languages/arabic.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
$lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "رجوع إلى قائمة الخوادم";
$lgsl_config['text']['mpg'] = "إلى الصفحة الرئيسية";
/* admin section */
Expand Down
1 change: 1 addition & 0 deletions lgsl_files/languages/bulgarian.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
$lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "ОБРАТНО КЪМ СПИСЪКА НА СЪРВЪРИТЕ";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
Expand Down
1 change: 1 addition & 0 deletions lgsl_files/languages/czech.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
$lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "ZPĚT NA SEZNAM SLUŽEB";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
Expand Down
1 change: 1 addition & 0 deletions lgsl_files/languages/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
$lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "BACK TO SERVERS LIST";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
Expand Down
1 change: 1 addition & 0 deletions lgsl_files/languages/french.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
$lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "RETOUR À LA LISTE DES SERVEURS";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
Expand Down
1 change: 1 addition & 0 deletions lgsl_files/languages/german.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
$lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "ZURÜCK ZUR SERVERLISTE";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
Expand Down
1 change: 1 addition & 0 deletions lgsl_files/languages/russian.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
$lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "Вернуться к списку серверов";
$lgsl_config['text']['mpg'] = "На главную";
/* admin section */
Expand Down
1 change: 1 addition & 0 deletions lgsl_files/languages/slovak.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
$lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "Spať na zoznam Serverov";
$lgsl_config['text']['mpg'] = "NA HLAVNÚ STRÁNKU";
/* admin section */
Expand Down
1 change: 1 addition & 0 deletions lgsl_files/languages/spanish.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
$lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "BACK TO SERVERS LIST";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
Expand Down
2 changes: 1 addition & 1 deletion lgsl_files/lgsl_admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@

$output .= "
<tr>
<td>NEW<a href='https://github.com/tltneon/lgsl/wiki/Supported-Games' target='_blank' style='position: absolute;background: #fff;border-radius: 10px;width: 14px;height: 14px;border: 2px solid;margin-top: 7px;' title='How to choose query protocol?'>?</a></td>
<td>NEW<a href='https://github.com/tltneon/lgsl/wiki/Supported-Games,-Query-protocols,-Default-ports' target='_blank' style='position: absolute;background: #fff;border-radius: 10px;width: 14px;height: 14px;border: 2px solid;margin-top: 7px;' title='How to choose query protocol?'>?</a></td>
<td>
<select name='form_type[{$id}]'>";
//---------------------------------------------------------+
Expand Down
Loading

0 comments on commit 796d9df

Please # to comment.