require "function.php";
$category=substr($category,0,10);
if ($category!=""){
//////////echo "$language---------$dddd";
$kolonka="name_".$language;
$r3 = mysqli_query($conn, "select id, $kolonka from category where id=$category ");
$f3=mysqli_fetch_array($r3);
$lang['ORDER_TITLE']=$f3[1];
}
$TITEL=$lang['ORDER_TITLE'];
function head() {
global $lang;
?>
}
function center() {
global $conn,$lang,$language,$Quser,$uu_uu,$ur_ur,$country,$province,$town,$dddd,$page,$category,$podcategory,$only,$nopay,$act;
$linksss=$_SERVER['REQUEST_URI']."<>";
$linksss=str_replace("&","<>",$linksss);
$preg="#page=(.*?)<>#is";
preg_match_all ($preg, $linksss, $item);
$page=trim(urldecode($item[1][0]));
$preg="#country=(.*?)<>#is";
preg_match_all ($preg, $linksss, $item);
$country=trim(urldecode($item[1][0]));
$preg="#province=(.*?)<>#is";
preg_match_all ($preg, $linksss, $item);
$province=trim(urldecode($item[1][0]));
$preg="#town=(.*?)<>#is";
preg_match_all ($preg, $linksss, $item);
$town=trim(urldecode($item[1][0]));
$preg="#category=(.*?)<>#is";
preg_match_all ($preg, $linksss, $item);
$category=trim(urldecode($item[1][0]));
$preg="#podcategory=(.*?)<>#is";
preg_match_all ($preg, $linksss, $item);
$podcategory=trim(urldecode($item[1][0]));
$preg="#only=(.*?)<>#is";
preg_match_all ($preg, $linksss, $item);
$only=trim(urldecode($item[1][0]));
$preg="#act=(.*?)<>#is";
preg_match_all ($preg, $linksss, $item);
$act=trim(urldecode($item[1][0]));
if ((($country=="")||($country==0)) & ($Quser>0)) {
$r=@mysqli_query($conn, "select id_country, id_region, id_town from user where id='$Quser' and prof='$ur_ur' ");
$f=@mysqli_fetch_array($r);
if ($act==1) {} else {
$country=$f[id_country];
///if ($province=="") {$province=$f[id_region];}
///if ($town=="") {$town=$f[id_town];}
}
}
///////echo "
---$country---$province--$town----";
?>
if ($country>0) {$wh1=" and id_country='$country' ";}
if ($province>0) {$wh2=" and id_region='$province' ";}
if ($town>0) {$wh3=" and id_town='$town' ";}
if ($category>0) {
$sql="";
$r = mysqli_query($conn,"select id, $kolonka from podcategory where id_category='$category' order by name_en");
for($i=0; $i0) {
$wh4=" and id_podcategory like '%$podcategory%' ";
}
?>
$rsss=@mysqli_query($conn, "select specs from user where id='$Quser' and prof='1' ");
$fsss=@mysqli_fetch_array($rsss);
$my_specs=$fsss[specs];
if ($only==1) {
$wh4="";
////echo "-------$fsss[specs]------";
$wh6="";
$filter = explode(",", $fsss[specs]);
for ($jl = 0; $jl < count($filter); $jl++) {
if ($filter[$jl] != ""){
$filter[$jl]=str_replace("-","",$filter[$jl]);
////echo "--$filter[$j]-----";
$wh6.= " or id_podcategory = '$filter[$jl]' ";
}
$wh7=" and (id_podcategory = '$filter[0]' $wh6)";
}
}
//echo "select count(id) from zayavka where id>0 $wh1 $wh2 $wh3 $wh4 $wh5 $wh7 ";
$perpage = 12;
if (empty($page) or $page<=0) $page = 1;
else $page = (int)$page;
$z=mysqli_query($conn, "select count(id) from zayavka where arhiv=0 and vidzayavka=0 and id_profy=0 and sdelano=0 and namer!='' and opis!='' and id_category>0 and id_country>0 $wh1 $wh2 $wh3 $wh4 $wh7 ");
$x=@mysqli_fetch_array($z);
$count = $x[0];
$pages_count = ceil($count / $perpage);
if ($page > $pages_count) $page = $pages_count;
$start_pos = ($page-1) * $perpage;
if ($count==0) {
?>
}
////echo "select * from zayavka where id>0 $wh1 $wh2 $wh3 $wh4 $wh7 LIMIT $start_pos, $perpage ";
$r= @mysqli_query($conn, "select *, DATE_FORMAT(dat, '%d.%m.%Y') as dat1 from zayavka where arhiv=0 and vidzayavka=0 and id_profy=0 and sdelano=0 and namer!='' and opis!='' and id_category>0 and id_country>0 $wh1 $wh2 $wh3 $wh4 $wh7 order by id desc LIMIT $start_pos, $perpage ");
for($i=0; $i<@mysqli_num_rows($r); $i++)
{
$f=@mysqli_fetch_array($r);
$kolonka="name_".$language;
$r1=@mysqli_query($conn, "select $kolonka, flag from country where id='$f[id_country]' ");
$f1=@mysqli_fetch_array($r1);
$r2=@mysqli_query($conn, "select $kolonka from region where id='$f[id_region]' ");
$f2=@mysqli_fetch_array($r2);
$r3=@mysqli_query($conn, "select $kolonka from town where id='$f[id_town]' ");
$f3=@mysqli_fetch_array($r3);
$rlang=@mysqli_query($conn, "select lang from user where id='$f[id_user]' ");
$flang=@mysqli_fetch_array($rlang);
$speak_lng=$flang[0];
$mesto =$f[mesto];
$namer =$f[namer];
$opis =$f[opis];
$dat1 =$f[dat1];
$dat1 =str_replace (" 00:00:00","",$dat1);
if ($f[img1]=="") {$f[img1]="nofoto3.jpg";}
$kolonka="name_".$language;
$r3cat = mysqli_query($conn, "select id, $kolonka from category where id=$f[id_category] ");
$f3cat=mysqli_fetch_array($r3cat);
$catgory=$f3cat[1];
$r3pcat = mysqli_query($conn, "select id, $kolonka from podcategory where id=$f[id_podcategory] ");
$f3pcat=mysqli_fetch_array($r3pcat);
$podcatgory=$f3pcat[1];
?>