- Download ZIP and extract or download via Composer:
composer require tltneon/lgsl
- Include
lgsl_class.php
and query data from server usinglgsl_query_live(protocol, ip, connect_port, query_port, software_port, flags)
function, where: protocol - server query protocol, ip - your server ip, connect_port - server connection port, query_port - server query port, software_port - server software port (mostly equal to 0), flags - "s" for main info, "e" for extra data and settings, "p" for players data.
Example of using LGSL:
<?php
include('lgsl/lgsl_files/lgsl_class.php');
$result = lgsl_query_live('urbanterror', '176.9.28.206', 27971, 27971, 0, "sep");
print_r($result); // there is will be an array of result of querying
?>
- Download stable version or latest commit. (*Note that commit can have any bugs)
- Backup your LGSL.
- Extract new LGSL into your LGSL folder with replacing (DO NOT replace lgsl_config.php)
3.1 Check out your lgsl_config.php and new one - there are can be several changes. - If everything is good - now you have most latest version of LGSL.
- In other cases just roll back to your backup version.
There are two ways you can enter the Admin panel: (Note that you need to install LGSL first)
- Just typing http://your_website/lgsl_folder/admin.php (For example: http://your_website/lgsl/admin.php)
- Clicking on the top right corner of the page. Cheers, you just found a hidden link, ha-ha.
- Set zone option to 1 at servers you need to show (at admin panel)
- Add code to your website:
<?php
$lgsl_zone_number = 1;
$output = "";
require "lgsl/lgsl_files/lgsl_zone.php"; // note: you need to check route to that file!
echo $output;
?>
- Open http://your_website/lgsl_files/lgsl_export.php
- Copy whereever you need and save.
Possible parameters:
- Print as JSON: http://your_website/lgsl_files/lgsl_export.php?json=1
- Print as XML: http://your_website/lgsl_files/lgsl_export.php?xml=1
- Download as txt file: http://your_website/lgsl_files/lgsl_export.php?download=1
- Only online: http://your_website/lgsl_files/lgsl_export.php?online=1
- Only enabled: http://your_website/lgsl_files/lgsl_export.php?nodisabled=1
- Sorting by ip or type: http://your_website/lgsl_files/lgsl_export.php?sort=ip
For example, you can export enabled servers sorted by type as xml: http://your_website/lgsl/lgsl_files/lgsl_export.php?xml=1&nodisabled=1&sort=type
If you have more than 20 servers in your list, and you need the server information to be more accurate as to current players and map information, then you can schedule updates.
Since LGSL updates when viewed, there has to be a limit on the update time otherwise the page would take a long time to load while it polls all the servers.
By scheduling the webserver to 'view' LGSL at regular intervals, the server information is cached ready for when a visitor views LGSL. Scheduling on webservers is known as a 'cron job'.
Setting up a cron differs between hosts, so you may need find out what method your host supports, but here are examples of cron commands that I have used in the past.
curl --compressed -s -o /dev/null http://*your_website*/lgsl/lgsl_files/lgsl_cron.php
wget -q -O /dev/null http://*your_website*/lgsl/lgsl_files/lgsl_cron.php
php -q /public_html/lgsl/lgsl_files/lgsl_cron.php
Before setting up the cron, its recommended that you view the lgsl_cron.php in your browser to make sure that there are no errors, and you can see how long it takes to update the servers.
First make sure the icons uploaded properly and that you can directly open them in your browser. If LGSL is looking for them in the wrong place, manually set the path to /lgsl_files/ in the LGSL_CONFIG.php remembering to include the trailing slash, for example:
$lgsl_config['url_path'] = "http://your_website/folder/gameservers/lgsl_files/";
Note that most of games builded on similar query protocols so they are grouped. Note that most of games builded on similar query protocols so they are grouped. To choose right game type, go to: https://github.com/tltneon/lgsl/wiki/Supported-Games,-Query-protocols,-Default-ports
Before you say that LGSL isn't works:
- Make sure your web hosting has open ports and allow to sending requests to game servers.
- Make sure you're entered right connection port and query port.
- Make sure your server is working now and also server's ports is opened.
- For some servers uses slightly different query port than connection port. Try to enter query port as "connection port + 1". For example: Connection port 27015, so you trying to enter Query port 27016. That often meets with Killing floor, Unturned and some other servers. Also check that page.
- Go to lgsl_config.php
- Find $lgsl_config['style'] = "breeze_style.css"; and replace at $lgsl_config['style'] = "darken_style.css"; for example.
You can find styles at /lgsl_files/styles/ folder.
- Go to lgsl_config.php
- Find include("languages/english.php"); at very end of file and replace at include("languages/russian.php"); for example.
You can find languages at /lgsl_files/languages/ folder.
And a few lines at file install.php
Can't find your language? Contribute us your translation with your native language!
(You can use Google Translate if you need)
You need to know CSS3 and use Developer Tools (e.g. DevTools into Mozilla Firefox).
- Make file your_file_name.css at /lgsl_files/styles/ folder.
- Change style in lgsl_config.php and now you have your own custom style of LGSL!
- All of map images stores at /lgsl_files/maps/
- Images should be only .png, .gif, .jpg
- Since LGSL v5.10.2 you can add images with various resolutions (but keep in mind that can affects on page loading speed)
For example, we have any CS:GO server with map de_dust2. So to add map image we need to look at game type, game name and map name. CS:GO has gametype "source", game name "csgo" and map name "de_dust2". After we get that we can upload map image called de_dust2.jpg into /lgsl_files/maps/source/csgo/ folder. If it isn't exists - just create! That's all! If you correctly made it default map image will be replaced with yours new. Watch in YouTube
Most common images you can download from here.
Mainly we need to help with finding bugs and to help to translate to any language.
Any your ideas (such as new style, game type, new feature) you can suggest to Issues page.
Also you can fork LGSL repository and give a star. Thanks!