Вернуться в рубрикатор    '; include "admin2/setup/connect.php"; // cоединяемся, выбираем базу данных $db_link = mysql_connect($db_host, $db_user, $db_pass) or die("Could not connect: ".mysql_error()."!"); mysql_select_db($db_name) or die("Could not select database!"); // проверяем переданную рубрику // $result = mysql_query("select * from rubric where rid=".$flag." and rstatus=1;"); // if (mysql_num_rows($result) != 1)redirect("http://www.uslugi-moscow.ru/catalog.php"); /* $firm = mysql_fetch_array($result); $namerubric = $firm["rname"]; $title = $namerubric." :: ".$title; $desc = $namerubric.", ".$desc; $key = $namerubric.", ".$key; $runame = $firm["runame"]; $rulink = $firm["rulink"]; unset($firm); mysql_free_result($result);*/ $isTmp=isset($_GET['tmp']); // сначала проверяем переданый id if($isTmp) { $s="select t1.*,"; // имена рубрик для темпа $s.="tprubr1.rname as tprubr1_name, tprubr2.rname as tprubr2_name, tprubr3.rname as tprubr3_name, tprubr4.rname as tprubr4_name, tprubr5.rname as tprubr5_name, tprubr6.rname as tprubr6_name,"; // имена станций метро темпа $s.="tpm1.mname as tpmname1, tpm2.mname as tpmname2, tpm3.mname as tpmname3,"; // Цепляем рубрики темпа - rname1-rname6 $s.="left join rubric tprubr1 on (tprubr1.rid=t1.tpcateg) left join rubric tprubr2 on (tprubr2.rid=t1.tpint1) left join rubric tprubr3 on (tprubr3.rid=t1.tpint2) left join rubric tprubr4 on (tprubr4.rid=t1.tpint3) left join rubric tprubr5 on (tprubr5.rid=t1.tpint4) left join rubric tprubr6 on (tprubr6.rid=t1.tpint5)"; // Метро темпа - mname1-3 $s.="left join metro tpm1 on (tpm1.mid=t1.tpmetro1) left join metro tpm2 on (tpm2.mid=t1.tpmetro2) left join metro tpm3 on (tpm3.mid=t1.tpmetro3)"; $s.="left join catalog_rasp rasp on (rasp.id_firm=$id AND rasp.isTemp=1)"; // Для переданного ид темпа и группированного по tpid $s.="where (tpid=$id) GROUP BY tpid"; } else { $s="select t1.*, t2.rname as rname1, t3.rname as rname2, t4.rname as rname3, t5.rname as rname4, t6.rname as rname5, t7.rname as rname6,m1.mname as mname1,m2.mname as mname2,m3.mname as mname, rasp.*"; $s.=" from catalog t1 left join rubric t2 on (t2.rid=t1.ccateg) left join rubric t3 on (t3.rid=t1.cint1) left join rubric t4 on (t4.rid=t1.cint2) left join rubric t5 on (t5.rid=t1.cint3) left join rubric t6 on (t6.rid=t1.cint4) left join rubric t7 on (t7.rid=t1.cint5)"; $s.=" left join catalog_rasp rasp on (rasp.id_firm=cid AND rasp.isTemp=0)"; $s.=" left join metro m1 on (m1.mid=t1.cm1)"; $s.=" left join metro m2 on (m2.mid=t1.cm2)"; $s.=" left join metro m3 on (m3.mid=t1.cm3)"; $s.=" where (cid=$id AND cstatus=1) GROUP BY cid"; } $result = mysql_query($s); if(!isset($flag)&&$result)$flag=$result['ccateg']; // echo $s.'-->'.@mysql_error(); if (mysql_num_rows($result) != 1) { //redirect("catalog.php?m=2&flag=".$flag); redirect($root."catalog.php?m=2&flag=".$flag); }// редиректим в случае ошибки $firm = mysql_fetch_array($result); include('mod_ob/win_utf_win.php'); include('shab/1/firmscard1.php'); //for(reset($firm);$k=key($firm);next($firm))$firm[$k]=win_to_utf($firm[$k]); // данные в голове страницы if($isTmp) { // echo 'mname='.$firm['tpadres']; $title=win_to_utf($firm["tpname"]).", ".win_to_utf($firm["tpadres"]); $title.=empty($firm["mname1"])?'':(", м. ".win_to_utf($firm["mname1"])); $title.=", ".win_to_utf($firm["rname1"]); $key=win_to_utf($firm["tpname"]).", ".win_to_utf($firm["rname1"]).", ".win_to_utf($firm["tpadres"]); $key.=empty($firm["mname1"])?'':(", м. ".win_to_utf($firm["mname1"]).", "); $desc=win_to_utf($firm["tpname"]); $desc.=empty($firm["mname1"])?'':(", м. ".win_to_utf($firm["mname1"])); $desc.=", ".win_to_utf($firm["tpadres"]); $org=win_to_utf($firm["tpname"]); } else { $title=win_to_utf($firm["cname"]).", ".win_to_utf($firm["cadres"]).", м. ".win_to_utf($firm["mname1"]).", ".win_to_utf($firm["rname1"]); $key=win_to_utf($firm["cname"]).", ".win_to_utf($firm["rname1"]).", ".win_to_utf($firm["cadres"]).", м. ".win_to_utf($firm["mname1"]); $desc=win_to_utf($firm["cname"]).", м. ".win_to_utf($firm["mname1"]).", ".win_to_utf($firm["rname1"]).", ".win_to_utf($firm["cadres"]); $org=win_to_utf($firm["cname"]); $cm=$firm['ccateg']; for($i=1;$i<6;$i++) if($cm==0)$cm=$firm["cint$i"]; $s="SELECT *,razdel.id AS rzid FROM razdel_rubric,razdel WHERE (rubric=$cm AND razdel.id=razdel_rubric.razdel)"; $q=mysql_query($s); $r=mysql_fetch_array($q); $firm['razdel']=$r['name']; $firm['rzid']=$r['rzid']; if(empty($firm['razdel'])) { $_SESSION['404card']=$id; redirect("http://www.uslugi-moscow.ru/404.html"); } $firm['razdel']=win_to_utf($firm['razdel']); $creklmonth=$firm['crecl_month']; $rekS=intval(str_replace('-','',substr($firm['crecl_start'],0,10))); $rekF=intval(str_replace('-','',substr($firm['crecl_finish'],0,10))); $rekD=intval(date("Ymd")); $firm["isASponsor"]=($rekD>=$rekS&&$rekD<=$rekF); // echo $s; } // mysql_free_result($result); $ip=''; if(isset($_SERVER ["HTTP_X_FORWARDED_FOR"])) if(isset ($_SERVER ["HTTP_X_REAL_IP"]))$ip=$_SERVER ["HTTP_X_REAL_IP"]; else$ip=$_SERVER ["HTTP_X_FORWARDED_FOR"]; //@mail('vad_shesh@ukr.net',"USING SMAP.HTML FOR ID $id ip=$ip agent=$_SERVER[HTTP_USER_AGENT]",'USING SMAP.HTML FOR ID '.$id."\r\n"."ip=$ip"."\r\n"." agent=$_SERVER[HTTP_USER_AGENT]; referer=".getenv("HTTP_REFERER")); $mode=$self='smap'; $codePage='utf-8'; include_once('shab/1/header.php'); ?>

поиск по справочнику              Добавить фирму в справочник  

 

Назад в рубрику ""