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)
<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:
<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>
Ver Demo (http://url-mini.tk) (no comprueba la url) <-- recomendado, url pequenia xD
Ver Demo (http://narupiece.webcindario.com/URLmini/) (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!
exelente lo que ocupaba para mis fakes jajaja salud0os