<?php
$connection = pg_connect (“host=116.203.141.130 dbname=web port=5436 user=ldelprete password=3gLcBe4AVuau”);
if (!$connection = pg_connect (“host=116.203.141.130 port=5436 dbname=web user=ldelprete password=3gLcBe4AVuau”)) {
$error = error_get_last();
echo “Connection failed. Error was: “. $error[‘message’]. “\n”;
} else {
echo “Connection succesful.\n”;
}
$host = ‘116.203.141.130’;
//$host = ‘plinivs.it’;
$ports = array(21, 22, 25, 80, 81, 3306, 4395, 5432, 5436);
foreach ($ports as $port)
{
$connection = @fsockopen($host, $port);
if (is_resource($connection))
{
echo ‘<h3>’ . $host . ‘:’ . $port . ‘ ‘ . ‘(‘ . getservbyport($port, ‘tcp’) . ‘) is open.</h3>’ . “\n”;
fclose($connection);
}
else
{
echo ‘<h3>’ . $host . ‘:’ . $port . ‘ is not responding.</h3>’ . “\n”;
}
}
?>