Show server status using user input

altedeslego

New Member
you will have to excuse my PHP innocence but i have never formally studied that launguge and its been along time since HTML class.I have written this \[code\]<form><input type="text" name='address' /><input type="text" name='port' /></form><?php// Script by Akensai$ip = $_POST['address'];$port = $_POST['port'];if (!$socket = @fsockopen($ip, $port, $errno, $errstr, 30)){ echo "<font color='red'><strong>Offline!</strong></font>";}else { echo "<font color='green'><strong>Online!/strong></font>"; fclose($socket);}?>\[/code\]I am trying to achieve a user input for the address and port compare those values with the if statement to determine if essentially the address is ping-able if so the echo statements accordingly.If any of you fine programs could tell me if this will work or if not fix errors accordingly.My site is using word press and i am trying to add this PHP and HTML to a PHP widget, the widget wont load my code so ether 1. the widgets got some issue or 2. my code is of.Thanks for your timeBen
 
Back
Top