Skip to content

Instantly share code, notes, and snippets.

@iGlitch
Created February 9, 2015 18:46
Show Gist options
  • Select an option

  • Save iGlitch/66877278d0c242cf8dea to your computer and use it in GitHub Desktop.

Select an option

Save iGlitch/66877278d0c242cf8dea to your computer and use it in GitHub Desktop.
IP <> Domain Lookup
<HTML><HEAD>
<META http-equiv="Content-Type" content="text/html;CHARSET=UTF-8">
<TITLE>IP-ドメイン変換</TITLE>
<style type="text/css">
<!--
body,input{ font-size: 12px;font-family:Verdana;}
.s{background-color:#e6e6ff;color:#000033;border: 1px #555555 solid; }
-->
</style>
</HEAD>
<BODY bgcolor="#ffffff" text="#101010">
<CENTER>
<TABLE width="500" border="0" cellpadding="3">
<TR>
<TD bgcolor="mistyrose" align=center>
<B><FONT size="+1" color="#000080">IP-ドメイン変換</FONT></B>
</TD></TR>
<TR>
<TD><br><FORM action="lookup2.php">
<P>IPアドレスから → ドメイン名変換<br>
IP Address <INPUT name="ip" size="30"><INPUT type="submit" value=" IP→ドメイン変換" class=s><br>
<P>ドメイン名から → IPアドレス変換<br>
Host Name <INPUT name="host" size="30"><INPUT type="submit" value="ドメイン→IP変換" class=s><br>
<P>バーチャルドメイン名から → サーバー名変換<br>
Virtual Host <INPUT name="vhost" size="30"><INPUT type="submit" value="サブドメイン解決" class=s>
</FORM><br><br><br>
<?php
echo "あなたのIP:{$_SERVER['REMOTE_ADDR']}<br><br>";
if($_GET['vhost']) $host = htmlspecialchars($_GET['vhost']);
if($_GET['host']) $host = htmlspecialchars($_GET['host']);
if($_GET['ip']) $ip = htmlspecialchars($_GET['ip']);
if($vhost) $host = $vhost;
if($host) $out = @gethostbyname($host);
if($vhost) $ip = $out;
if($ip) $out = @gethostbyaddr($ip);
echo "<big><b>$out</b></big>";
?>
</TD></TR>
</TABLE>
</CENTER>
</BODY></HTML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment