URLmini

Iniciado por narupiece, Julio 26, 2010, 02:43:18 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Julio 26, 2010, 02:43:18 AM Ultima modificación: Marzo 27, 2014, 06:08:09 PM por Expermicid
jeje hola xD

he hecho este script parecido al de Xt3mp, un poco mas reducido, y legible, no necesita base de datos :/ (myu basico xD)

Código: php

<html>
<head>
<title>URLmini</title>
</head>
<body>
<center>
<h1>URLmini</h1>
<br><br>

<form method="post" action="">
<input type="text" name="url" value="http://"><br>
<input type="radio" name="tipo" value="1" checked>redireccionamiento Visible <input type="radio" name="tipo" value="2"> redireccinamiento Invisible<br>
<input type="submit" value="crear">
<input type="hidden" name="action" value="enviar">
</form>

<?php

$url=$_POST['url'];
$prefijo = substr(md5(uniqid(rand())),0,6);
$tipo=$_POST['tipo'];
$tipo1="<html><head><title>URLmini</title><META HTTP-EQUIV='refresh' CONTENT='0; url=$url/'></head></html>";
$tipo2="<html><head><title>URLmini</title></head><frameset rows=\"*\" frameborder=\"0\" framespacing=\"0\" border=\"0\"><frame src=\"$url\"></frameset></html>";
$tuweb=$_SERVER['SERVER_NAME'];



if($_POST['action']=="enviar"){

if($url==""){
  echo"<script>alert('por favor ponga una url')</script>";
}else{
  if(!file_get_contents($url)){
   echo"<script>alert('La url no es valida!')</script>";
  }else{
    if($tipo==1){
     mkdir("./$prefijo", 0777);
     $fp=fopen("$prefijo/index.html","w");
     fwrite($fp,$tipo1);
     fclose($fp);
     echo"<br><br><input type=\"text\" value=\"http://$tuweb/$prefijo/\">";
     echo"<br><a href=\"http://$tuweb/$prefijo/\" target=\"_blank\">$prefijo</a>";
    }else{
     mkdir("./$prefijo", 0777);
     $fp=fopen("$prefijo/index.html","w");
     fwrite($fp,$tipo2);
     fclose($fp);
     echo"<br><br><input type=\"text\" value=\"http://$tuweb/$prefijo/\">";
     echo"<br><a href=\"http://$tuweb/$prefijo/\" target=\"_blank\">$prefijo</a>";
    }
  }
}
}




?>

</center>
</body>
</html>





Si les dice que la url no es valida, aunque si sea, utilicen este codigo. me imagino que los servidores de byethost no tiene permitido las conexiones externas  :undecided:

Código: php


<html>
<head>
<title>URLmini</title>
</head>
<body>
<center>
<h1>URLmini</h1>
<br><br>

<form method="post" action="">
<input type="text" name="url" value="http://"><br>
<input type="radio" name="tipo" value="1" checked>redireccionamiento Visible <input type="radio" name="tipo" value="2"> redireccinamiento Invisible<br>
<input type="submit" value="crear">
<input type="hidden" name="action" value="enviar">
</form>

<?php

$url=$_POST['url'];
$prefijo = substr(md5(uniqid(rand())),0,6);
$tipo=$_POST['tipo'];
$tipo1="<html><head><title>URLmini</title><META HTTP-EQUIV='refresh' CONTENT='0; url=$url/'></head></html>";
$tipo2="<html><head><title>URLmini</title></head><frameset rows=\"*\" frameborder=\"0\" framespacing=\"0\" border=\"0\"><frame src=\"$url\"></frameset></html>";
$tuweb=$_SERVER['SERVER_NAME'];



if($_POST['action']=="enviar"){

if($url==""){
  echo"<script>alert('por favor ponga una url')</script>";
}else{
    if($tipo==1){
     mkdir("./$prefijo", 0777);
     $fp=fopen("$prefijo/index.html","w");
     fwrite($fp,$tipo1);
     fclose($fp);
     echo"<br><br><input type=\"text\" value=\"http://$tuweb/$prefijo/\">";
     echo"<br><a href=\"http://$tuweb/$prefijo/\" target=\"_blank\">$prefijo</a>";
    }else{
     mkdir("./$prefijo", 0777);
     $fp=fopen("$prefijo/index.html","w");
     fwrite($fp,$tipo2);
     fclose($fp);
     echo"<br><br><input type=\"text\" value=\"http://$tuweb/$prefijo/\">";
     echo"<br><a href=\"http://$tuweb/$prefijo/\" target=\"_blank\">$prefijo</a>";
    }
 
}
}




?>

</center>
</body>
</html>




You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login (no comprueba la url) <-- recomendado, url pequenia xD
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login (si comprueba la url)

Saludos!!  :cool:

Como te comenté brother, checa si la carpeta creada existe por que si existe y hace todo lo que le indicas, se sobreescribirá el index.html y ocasionaría problemas, con file_exists();, pero muy bueno brother, sigue así, saludos!
Cada vez que me das Karma me motivas

exelente lo que ocupaba para mis fakes jajaja salud0os