2) { $sql="SELECT `key`,`question`,`date_poll`,`id_poll` FROM polls WHERE categorie<>0 AND question LIKE '%".addSlashes($_GET['q'])."%'".$limit; $sql2="SELECT count(id_poll) FROM polls WHERE categorie<>0 AND question LIKE '%".addSlashes($_GET['q'])."%'"; //$sql="SELECT `key`,`question`,`date_poll`,`id_poll` FROM polls WHERE question LIKE '%".$_GET['q']."%'".$limit; //$sql2="SELECT count(id_poll) FROM polls WHERE question LIKE '%".$_GET['q']."%'"; $recherche=$_GET['q']; $lacat=-1; // recherche logger_recherche($_GET['q']); } } $smarty = new SmartyDefault; $smarty->assign("BASE","//".URL_BASE."/"); $smarty->assign("index","sondages"); $smarty->assign("noadsense", $noadsense); if($lacat!=0) { if($sql=="") { $sql="SELECT `key`,`question`,`date_poll`,`id_poll` FROM polls WHERE categorie=".$_GET['cat'].$limit; $sql2="SELECT count(id_poll) AS tot FROM polls WHERE categorie=".$_GET['cat']; } $db = DB_pixule::conn(DSN_PIXULE); $nbres = DB_pixule::query($sql2,DSN_PIXULE) or die(mysqli_error()); $resultset = DB_pixule::query($sql,DSN_PIXULE) or die(mysqli_error()); $result=DB_pixule::fetchRows($resultset,DSN_PIXULE); $r=array(); foreach($result as $data) { $Poll=new Poll($data['key']); $opt=$Poll->getOptions(); $options=""; $nbvotes=0; $options=""; $r[$data['id_poll']]['url']="//".URL_BASE."/".$Poll->getPrettyURL().".html"; $r[$data['id_poll']]['options']=$options; if($nbvotes>1) { $r[$data['id_poll']]['nbvotes']=$nbvotes." votes"; } else { $r[$data['id_poll']]['nbvotes']=$nbvotes." vote"; } $r[$data['id_poll']]['question']=$data['question']; $r[$data['id_poll']]['key']=$data['key']; } $temp=DB_pixule::fetchRow($nbres); $n=$temp['tot'];//mysqli_result($nbres,0,0); $smarty->assign('n',$n); if($recherche!="") { $smarty->assign('title','Sondages de '.$recherche.' sur PiXule.com , sondages gratuits pour blog, site et forum !'); $smarty->assign('title2',"Recherche de sondages sur ".$recherche); } else { $smarty->assign('title','Sondages de '.$categories[$_GET['cat']].' sur PiXule.com , sondages gratuits pour blog, site et forum !'); $smarty->assign('title2',"Sondages ".$categories[$_GET['cat']]); } $maxpages=ceil($n/$nbaffiche); $smarty->assign('page',$page); $pagelien=$_SERVER['REQUEST_URI']; $pagelien=preg_replace("/[0-9]/","/",$pagelien); $pagelien=str_replace('//','/',$pagelien); $pagelien=str_replace('//','/',$pagelien); /* if(strpos($pagelien,"?")===false) { $pagelien.="?page="; } else { $pagelien.="&page="; } */ $smarty->assign('liendeclass',PREPROD_PARAM); $smarty->assign('pagelien',$pagelien); $smarty->assign('maxpages',$maxpages); $lienretour1=""; $lienretour1a=""; if($lacat>=10 && $lacat<=14) { $lienretour1="medias"; $lienretour1a="Médias"; } if($lacat>=21 && $lacat<=24) { $lienretour1="sport"; $lienretour1a="Sport"; } $smarty->assign('lienretour1',$lienretour1); $smarty->assign('lienretour1a',$lienretour1a); $smarty->assign('q',$recherche); $smarty->assign('r',$r); $smarty->assign('content', $smarty->fetch('sondagesliste.tpl')); } else { $smarty->assign('title','Sondages PiXule.com par categorie, gratuits pour blog, site et forum !'); $smarty->assign('content', $smarty->fetch('sondages.tpl')); } $smarty->assign('nav', $smarty->fetch('nav.tpl')); // Show the template $smarty->display('page.tpl');