Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/03/2010, 12:25
Avatar de murderer
murderer
 
Fecha de Ingreso: marzo-2009
Ubicación: Argentina/Misiones/Iguazu/Localhost
Mensajes: 196
Antigüedad: 17 años, 6 meses
Puntos: 2
Problema con URL y ciertos caracteres

Holas!

Estuve investigando todo el dia de ayer y hoy pero aún no encuentro una solución al problema.

Para entender un poco más, tengo una página donde se pueden crear posts. Facil, llenas un formulario, se crea una carpeta en /post/el-titulo-del-post.php y un registro en la DB

El sistema funciona bien, salvo cuando agregas '¡', '?' y '¿' al titulo. Se crea la carpeta y se crea el registro en la DB. pero cuando quieres entrar por la URL, tira error 404 :S

nuevo-post.php
Código PHP:
   $fecha = date("H:i:s d-m-Y");
   
$titulo = mysql_real_escape_string($_POST['titulo']);
   
$filtro = str_replace(" ","-",$titulo);
   
$contenido = mysql_real_escape_string($_POST['contenido']);
   
$autor = $_SESSION['usuario'];
   
$categoria = mysql_real_escape_string($_POST['categoria']);  
   
   
   
$request = mysql_query("insert into posts(autor, titulo, categoria, contenido, fecha) values ('$autor', '$titulo', '$categoria', '$contenido', '$fecha')");
   
   if (
$request){
$texto = '<?php 
$root = $_SERVER[\'DOCUMENT_ROOT\'] . \'/\';
include ($root . \'posts/post.php\'); 
?>    
'
;
      
$texto = html_entity_decode($texto);
      
$texto = stripslashes($texto);
mkdir($root.'posts/'.$filtro);      

$fd = fopen($root."posts/".$filtro."/index.php", 'w');
$escribir = fwrite($fd, $texto);
   }
   
   if(
$escribir) {
  
fclose($fd);
   
header("location: /funciones/terminado.php?id=4");
   
   } else {
   echo 
"Ese titulo ya existe";
   } 
Desde ya muchas gracias,

Saludos!
__________________
"Cuando te propones una meta todo el mundo conspira para que puedas lograrlo." Puedes encontrame en Twitter