You haven’t put quotes around the HTML attributes on this line:
$out = "<input size=15 value=$ip onfocus="this.select()">
It needs to be:
$out = "<input size="15" value="$ip" onfocus="this.select()">
You haven’t put quotes around the HTML attributes on this line:
$out = "<input size=15 value=$ip onfocus="this.select()">
It needs to be:
$out = "<input size="15" value="$ip" onfocus="this.select()">