1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| function filter($in) {
$search = array ('@[b]@i','@[D]@i','@[F]@i','@[G]@i','@[H]@i','@[J]@i','@[K]@i','@[L]@i','@[M]@i','@[N]@i','@[P]@i','@[Q]@i','@[R]@i','@[S]@i','@[T]@i','@[V]@i','@[W]@i','@[X]@i','@[Y]@i','@[Z]@i','@[éèêëÊËE]@i','@[àâäÂÄA]@i','@[îïÎÏI]@i','@[ûùüÛÜU]@i','@[ôöÔÖO]@i','@[çC]@i','@[ ]@i','@[^a-zA-Z0-9_]@');
$replace = array ('b','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z','e','a','i','u','o','c','_','');
return preg_replace($search, $replace, $in);
}
$newsId= ( isset($_GET["id"])) ? $_GET['id'] : FALSE;
$titre= ( isset($_GET["titre"])) ? $_GET['titre'] : FALSE;
if ( is_numeric($newsId) && is_string(filter($titre)) ) {
$sql = 'SELECT * FROM news WHERE newsId = ' . $newsId . ' AND titre = ' . $titre;
$rc = mysql_query($sql);
if ( $data = mysql_fetch_assoc($rc) ) {
//afficher la news
}else
{
//mauvaise id de news
}
}else
{
//ce n'est pas une id valide
} |
Partager