$ciqas="150";
if(isset($_REQUEST['rupel'])){
$rupel=$_REQUEST['rupel'];
}else{
$rupel="";
}
# Script ayarlari
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_eyar.php");
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_vekirin.php");
# Script kontrolleri
if (!$rupel) {$rupel=1;} // Hangi rupeldaki kayitlarin listkenecegi belirtilmemisse, rupel numarasini tutan rupel adli degisken 1 olarak atansin.
if ($rupel<=0) {$rupel=1;} // Burada eger rupel adli degiskene disaridan 0 veya 0dan kucuk bir deger gonderiliyorsa rupel adli degisken 1 depesni alsin diyoruz.
$ji_ciqas=($rupel-1)*$ciqas; // Burada cendinci kayittan itibaren listkemeye baslanacagi bulunuyor ve sonuc ji_ciqas adli degiskene deger olarak veriliyor.
# tehev cend kayit oldugunu buluyoruz
$query=("SELECT count(*) FROM products");
$tehev = mysqli_query($conn,$query);
$tehev = mysqli_query($conn,$query);
$tehev = mysqli_fetch_array($tehev,MYSQLI_ASSOC);
$tehev=$tehev["totalitems"];
# Kayitlari seciyoruz
$query=("SELECT * FROM products WHERE category='".$id."' AND status='1' ORDER BY classement ASC LIMIT $ji_ciqas,$ciqas");
//echo $query;
$kayitlar=mysqli_query($conn,$query);
# Kayitlari rupelliyoruz
$numrows = mysqli_num_rows($kayitlar); // cend kayit sectigimizi buluyoruz.
$cendrupel=$tehev/$ciqas; // Tum kayitlarin tehev cend rupelda listkenecegini hesapliyoruz.
if($cendrupel<=0){$cendrupel=1;} // tehev rupel sayisini tutan cendrupel degiskeni 0 veya 0'dan kucuk ise depesni 1 yapiyoruz.
$kalan=$tehev%$ciqas; // tehev kayit sayisi rupellara bolundukten sonra varsa kalan kayit bulunuyor.
if($kalan>0){$cendrupel=$cendrupel+1;settype( $cendrupel, 'integer' );} // Kalan kayit varsa rupel sayisi 1 arttiriliyorki kalan kayitlar ucmasin.
$cenda=$ji_ciqas+$numrows;
$nerden=$ji_ciqas+1;
if($rupel==1){$pes="Précédent";} // Eger 1. rupeldaki kayitlar listkeniyorsa, pes linki yerine sadece pes yazisi olsun. Yani pes linki deaktif olsun.
else{$pes = $rupel-1;$pes = "
Précédent ";} // 1. rupel disinda bir rupeldaki kayitlar listkeniyorsa pes linki aktif olsun ve bir bir onceki rupelya giden bir link seklinde yazilsin.
if($cendrupel<=$rupel){$pas="Suivant";} // Eger tehev rupel sayisi simdi listkenen rupeldan buyuk degilse pas linki sadece yazi seklinde gorunsun yani deaktif olsun.
else{$pas=$rupel+1;$pas = "
Suivant";} // tehev rupel sayisi simdi listkenen rupeldan buyukse pas linki bir sonraki rupelya giden bir link seklinde yazilsin.
# rupellama linklerini yazdiriyoruz (pas,pes ve rupel numaralari)
$counter=0;
function enleve_accents ($chaine)
{
$reg = '/&(.)(acute|grave|circ|uml|cedil|ring|tilde|slash|caron|zlig|lig);/';
return preg_replace($reg, '\1', htmlentities($chaine));
}
function suppr_speciaux ($chaine)
{
$reg = '|(&[a-zA-Z0-9]*;)|U';
return preg_replace($reg, '-', $chaine);
}
function is_utf8 ($string)
{
return ! strlen(preg_replace(',[\x09\x0A\x0D\x20-\x7E]' . # ASCII
'|[\xC2-\xDF][\x80-\xBF]' . # non-overlong 2-byte
'|\xE0[\xA0-\xBF][\x80-\xBF]' . # excluding overlongs
'|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}' . # straight 3-byte
'|\xED[\x80-\x9F][\x80-\xBF]' . # excluding surrogates
'|\xF0[\x90-\xBF][\x80-\xBF]{2}' . # planes 1-3
'|[\xF1-\xF3][\x80-\xBF]{3}' . # planes 4-15
'|\xF4[\x80-\x8F][\x80-\xBF]{2}' . # plane 16
',sS', '', $string));
}
function linkniviso($giredan) {
if (is_utf8($giredan))
$giredan = utf8_decode($giredan);
$orginal_url=array('À','Á','Â','Ã','Ä','Å','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ò','Ó','Ô','Õ','Ö','Ù','Ú','Û','Ü','Ý','à','á','â','ã','ä','å','ç','è','é','ê','ë','ì','í','î','ï','ð','ò','ó','ô','õ','ö','ù','ú','û','ü','ý','ÿ','?','?');
$censored_url=array('A','A','A','A','A','A','C','E','E','E','E','I','I','I','I','O','O','O','O','O','U','U','U','U','Y','a','a','a','a','a','a','c','e','e','e','e','i','i','i','i','o','o','o','o','o','o','u','u','u','u','y','y','s','s');
$giredan = str_replace($orginal_url,$censored_url,$giredan);
$giredan = strtolower(suppr_speciaux(enleve_accents($giredan)));
//$giredan = preg_replace("/(l'|d'|t'| et | st | de | un | le | de | du | lui | mon | ton | les | son | sa | ca | je | tu | il | elle | nous | vous | ils | elles | la | ce | de | son | dont | qui | a | une | ne | des | en |t-|-t)/", " ", $giredan);
$reg = '|([^a-z0-9]+)|';
$giredan = preg_replace($reg, '-', $giredan);
$giredan=substr($giredan, 0,75);
return trim($giredan, '-');
}
function seourl($id){
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_eyar.php");
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_vekirin.php");
$query=("SELECT * FROM products WHERE id='".$id."'");
//echo "
".$query."
";
$result = mysqli_query($conn,$query);
$num_rows = mysqli_num_rows($result);
if($num_rows==true){
$data = mysqli_fetch_object($result);
$tr=$data->tr;
}
return linkniviso($tr);
}
function imgpresentlarge($id){
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_eyar.php");
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_vekirin.php");
$query=("SELECT * FROM productsmedias where nid='$id' ORDER BY rank ASC LIMIT 1");
$result = mysqli_query($conn,$query) or die(mysqli_error());
$num_rows = mysqli_num_rows($result);
if($num_rows=='1'){
$data = mysqli_fetch_object($result);
$id=$data->id;
return $id;
}
}
echo "
";
echo"
";
function topcat($id){
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_eyar.php");
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_vekirin.php");
$query=("SELECT * FROM productscats WHERE level='".$id."' AND level!='0' ORDER BY classement ASC LIMIT 10");
$result = mysqli_query($conn,$query) or die(mysqli_error($conn));
$num_rows = mysqli_num_rows($result);
if($num_rows==TRUE){
$data = mysqli_fetch_object($result);
$cid=$data->cid;
$tr=$data->tr;
echo $tr;
}
}
//echo topcat($id);
if(isset($numrows)){
function listcategories($id){
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_eyar.php");
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_vekirin.php");
$query=("SELECT * FROM productscats WHERE level='".$id."' AND level!='0' ORDER BY classement ASC LIMIT 10");
//echo $query;
$result = mysqli_query($conn,$query);
$num_rows = mysqli_num_rows($result);
if($num_rows==true){
echo"
Les sous catégories
";
echo"
";
while ($row=mysqli_fetch_array($result)) {
$tr=stripslashes($row['tr']);
$tr=stripslashes($tr);
echo "
".$tr."";
}
echo"
";
echo"
";
}
}
function listcategoriesdetails($id){
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_eyar.php");
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_vekirin.php");
$query=("SELECT * FROM products WHERE category='".$id."' AND status='1' ORDER BY classement ASC LIMIT 0,100");
//echo $query;
$result = mysqli_query($conn,$query);
$num_rows = mysqli_num_rows($result);
//echo $num_rows;
if($num_rows==true){
echo"
";
while($listke=mysqli_fetch_array($result)){
$counter=$counter+1;
echo"
";
echo"
";
echo "
";
if(strlen($listke['fr'])>="16"){
$tr=substr($listke['fr'],0,15);
$tr=$tr."...";
}else{
$tr=$listke['tr'];
}
echo"
".$tr."
";
echo"
";
echo"
";
}
echo"
";
}
}
function listcats($id){
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_eyar.php");
include($_SERVER['DOCUMENT_ROOT']."/test/databases/new/db_vekirin.php");
$query=("SELECT * FROM productscats WHERE level='".$id."' AND level!='0' ORDER BY classement ASC LIMIT 10");
//echo $query;
$result = mysqli_query($conn,$query);
$num_rows = mysqli_num_rows($result);
if($num_rows==true){
while ($row=mysqli_fetch_array($result)) {
echo listcategoriesdetails($row['cid']);
}
}
}
if((productscatslevel($id))=="0"){
listcategories($id);
echo listcats($id);
/*
if($id=="1"){
echo"
";
}
if($id=="3"){
echo"
";
}
if($id=="4"){
echo"
";
}
if($id=="5"){
echo"
";
}*/
}else{
}
if($_SESSION['list']=="gride"){
while($listke=mysqli_fetch_array($kayitlar)){
$counter=$counter+1;
echo"
";
echo "
";
echo"
".stripslashes($listke[tr])."
".stripslashes($listke[tring])."
";
}
}else{
echo"
";
while($listke=mysqli_fetch_array($kayitlar)){
echo "
".$listke[level]."
";
$counter=$counter+1;
echo"
";
echo"
";
echo "
";
if(strlen($listke['tr'])>="16"){
$tr=substr($listke['tr'],0,15);
$tr=$tr."...";
}else{
$tr=$listke['tr'];
}
echo"
".$tr."
";
echo"
";
echo"
"."\r\n\r\n";
}
}
if($numrows>=$ciqas){
echo "
";
echo "$pes |"; // pes linki.
for($i=1;$i<=$cendrupel;$i++){
if ($rupel==$i){echo " $i ";} // rupel numaralari.
else{echo " $i ";}}
echo "| $pas"; // pas linki.
echo " |
";
# Kayitlari yazdiriyoruz
}
}else{//numrows
echo "
Pas de donnée
";
}
?>