Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

Commit bfd8eff

Browse files
committedDec 16, 2019
Add files
0 parents  commit bfd8eff

6 files changed

+2144
-0
lines changed
 

‎Roboto-Medium.ttf

167 KB
Binary file not shown.

‎RussoOne-Regular.ttf

35.8 KB
Binary file not shown.

‎index.php

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?php
2+
header('Content-Type: image/png');
3+
4+
error_reporting(E_ALL);
5+
ini_set('display_errors', '1');
6+
7+
include('ogp.class.php');
8+
ob_clean(); // include above does somehow print a newline char, get rid of it to prevent image error
9+
10+
function error_img() {
11+
$im = imagecreatetruecolor(500, 122);
12+
13+
$red = imagecolorallocate($im, 230, 5, 5);
14+
$width = imagesx($im);
15+
$height = imagesy($im);
16+
17+
imagestring($im, 5, 230, 55, "ERROR", $red);
18+
19+
imagepng($im);
20+
21+
imagedestroy($im);
22+
23+
exit(0);
24+
}
25+
26+
if (!isset($_GET['ipv4'], $_GET['port'])) {
27+
error_img();
28+
}
29+
30+
if (filter_var($_GET['ipv4'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === FALSE) {
31+
error_img();
32+
}
33+
34+
$ip = $_GET['ipv4'];
35+
$port = intval($_GET['port']) - 1;
36+
37+
if ($port < 5 || $port > 65535) {
38+
error_img();
39+
}
40+
41+
$ogp = new OGP($ip, $port);
42+
43+
if (!$ogp->getStatus())
44+
{
45+
echo("OGP Error: " . $ogp->error);
46+
die();
47+
}
48+
49+
if (!isset($ogp->SERVERINFO['GameName']) ||
50+
!isset($ogp->SERVERINFO['ConnectPort']) ||
51+
!isset($ogp->SERVERINFO['SlotMax']) ||
52+
!isset($ogp->SERVERINFO['MODINFO']) ||
53+
!isset($ogp->SERVERINFO['MODINFO']['ModVersion']))
54+
{
55+
error_img();
56+
}
57+
58+
if ($ogp->SERVERINFO['GameName'] !== 'Horizon') {
59+
error_img();
60+
}
61+
62+
function stripBBCode($text_to_search) {
63+
$pattern = '|[[\/\!]*?[^\[\]]*?]|si';
64+
$replace = '';
65+
return preg_replace($pattern, $replace, $text_to_search);
66+
}
67+
68+
$hostname = $ogp->SERVERINFO['HostName'];
69+
//$hostname = preg_replace('/[?]/', '', $hostname);
70+
$hostname = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', stripBBCode(strip_tags($hostname)));
71+
//$hostname = iconv('UTF-8', 'ASCII//TRANSLIT', $hostname);
72+
73+
$im = imagecreatefrompng("sig02.png");
74+
75+
$blur = 5;
76+
77+
for ($i = 0; $i < $blur; $i++)
78+
{
79+
imagefilter($im, IMG_FILTER_GAUSSIAN_BLUR);
80+
}
81+
82+
$white = imagecolorallocate($im, 230, 230, 230);
83+
$width = imagesx($im);
84+
$height = imagesy($im);
85+
$font = 3;
86+
87+
imagettftext($im, 11, 0, 10, 30, $white, "./RussoOne-Regular.ttf", $hostname);
88+
89+
imagettftext($im, 11, 0, 10, 70, $white, "./Roboto-Medium.ttf", "Server IP:");
90+
imagettftext($im, 11, 0, 10, 90, $white, "./Roboto-Medium.ttf", $ip . ":" . $ogp->SERVERINFO['ConnectPort']);
91+
92+
imagettftext($im, 11, 0, 190, 70, $white, "./Roboto-Medium.ttf", "Players:");
93+
imagettftext($im, 11, 0, 190, 90, $white, "./Roboto-Medium.ttf", $ogp->SERVERINFO['PlayerCount'] . " / " . $ogp->SERVERINFO['SlotMax']);
94+
95+
imagettftext($im, 11, 0, 290, 70, $white, "./Roboto-Medium.ttf", "Web:");
96+
imagettftext($im, 11, 0, 290, 90, $white, "./Roboto-Medium.ttf", $ogp->SERVERINFO['MAPINFO']['MapURL']);
97+
98+
imagettftext($im, 9, 0, $width - 95, $height - 7, $white, "./RussoOne-Regular.ttf", "playonset.com");
99+
imagettftext($im, 5, 0, 10, $height - 7, $white, "./Roboto-Medium.ttf", "Version: " . $ogp->SERVERINFO['MODINFO']['ModVersion']);
100+
101+
imagepng($im);
102+
103+
imagecolordeallocate($im, $white);
104+
imagedestroy($im);
105+
106+
?>

‎licence.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
3+
4+
Permission to use, copy and distribute this source code and its documentation for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make:
5+
6+
1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
7+
2. You may use the source code in any application and distribute it in binary form
8+
3. You may modify the header files (*.h file(s)) to include the source code in your application
9+
4. You may modify the *.c file(s) for testing purpose
10+
5. If you want to use any modified *.c file(s) in your application you must ask the author. It is important that everybody keeps with the ogp specification otherwise the hole project is useless. In general we'll garant every modification that is ogp conform.
11+
12+
13+
LICENSED PRODUCT IS PROVIDED UNDER THIS LICENSE ON AN AS IS BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE LICENSED PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LICENSED PRODUCT IS WITH YOU. SHOULD LICENSED PRODUCT PROVE DEFECTIVE IN ANY RESPECT, YOU (AND NOT THE LICENSOR OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF LICENSED PRODUCT IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.

‎ogp.class.php

+2,025
Large diffs are not rendered by default.

‎sig02.png

89.8 KB
Loading

0 commit comments

Comments
 (0)
This repository has been archived.