Problème avec URL Rewriting

Suivre ce topic
Ce topic est suivi par : Personne...
Ce topic a été résolu
Blast0Kd

Blast0Kd Le 8 juillet 2016 à 11:21 (Édité le 25 janvier 2019 à 17:51)

Salut à tous j'ai un problème avec la fonction "url_custom_encode" de @PrimFx car mon titre est bien transité dans l'url mais elle n'affiche pas le contenu.
Voici la fonction :
<?php
function url_custom_encode($titre) {
   $titre = htmlspecialchars($titre);
   $find = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', 'Œ', 'œ', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', 'Š', 'š', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', 'Ÿ', '?', '?', '?', '?', 'Ž', 'ž', '?', 'ƒ', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?');
     $replace = array('A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?');
     $titre = str_replace($find, $replace, $titre);
   $titre = strtolower($titre);
   $mots = preg_split('/[^A-Z^a-z^0-9]+/', $titre);
   $encoded = "";
   foreach($mots as $mot) {
      if(strlen($mot) >= 3 OR str_replace(['0','1','2','3','4','5','6','7','8','9'], '', $mot) != $mot) {
         $encoded .= $mot.'-';
      }
   }
   $encoded = substr($encoded, 0, -1);
   return $encoded;
}
?>
Voici le require :

<?php
session_start();
include('../assets/res/config.php');
include_once('../assets/res/cookieconnect.php');
require('include/encode.php');
include('../assets/res/rssclass.php');
require_once '../admin/jbb/Parser.php';

Et voici ma requête :

<?php
session_start();
include('../assets/res/config.php');
include_once('../assets/res/cookieconnect.php');
require('include/encode.php');
include('../assets/res/rssclass.php');
require_once '../admin/jbb/Parser.php';
  if(isset($_GET['titre'])){
     $getid = url_custom_encode($_GET['titre']);
     $requser = $bdd->prepare('SELECT * FROM articles WHERE titre = ?');
     $requser->execute(array($getid));
     $articleinfo = $requser->fetch();
     /////////////////////////////////////////////////
     $infouse = $bdd->prepare('SELECT * FROM membres WHERE pseudo = ?');
     $infouse->execute(array($articleinfo['auteur']));
     $userinfo = $infouse->fetch();
?>

/////////////////////////////////////////////
contenu de la page 
////////////////////////////////////////////

<?php
}
?>
Vous devez être connecté pour poster une réponse. Se connecter ou Créer un compte