elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  problema al redireccionar urls en PHP
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: problema al redireccionar urls en PHP  (Leído 1,324 veces)
Hazama

Desconectado Desconectado

Mensajes: 22


Nobody will remember a scum like you!


Ver Perfil
problema al redireccionar urls en PHP
« en: 18 Diciembre 2013, 08:37 am »

He estado desarrollando una pagina para la subida y descarga de archivos y no habia tenido problemas hasta ahora con el archivo "upload.php" y el problema esta en que al generar el enlace corto para poder descargar el archivo este no me redirecciona a la pagina orginal que es la que contiene el enlace original que es demasiado largo y que por esa razon decidi cambiarlo con el acortador pero al ponerl una url me lleva a la pagina de error 404.

espero que puedan ayudarme con este problema y de ante mano muchas gracias :D

Estos son los datos de mi script y mi .htaccess

upload.php
Código
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <?php
  5. $dir="files/";
  6. opendir($dir);
  7. $dpath=$dir.$_FILES['file'] ['name'];
  8. @copy($_FILES['file'] ['tmp_name'],$dpath);
  9.  
  10. $fbrowse=$_FILES['file'] ['name'];
  11. $fname=$_FILES['file'] ['name'];
  12. $fsize = $_FILES['file'] ['size'];
  13. $ftype = $_FILES['file'] ['type'];
  14.  
  15. $connect = mysql_connect("xxxxxxx","xxxxxxx","xxxxxxx") or
  16. die("Connection error");
  17. mysql_select_db("xxxxxxx",$connect) or
  18. die();
  19. mysql_query("INSERT INTO xxxxxxx (FILE,FILENAME,SIZE,TYPE,URL) VALUES('$fbrowse','$fname','$fsize','$ftype','http://xxxxxxxcom/files/downloadfile.php?file=$fbrowse&ID=$id')",$connect);
  20. /////////////////////////////////////
  21. $connect = mysql_connect("xxxxxxx","xxxxxxx","xxxxxxx") or
  22. die("Connection error");
  23. mysql_select_db("xxxxxxx",$connect) or die();
  24.  
  25. mysql_query("INSERT INTO sh.urls (url, id) VALUES ('".$_POST['sh_url']."','".$mid."')");  
  26. $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
  27. $mid = "".$array[rand(0, 34)]."".$array[rand(0, 34)]."".$array[rand(0, 34)]."".$array[rand(0, 34)]."".$array[rand(0, 34)]."";
  28. //////////////////////////////////
  29. if($_FILES['file'] ['name'] > 1024)
  30. {
  31. echo "The maximum file size is:1GB";
  32. }
  33. $link = "http://xxxxxxx/files/downloadfile.php";
  34. $url_ID = "$link?file=$fbrowse&ID=$id";
  35. $id = md5(rand(0,999).rand(8,888).$fbrowse.rand(1,9999));
  36. ?>
  37. <link rel="shortcut icon" href="http:/xxxxxxx"/>
  38. <title>Uploaded file info</title>
  39. <link rel="stylesheet" href="http://xxxxxxx" />
  40. </head>
  41. <body>
  42. <center><a href="http://xxxxxxx"><img src="http://xxxxxxx/content/logo.png" title="xxxxxxx" /></a></center>
  43. <center>
  44. <ul id="menucontent">
  45. <li><a href="http://xxxxxx.com/">Home</a></li>
  46. <li><a href="http://xxxxxx.com">Buy Premium</a></li>
  47. <li><a href="http://xxxxxx.com">Register</a></li>
  48. <li><a href="http://xxxxxx.com">Login</a></li>
  49. <li><a href="http://xxxxxx.com">Contact Us</a></li>
  50. </ul>
  51. </center>
  52. <div class="uploadcontent">
  53. <label style="position:absolute; top:10px; left:5px; font-family:Century Schoolbook; font-size:14px;">Filename:</label>
  54. <label style="position:absolute; top:10px; left:70px;">
  55. <?php
  56. $fbrowse=$_FILES['file'] ['name'];
  57. echo $fbrowse?>
  58. </label>
  59. <br />
  60. <label style="position:absolute; top:50px; left:7px; font-family:Century Schoolbook; font-size:14px;">Url:</label>
  61. <input type="text" class="fileurl" name="sh_url" onClick="this.select()" size="47" value="<?
  62. $link = "http://xxxxxx.com/files/downloadfile.php";
  63.  
  64. $url_ID = "$link?file=$fbrowse&ID=$id";
  65.  
  66. $s_url="http://".$_SERVER['SERVER_NAME']."/files/download.php";
  67.  
  68. $muID="$s_url&ID$mid";
  69.  
  70. echo $muID;
  71. $m_id = md5(rand(0,999).rand(8,888).$fbrowse.rand(1,9999))?>">
  72.  
  73. <input type="submit" value="Download File" class="vdownload">
  74. </div>
  75. </body>
  76. </html>


Código:
php_value display_errors On
php_flag magic_quotes 1
php_flag magic_quotes_gpc 1
php_value mbstring.http_input auto
php_value date.timezone America/New_York

RewriteRule ^([0-9a-zA-Z_-]{6})$ files/download.php?u=$1 [L]

ErrorDocument 404: "The request page doesn't exists in this server."

como detalle dejo tambien la url del enlace acortado que me genera.

http://xxxxxx.net/legnj

Saludos.


« Última modificación: 20 Diciembre 2013, 10:58 am por Tatsurou_LuLu » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Problema con xml+php+flash+urls
PHP
skdna 0 2,116 Último mensaje 17 Diciembre 2009, 23:07 pm
por skdna
[mod_rewrite] URLs amigables, problema para que el sitio se vea bien ! « 1 2 »
PHP
Diabliyo 14 12,554 Último mensaje 7 Mayo 2012, 02:22 am
por luis108
problema urls amigables...
PHP
Rk_PetIT 0 1,465 Último mensaje 2 Agosto 2013, 00:35 am
por Rk_PetIT
problema de redireccionar
Desarrollo Web
landerzx 1 1,718 Último mensaje 4 Octubre 2013, 18:14 pm
por landerzx
Problema al redireccionar una web AYUDA! « 1 2 »
Desarrollo Web
Alarkon_88 15 6,854 Último mensaje 4 Septiembre 2016, 04:25 am
por bengy
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines