<?php
/*Skrypt pochodzi z ksi±¿ki "PHP. 101 praktycznych skryptów"
  autor: Marcin Lis                    http://marcinlis.com*/
$ip = "";
$host = "";
if(isSet($_GET["host"]) && $_GET["host"] != ""){
  $host = $_GET["host"];
  $ip = gethostbyname($host);
}
$html_code = <<<CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<title>Uzyskanie adresu IP</title>
</head>
<body>
<form name = "formularz1"
      action = "skrypt.php"
      method = "get">
<table>
<tr>
<td>Nazwa hosta:</td>
<td>
<input type = "text"
       name = "host"
       value = "$host"></td>
</tr>
<tr>
<td>Odczytany adres IP:</td>
<td>
<input type = "text" 
       name = "ip" 
       value = "$ip"></td>
</tr>
<tr>
<td></td>
<td align = "left">
<input type = "submit" 
       style = "width:70px;"
       name = "wyslij"
       value = "OK">
</td>
</tr>
</table>
</form>
</body>
</html>
CODE;
echo("$html_code");
?>
