Hey guys i have this status checker which was working but it aint working now i dont know why can you guys fix it for me here its:

also here is a link to the site and below is the code:

http://new-legacy.zxq.net/status%20checker.php

Code:
<form action="" method="post">
IP:<input style=" font-size: 15px; width:200px;" name="ip" type="text" title="Type the IP in Here"/><br>
Port:<input name="port" type="text" style=" font-size: 15px; width:100px;" title="Type the Port in Here"/><br>
<input style=" font-size: 20px; width:70px; height:30;" type="submit" name="submit"/>
</form>
<?php

if(isset($_POST['submit'])) {
$ip = $_POST['ip'];
$port = $_POST['port'];

if(!$sock=@fsockopen($ip, $port, $num, $error, 30)) {
  echo "offline";
  
} else {

  echo "Online";
  
  fclose($socket);
}
}
?>