/ Published in: PHP
Pulls info from the database to check if a specific port is open or service is online on a server.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function statusCheck() { global $MySQLi; $query = "SELECT * FROM status_ports WHERE hidden = '0'"; $commit = $MySQLi->query($query); if($commit == false) { } else { while($row = $commit->fetch_assoc()) { $svcs[$row['name']] = $row['port']; $hosts[$row['name']] = $row['host']; } foreach ($svcs as $service=>$port) { $report[$service] = $this->check_port($hosts[$service], $port); } return $report; } } function check_port($host = '', $port = '') { if ($conn) { return true; } else { return "0"; } }