assign("main",$main); if($kari_arr[1]){ $smarty->assign("bukkentype", $kari_arr[1]); if($kari_arr[1] == "apart_mansion"){ $pagetitle1 = "アパート・マンション "; $bcode = "11"; }else if($kari_arr[1] == "kashiya"){ $pagetitle1 = "貸家 "; $bcode = "12"; }else if($kari_arr[1] == "factory_souko"){ $pagetitle1 = "工場・倉庫 "; $bcode = "14"; }else if($kari_arr[1] == "tenpo_office"){ $pagetitle1 = "店舗・事務所 "; $bcode = "13"; }else if($kari_arr[1] == "tochi"){ $pagetitle1 = "貸地 "; $bcode = "15"; }else if($kari_arr[1] == "parking"){ $pagetitle1 = "駐車場 "; $bcode = "16"; } $smarty->assign("bcode",$bcode); }else{ $smarty->assign("bukkentype","apart_mansion"); $pagetitle1 = ""; $smarty->assign("bcode","11"); } //お気に入り・閲覧履歴 include_once($_SERVER['DOCUMENT_ROOT']."/favorite.php"); include_once($_SERVER['DOCUMENT_ROOT']."/history.php"); //件数の集計 $sql = "select bdata.main_cd,count(*) as count from bdata,vt_jiscode where bdata.jiscode = vt_jiscode.jiscode and vt_jiscode.site = '".$site."' and bdata.open_flg = '1' and bdata.open_date <= '".date("Y-m-d H:i:s")."' and bdata.close_date >= '".date("Y-m-d H:i:s")."' and (bdata.done_date = '0000-00-00 00:00:00' or bdata.done_date is null) and (bdata.del_date = '0000-00-00 00:00:00' or bdata.del_date is null) group by bdata.main_cd"; $result = mysql_query($sql); if(mysql_numrows($result)){ while($rows = mysql_fetch_array($result)){ $torokunum[$rows["main_cd"]] = $rows["count"]; } } $smarty->assign("torokunum1",$torokunum["売買"]); $smarty->assign("torokunum2",$torokunum["賃貸"]); //人気エリアランキングの取得 if(date("H") < 6){ $day = date("Y-m-d",strtotime("-2 day")); }else{ $day = date("Y-m-d",strtotime("-1 day")); } $ninki_area=""; $sql = "select rank,area from log_ninki_area where site = '".$site."' and main_cd = '".$main."' and day = '".$day."' order by rank limit 5"; $result = mysql_query($sql); if(@mysql_num_rows($result)){ while($rows = mysql_fetch_array($result)){ $ninki_area[] = $rows; } } $smarty->assign("ninki_area",$ninki_area); //人気物件の取得 $ninki_bukken=""; $sql = "select*from log_ninki_bukken where site = '".$site."' and main_cd = '".$main."' and day = '".$day."' order by pageviews desc limit 500"; $result = mysql_query($sql); $i = 0; $j = 0; if(@mysql_num_rows($result)){ while($rows = mysql_fetch_array($result)){ $sql = "select bdata.bdata_id as bdataid,bdata.bukkendata_id as old_bukkendata_id,bdata.*,rdata.* from bdata left join rdata on bdata.bdata_id = rdata.bdata_id where bdata.open_flg = '1' and bdata.open_date <= '".date("Y-m-d H:i:s")."' and bdata.close_date >= '".date("Y-m-d H:i:s")."' and (done_date = '0000-00-00 00:00:00' or done_date is null) and (del_date = '0000-00-00 00:00:00' or del_date is null) and status_code <= '2' and bdata.bdata_id = '".mysql_real_escape_string($rows['bdata_id'])."'"; $res2 = mysql_query($sql); if(@mysql_num_rows($res2)){ $row2 = mysql_fetch_array($res2); if(strstr($row2['prefecture'],"長野県")) $row2['prefecture']=""; if($row2['address2'] && !strstr($row2['address2'],"丁目")) $row2['address2'] .= "丁目"; //画像2枚 $image = array(); $sql = "select imgfile from dt_image where bdata_id = '".$rows['bdata_id']."' and deletetime is null and imgdisp = '1' order by mag_flg desc,sort limit 2"; $res3 = mysql_query($sql); if(mysql_numrows($res3)){ while($row3 = mysql_fetch_array($res3)){ $image[] = $row3; } $row2["image1"] = $image[0]["imgfile"]; $row2["image2"] = $image[1]["imgfile"]; } $ninki_bukken['rent'][$i] = $rows; $ninki_bukken['rent'][$i]['bukken'] = $row2; $i++; } } } $smarty->assign("ninki_bukken",$ninki_bukken); //価格帯取得 $amt_array = ""; $i = 0; $j = 0; if($main=="賃貸"){ $sql = " select `day`,site,log_access_day.main_cd,log_access_day.bcode,TRUNCATE(bdata.kakaku_amt,-4) as kakakutai, COUNT(*) as count from log_access_day,bdata where bdata.bdata_id = log_access_day.bdata_id and log_access_day.day = '".$day."' and bdata.kakaku_amt != '0' and bdata.kakaku_amt is not null and log_access_day.site=\"${site}\" and log_access_day.main_cd ='賃貸' group by log_access_day.day,kakakutai,log_access_day.site,log_access_day.main_cd order by log_access_day.site,count desc LIMIT 0 , 500 "; $result = mysql_query($sql); if($rows = mysql_num_rows($result)){ while($arr = mysql_fetch_array($result)){ $arr['kakakutai_max'] = $arr['kakakutai']+9999; $amt_array['apa'][$j] = $arr; $j++; } } } $smarty->assign("amt_array", $amt_array); $smarty->assign("pagetitle1", $pagetitle1); $smarty->assign("pagetitle2", "|長野県諏訪市・岡谷市・下諏訪町・茅野市・原村・富士見町などのアパート・マンション・一戸建て等の不動産物件が簡単に探せます。"); $smarty->display("_2_rent.tpl"); ?>