• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Check your server connection [ping, packet loss]

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,967
Solutions
99
Reaction score
3,383
Location
Poland
GitHub
gesior
It's like ping, but connect to server status port, not send ICMP.

First you must set in config.lua of your server:
PHP:
statusTimeout = 0
and /reload config
Then on your home PC create in www directory file and paste:
PHP:
<?PHP
echo 'Start<br />';
$c = 1000;
$d = 0;
$scp = 0;
$start = microtime(true);
$log = '';
for($s = 0; $s < $c; $s++)
{
	usleep(20000);
	$ut = microtime(true);
	$sock = @fsockopen("188.165.58.251", 7173, $errno, $errstr, 1);
	if ($sock)
	{
		$at = microtime(true);
		$ct = $at - $ut;
		$scp += $ct;
		if($ct > $max || !isset($max))
			$max = $ct;
		if($ct < $min || !isset($min))
			$min = $ct;
		fwrite($sock, chr(6).chr(0).chr(255).chr(255).'info'); 
		$data=''; 
		while (!feof($sock))
			$data .= fgets($sock, 1024);
		fclose($sock);
		$log .= 'ONLINE | Connected in <b>' . (round($ct, 5) * 1000) . '</b> ms<br />';
		$d++;
	}
	else
		$log .= 'OFF<br />';
}
echo 'Sent: <b>' . $c . '</b> | Answered: <b>' . $d . '</b> | Average: <b>' . (round(($scp / $d), 5) * 1000) . '</b> ms | Minimum: <b>' . (round($min, 5) * 1000) . '</b> ms | Maximum: <b>' . (round($max, 5) * 1000) . '</b> ms';
echo '<br />Test took <b>' . round(microtime(true) - $start, 2) . '</b> seconds.<br /><br />' . $log;
?>
Now change IP and port to your server IP and port and open website :)
It will show something like:
pingtest.png
 
There isn't really a use for this, is there?
Some of my VPSes for unknown reason droped few percent of ICMP, so I have written this script to test if everything is fine with server connection.
 
MySQL backup on external server

Script to download mysqldump result from server by PHP script.
On linux server in www directory create file
PHP:
backup.php
PHP:
<?PHP
$access_password = '';
$mysql_user = 'root';
$mysql_password = 'your_password';

if(!isset($_REQUEST['password']) || !isset($_REQUEST['database']))
	die('This script require password and database name. At end of URL to this script add: ?password=HERE_YOUR_PASSWORD&database=DATABASE_NAME_HERE');
if(empty($access_password))
	die('\$access_password cannot be empty, edit config in script.');
if(empty($_REQUEST['database']))
	die('Database name cannot be empty.');
if($_REQUEST['password'] != $access_password)
	die('Wrong password.');

$data = '';
exec('mysqldump -u ' . $mysql_user . ' -p' . $mysql_password . ' --databases ' . $_REQUEST['database'], $data);
echo implode(chr(10), $data);
?>
You must have mysql-client installed.
PHP:
apt-get install mysql-client
On your home PC or VPS/virtual server make in www directory file:
PHP:
<?PHP
$access_password = '';
$database_name = 'theforgottenserver';
$data = file_get_contents('http://your-dedic-domain.com/backup.php?database=' . $database_name . '&password=' . $access_password);
file_put_contents('backup_' . time() . '.sql', $data);
?>
Now configure CRON to execute this script every hour/day and you have auto backup on external server :)
 
Back
Top