Jump to content


Photo

Ip Para Host E Host Para Ip


  • Faça o login para participar
4 replies to this topic

#1 Paulo Freitas

Paulo Freitas

    ××××××× LRU #456504 ××××××× ××××××× LRM #364686 ×××××××

  • Ex-Admins
  • 5612 posts
  • Sexo:Masculino
  • Localidade:Campinas - SP

Posted 20/03/2005, 12:32

Olá pessoal! ;)

Segue aí um script para resolver IP para HOST e HOST para IP... B)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR...l1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt-br" lang="pt-br">

<head>
<title>IP para HOST para IP</title>
<style>
<!--
.caixa {
width:300px;
margin-bottom:30px;
padding:5px 5px 4px 5px;
border:1px solid #DDD;
background:#EEE;
text-align:left;
}
.titulo {
font-family:Verdana;
padding:2px 5px 2px 5px;
font-size:9pt;
font-weight:bold;
border:1px solid #DDD;
background:#FFF;
}
.conteudo {
padding:2px 5px 2px 5px;
font-size:8pt;
font-family:Verdana;
border:#DDD 1px solid;
border-top:0px;
}
input {
font-family:Verdana;
font-size:8pt;
background-color:#EEE;
border:#DDD 1px solid;
}
a {
font-family:Verdana;
font-size:8pt;
font-weight:bold;
text-decoration:none;
color:green;
//-->
</style>
</head>

<body>

<?
function Alerta($titulo,$msg){
echo "<div class=\"caixa\">
<div class=\"titulo\">".$titulo."</div>
<div class=\"conteudo\">".$msg."</div>
</div>";
}
?>


<?
$porta="80";
if ($HTTP_POST_VARS["submit_ip"] && $HTTP_POST_VARS["endereco_ip"])
{
$host=gethostbyaddr($HTTP_POST_VARS["endereco_ip"]);
if ($host==$HTTP_POST_VARS["endereco_ip"])
Alerta("Erro","O endereço IP não é valido ou o host não foi encontrado");
else
Alerta("Resultado","O host de <u>".$HTTP_POST_VARS["endereco_ip"]."</u> é: </u> <strong>".$host."</strong>");
if (!$fp1=@fsockopen($HTTP_POST_VARS["endereco_ip"],$porta,$erro_numero,$erro,30))
Alerta("Informação","Situação: <strong>Offline</strong>");
else
Alerta("Informação","Situação: <strong>Online</strong>");
echo "<a href=\"#\" onclick=\"history.go(-1);\">Voltar</a>";
exit;
}
elseif ($HTTP_POST_VARS["submit_host"] && $HTTP_POST_VARS["host"])
{
$endereco_ip=gethostbyname($HTTP_POST_VARS["host"]);
if ($endereco_ip==$HTTP_POST_VARS["host"])
Alerta("Erro","O host não é válido ou o endereço IP não foi encontrado");
else
Alerta("Resultado","O IP do domínio <u>".$HTTP_POST_VARS["host"]."</u> é: <strong>".$endereco_ip."</strong>");
if (!$fp1=@fsockopen($endereco_ip,$porta,$erro_numero,$erro,30))
Alerta("Informação","Situação: <strong>Offline</strong>");
else
Alerta("Informação","Situação: <strong>Online</strong>");
exit;
}
if ($HTTP_POST_VARS["submit_host"] || $HTTP_POST_VARS["submit_ip"])
Alerta("Erro","Digite o \"Endereço IP\" ou \"Host\".");
echo "
<form method=\"post\" action=\"$PHP_SELF\">
<div class=\"caixa\">
<div class=\"titulo\">IP para HOST</div>
<div class=\"conteudo\">
<strong>Endereço IP:</strong>
<input type=\"text\" name=\"endereco_ip\" size=\"15\">
<input type=\"submit\" name=\"submit_ip\"value=\"Resolver\">
</div>
<br />
<div class=\"titulo\">HOST para IP</div>
<div class=\"conteudo\">
<strong>Host:</strong> http://
<input type=\"text\" name=\"host\" size=\"15\">
<input type=\"submit\" name=\"submit_host\"value=\"Resolver\">
</div>
</div>
</div>
</div>
</div>
</form>
</p>";

?>
</body>
</html>

Qualquer dúvida, tamos aê... :)

Flw's, T+V! :DAté mais

#2 <? thales ?>

<? thales ?>

    Nossa vida é desperdiçada pelos detalhes...Simplifique, Simplifi

  • Banidos
  • PipPipPipPipPipPip
  • 551 posts
  • Sexo:Não informado
  • Localidade:Belo Horizonte
  • Interesses:Programar&lt;br&gt;Estou tentando ser um Hacker&lt;br&gt;Gosto de mulheres

Posted 01/04/2005, 16:10

Valeu cara (y)
NITRØ
--------------------
Foi mau galera

#3 vecetex

vecetex

    Turista

  • Usuários
  • 34 posts
  • Sexo:Não informado

Posted 04/01/2006, 17:25

caraeu so novo em php e queria saber qual a função desse script ai
Vecet AllBlack 4ever
RADIO HEAVEN HITS

#4 umbu

umbu

    Normal

  • Usuários
  • 85 posts
  • Sexo:Não informado

Posted 05/01/2006, 14:39

Serve para vc saber o host de um IP e o Ip de um host :-P

Ex de busca pelo ip do host forum.wmonline.com.br usando o script ai:
Resultado: O IP do domínio forum.wmonline.com.br é: 200.185.109.103

Ex de busca pelo host do ip 200.185.109.103 usando o script ai:
Resultado: O host de 200.185.109.103 é: mercurio.k8.com.br

SAcou?

Ps. muito legal o script!
Eu apoio a Ong Desapareceu!
Apoie você também.
http://forum.wmonlin...howtopic=130640

#5 vecetex

vecetex

    Turista

  • Usuários
  • 34 posts
  • Sexo:Não informado

Posted 05/01/2006, 19:47

gostei da pa se divetir bastante >D
Vecet AllBlack 4ever
RADIO HEAVEN HITS




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq