/* ********************************************************************************* * システム:katsuyo.net * *===============================================================================* * クラス:tonari_list |モジュール:tonari_list.php * * 概要 :隣の晩ごはん 隣の晩ごはん各リスト表示画面 * * パス :APP_HOME/tonari/ * * 作成 :2006/08/09 J.Nikaido * *-------------------------------------------------------------------------------* * 更新 : * ********************************************************************************* */ require_once('../prepare.php'); require_once('lib/bbs_recipe_function.php'); //- メンバーチェック if("e" == $p['carrier']){ chdir(dirname(__FILE__) . "/authcheck"); require_once("../authcheck/authcheck.php"); chdir(dirname(__FILE__)); } $db = u4user_open(); if(!get_UserDetail_uid($db, $p['uid'], '0', '1') && MEMBER_CHECK){ header("Location: " . MEMBER_REGIST_URL . "?p[contents]=" . substr(strrchr(dirname( __FILE__ ) , '/'), 1)); exit; } function tonari_list( $p ){ //本日日付取得 $base_day = date("d"); $base_month = date("m"); $base_year = date("Y"); $base_hour = date("G"); $base_min = date("i"); $base_time = date("G:i:s"); //YYYYMMDD形式に変換 $date = $base_year."-".$base_month."-".$base_day; //DB接続 $this->db = cs4_open(); $terms = $p; $title_arr = array( 'new' => '新着晩ごはんはコチラ!', 'pop' => '今日の人気晩ごはんはコチラ!', ); //var_dump($terms); //ページ番号セット $terms['page'] = (empty($terms['page'])) ? "1" : $terms['page'] ; //---- 該当条件レシピ一覧を取得 //DB接続 $db = DB::connect(constant('KTY_DSN')); if(DB::isError($db)){ echo "DB接続エラー:".DB::errorMessage($db)."\n"; exit; } if($p['con_id'] == "new"){ //******************************// // 新着晩ごはん取得 // //******************************// //$where = " pub_date like '$date%' and pub_flg = 0 and dlt_flg = 0"; $where = " pub_flg = 0 and dlt_flg = 0"; //5件までの場合 //$order = " pub_date desc limit 0,5"; //全データ $order = " pub_date desc"; $sql = "SELECT uniq_id, post_title, post_no, post_img, user_nm"; $sql.= sprintf(" FROM contents_data_tonari_contribute Where %s order by %s",$where,$order); $ret = $db->query($sql); if(DB::isError($ret)){ echo "
クエリの送信が失敗しました。
"; exit; } //件数取得 $count = $ret->numRows(); //顧客DB接続 $this->db = u4user_open(); while($row = $ret->fetchRow(DB_FETCHMODE_ASSOC)){ $array[post_no][] = $row['post_no']; $array[uniq_id][] = $row['uniq_id']; $array[title][] = $row['post_title']; $array[img][] = $row['post_img']; $array[user_nm][] = $row['user_nm']; } }else if($p['con_id'] == "pop"){ //******************************// // 人気晩ごはん取得 // //******************************// //$where = sprintf(" v.post_id = c.uniq_id and c.pub_date like '%s' ","$date%"); $where = " v.post_id = c.uniq_id"; $order = " v.poll desc limit 0,10"; $from = " contents_data_tonari_vote v ,contents_data_tonari_contribute c"; $sql = "select v.post_id,v.poll,c.post_date, c.post_no, c.post_title, c.uniq_id, c.post_img, c.user_nm "; $sql .= sprintf(" from %s where %s order by %s",$from,$where,$order); $res = $db->query($sql); if(DB::isError($res)){ echo "クエリの送信が失敗しました。
"; exit; } //件数取得 $count = $res->numRows(); if(!empty($count)){ while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)){ $array[post_no][] = $row['post_no']; $array[uniq_id][] = $row['uniq_id']; $array[title][] = $row['post_title']; $array[img][] = $row['post_img']; $array[user_nm][] = $row['user_nm']; } } } //顧客DBの解放 u4user_close($this->db); //DB開放 $db->disconnect(); //デバッグ処理 if(constant('BBS_DEBUG_MODE')){ print "