//config file define ( "DB_HOST", "localhost" ); define ( "DB_USER", "iwanah_admin" ); define ( "DB_PASSWORD", "x2yt63BA" ); define ( "PROJECT_NAME", "house_jp" ); define ( "DB_DATABASE", "iwanah_db" ); define ( "SHOWNUMBER", 50 ); define ( "RECEIVE_MAIL", "office@iwanahome.co.jp" ); define ( "RECEIVE_MAIL2", "" ); define ( "RECEIVE_MAIL3", "" ); // WEB_ROOT: ref by browser define('WEB_ROOT', ''); define('LIST_THUMB_SIZE', 35); // height define('DETAIL_THUMB_SIZE', 120); // height define('TOP_RECOMMEND_LIMIT', 10); define('TBL_BIESHU', 1); define('TBL_TUDI', 2); define('TBL_GONGYU', 3); define('TBL_ZULIN', 4); define('TBL_BANGONG', 5); $arrLuxian = array(); $arrLuxian[1] = "京成本線(京成西船〜京成佐倉)"; $arrLuxian[2] = "東葉高速鉄道(西船〜東葉勝田台)"; $arrLuxian[3] = "JR総武線(本八幡〜千葉)"; $arrLuxian[4] = "新京成線(新津田沼〜鎌ヶ谷大仏)"; $arrLuxian[5] = "東西線(西船橋〜南行徳)"; $arrLuxian[6] = "その他"; $arrLuxianSimple = array(); $arrLuxianSimple[1] = "京成本線"; $arrLuxianSimple[2] = "東葉高速鉄道"; $arrLuxianSimple[3] = "JR総武線"; $arrLuxianSimple[4] = "新京成線"; $arrLuxianSimple[5] = "東西線"; $arrLuxianSimple[6] = "その他"; $arrZhantai = array(); $arrZhantai[1][1] = "勝田台駅"; $arrZhantai[1][2] = "大和田駅"; $arrZhantai[1][3] = "八千代台駅"; $arrZhantai[1][56] = "実籾駅"; $arrZhantai[1][57] = "大久保駅"; $arrZhantai[1][58] = "京成津田沼駅"; $arrZhantai[1][59] = "谷津駅"; $arrZhantai[1][8] = "船橋競馬場駅"; $arrZhantai[1][9] = "大神宮下駅"; $arrZhantai[1][10] = "船橋駅"; $arrZhantai[1][11] = "海神駅"; $arrZhantai[1][12] = "京成西船駅"; $arrZhantai[1][13] = "志津駅"; $arrZhantai[1][14] = "ユーカリヶ丘駅"; $arrZhantai[1][15] = "京成臼井駅"; $arrZhantai[1][16] = "京成佐倉駅"; $arrZhantai[2][7] = "東葉勝田台駅"; $arrZhantai[2][4] = "村上駅"; $arrZhantai[2][5] = "八千代中央駅"; $arrZhantai[2][6] = "八千代緑が丘駅"; $arrZhantai[2][21] = "船橋日大前駅"; $arrZhantai[2][22] = "北習志野駅"; $arrZhantai[2][23] = "飯山満駅"; $arrZhantai[2][24] = "西船駅"; $arrZhantai[3][25] = "本八幡駅"; $arrZhantai[3][26] = "下総中山駅"; $arrZhantai[3][27] = "西船橋駅"; $arrZhantai[3][28] = "船橋駅"; $arrZhantai[3][29] = "東船橋駅"; $arrZhantai[3][30] = "津田沼駅"; $arrZhantai[3][31] = "幕張本郷駅"; $arrZhantai[3][32] = "幕張駅"; $arrZhantai[3][33] = "新検見川駅"; $arrZhantai[3][34] = "稲毛駅"; $arrZhantai[3][35] = "西千葉駅"; $arrZhantai[3][36] = "千葉駅"; $arrZhantai[4][37] = "新津田沼駅"; $arrZhantai[4][38] = "前原駅"; $arrZhantai[4][39] = "薬園台駅"; $arrZhantai[4][40] = "習志野駅"; $arrZhantai[4][41] = "北習志野駅"; $arrZhantai[4][42] = "高根木戸駅"; $arrZhantai[4][43] = "高根公団駅"; $arrZhantai[4][44] = "滝不動駅"; $arrZhantai[4][45] = "三咲駅"; $arrZhantai[4][46] = "二和向台駅"; $arrZhantai[4][47] = "鎌ヶ谷大仏駅"; $arrZhantai[5][48] = "西船橋駅"; $arrZhantai[5][49] = "原木中山駅"; $arrZhantai[5][50] = "妙典駅"; $arrZhantai[5][51] = "行徳駅"; $arrZhantai[5][52] = "南行徳駅"; $arrZhantai[6][53] = "JR総武本線 東千葉駅"; $arrZhantai[6][54] = "JR総武線 市川駅"; $arrZhantai[6][55] = "JR内房線 浜野駅"; $arrZhantai[6][56] = "JR総武本線 佐倉駅"; $arrZhantai[6][57] = "JR内房線 木更津駅"; $arrZhantai[6][58] = "JR内房線 五井駅"; $arrZhantai[6][59] = "JR総武本線 南酒々井駅"; $arrZhantai[6][60] = "JR総武本線 都賀駅"; $arrZhantai[6][61] = "JR総武本線 八街駅"; $arrZhantai[6][62] = "JR成田線 成田駅"; $arrZhantai[6][63] = "千葉都市モノレール 千城台駅"; $arrXuequ = array(); $arrXuequ[1] = "米本小学校"; $arrXuequ[2] = "米本南小学校"; $arrXuequ[3] = "阿蘇小学校"; $arrXuequ[4] = "睦小学校"; $arrXuequ[5] = "村上北小学校"; $arrXuequ[6] = "村上東小学校"; $arrXuequ[7] = "村上小学校"; $arrXuequ[8] = "勝田台小学校"; $arrXuequ[9] = "勝田台南小学校"; $arrXuequ[10] = "萱田小学校"; $arrXuequ[11] = "大和田小学校"; $arrXuequ[12] = "大和田南小学校"; $arrXuequ[13] = "大和田西小学校"; $arrXuequ[14] = "新木戸小学校"; $arrXuequ[15] = "高津小学校"; $arrXuequ[16] = "西高津小学校"; $arrXuequ[17] = "南高津小学校"; $arrXuequ[18] = "八千代台東第二小学校"; $arrXuequ[19] = "八千代台東小学校"; $arrXuequ[20] = "八千代台小学校"; $arrXuequ[21] = "八千代台西小学校"; $arrXuequ[22] = "萱田南小学校"; $arrXuequ[23] = "緑ヶ丘小学校"; $arrDitu = array(); $arrDitu[1] = "村上・勝田台エリア"; $arrDitu[2] = "大和田"; $arrDitu[3] = "八千代中央・ゆりのき台エリア"; $arrDitu[4] = "八千代緑が丘・大和田新田・高津団地"; $arrDitu[5] = "八千代台エリア"; $arrDitu[6] = "その他八千代"; $arrDitu[7] = "船橋市"; $arrDitu[8] = "千葉市"; $arrDitu[9] = "佐倉市"; $arrDitu[10] = "習志野市"; $arrSearchType = array(); $arrSearchType[1] = $sBieshu; $arrSearchType[2] = $sTudi; $arrSearchType[3] = $sGongyu; $arrXinzhuOrZhonggu = array(); $arrXinzhuOrZhonggu[1] = "新築"; $arrXinzhuOrZhonggu[2] = "中古"; $arrXinzhuOrZhonggu[3] = "未入居"; $arrFangxing = array(); $arrFangxing[4] = "1R"; $arrFangxing[8] = "1K"; $arrFangxing[10] = "1DK"; $arrFangxing[20] = "1LDK"; $arrFangxing[30] = "2DK"; $arrFangxing[40] = "2LDK"; $arrFangxing[50] = "3DK"; $arrFangxing[60] = "3LDK"; $arrFangxing[70] = "4DK"; $arrFangxing[80] = "4LDK"; $arrFangxing[90] = "5DK"; $arrFangxing[100] = "5LDK"; $arrFangxing[110] = "6DK"; $arrFangxing[120] = "6LDK"; $arrFangxing[130] = "6LDK以上"; $arrFangxing[140] = "その他"; $arrGouzhao = array(); $arrGouzhao[10] = "木造2階建て"; $arrGouzhao[20] = "RC"; $arrGouzhao[30] = "軽量鉄骨造"; $arrGouzhao[40] = "重量鉄骨造"; $arrGouzhao[50] = "SRC"; $arrGouzhao[60] = "SRC(一部RC)"; $arrGouzhao[70] = "木造平屋"; $arrGouzhao[80] = "木造3階建て"; $arrGouzhao[90] = "その他"; $arrGouzhao[100] = ""; $arrGouzhao[110] = "鉄骨造"; $arrFukuanfangshi = array(); $arrFukuanfangshi[1] = "媒介"; $arrFukuanfangshi[2] = "代理"; $arrFukuanfangshi[3] = "売主"; $arrFukuanfangshi[4] = "専任媒介"; $arrFukuanfangshi_rent = array(); $arrFukuanfangshi_rent[1] = "媒介"; $arrFukuanfangshi_rent[2] = "代理"; $arrFukuanfangshi_rent[3] = "貸主"; $arrFukuanfangshi_rent[4] = "専任媒介"; $arrYongtu = array(); $arrYongtu[1] = "一種低層"; $arrYongtu[2] = "一種住居"; $arrYongtu[3] = "一種中高層"; $arrYongtu[4] = "二種低層"; $arrYongtu[5] = "二種住居"; $arrYongtu[6] = "二種中高層"; $arrYongtu[7] = "準住居地域"; $arrYongtu[8] = "近隣商業地域"; $arrYongtu[9] = "商業地域"; $arrYongtu[10] = "準工業地域"; $arrYongtu[11] = "工業地域"; $arrYongtu[12] = "工業専用地域"; $arrYongtu[13] = "市街化調整区域"; $arrYongtu[14] = "その他"; $arrDimu = array(); $arrDimu[1] = "宅地"; $arrDimu[2] = "山林"; $arrDimu[3] = "原野"; $arrDimu[4] = "田"; $arrDimu[5] = "畑"; $arrDimu[6] = "雑種地"; $arrDimu[7] = "宅地・山林"; $arrDimu[8] = "宅地・畑"; $arrDimu[9] = "宅地・田"; $arrDimu[10] = "宅地・原野"; $arrBangongType = array(); $arrBangongType[1] = "店舗付住宅"; $arrBangongType[2] = "売りビル"; $arrZhongbie = array(); $arrZhongbie[1] = "マンション"; $arrZhongbie[2] = "アパート"; $arrZhongbie[3] = "戸建"; $arrZhongbie[4] = "テラスハウス"; $arrZhongbie[5] = "店舗・事務所"; $arrZhongbie[6] = "店舗・事務所付住宅"; $arrShebeiPic = array(); $arrShebeiPic[1] = "img/icon/ic_o.gif"; $arrShebeiPic[2] = "img/icon/ic_l.gif"; $arrShebeiPic[3] = "img/icon/ic_c.gif"; $arrShebeiPic[4] = "img/icon/ic_g.gif"; $arrShebeiPic[5] = "img/icon/ic_j.gif"; $arrShebeiPic[6] = "img/icon/ic_n.gif"; $arrShebeiPic[7] = "img/icon/ic_f.gif"; $arrShebeiPic[8] = "img/icon/ic_t.gif"; $arrShebeiPic[9] = "img/icon/ic_d.gif"; $arrShebeiPic[10] = "img/icon/ic_i.gif"; $arrShebeiPic[11] = "img/icon/ic_a.gif"; $arrShebeiPic[12] = "img/icon/ic_b.gif"; $arrShebeiPic[13] = "img/icon/ic_e.gif"; $arrShebeiPic[14] = "img/icon/ic_p.gif"; $arrShebeiPic[15] = "img/icon/ic_q.gif"; $arrShebeiPic[16] = "img/icon/ic_r.gif"; $arrShebeiPic[17] = "img/icon/ic_s.gif"; $arrShebeiPic[18] = "img/icon/ic_m.gif"; $arrShebeiPic[19] = "img/icon/ic_k.gif"; $arrShebeiPic[20] = "img/icon/ic_h.gif"; $arrShebeiPic[21] = "img/icon/ic_u.gif"; $arrShebeiPic[22] = "img/icon/ic_v.gif"; $arrShebeiPic[23] = "img/icon/ic_v.gif"; $arrShebeiJieshao = array(); $arrShebeiJieshao[1] = "駐車場あり"; $arrShebeiJieshao[2] = "ペット可"; $arrShebeiJieshao[3] = "風呂・トイレ別"; $arrShebeiJieshao[4] = "エアコン完備"; $arrShebeiJieshao[5] = "エレベーターあり"; $arrShebeiJieshao[6] = "オートロック"; $arrShebeiJieshao[7] = "モニター付インターホン"; $arrShebeiJieshao[8] = "ディンプルキー"; $arrShebeiJieshao[9] = "BS完備"; $arrShebeiJieshao[10] = "インターネット対応"; $arrShebeiJieshao[11] = "給湯器あり"; $arrShebeiJieshao[12] = "シャワーあり"; $arrShebeiJieshao[13] = "全室照明"; $arrShebeiJieshao[14] = "シャンプードレーサーあり"; $arrShebeiJieshao[15] = "室内洗濯機置き場あり"; $arrShebeiJieshao[16] = "クローゼットあり"; $arrShebeiJieshao[17] = "フローリング仕上げ"; $arrShebeiJieshao[18] = "楽器可"; $arrShebeiJieshao[19] = "駐輪場あり"; $arrShebeiJieshao[20] = "LPガス"; $arrShebeiJieshao[21] = "ガスコンロ"; $arrShebeiJieshao[22] = "電気コンロ"; $arrSheng = array(); $arrSheng[1] = "北海道"; $arrSheng[2] = "青森県"; $arrSheng[3] = "岩手県"; $arrSheng[4] = "秋田県"; $arrSheng[5] = "宮城県"; $arrSheng[6] = "山形県"; $arrSheng[7] = "福島県"; $arrSheng[8] = "茨城県"; $arrSheng[9] = "栃木県"; $arrSheng[10] = "群馬県"; $arrSheng[11] = "埼玉県"; $arrSheng[12] = "千葉県"; $arrSheng[13] = "東京都"; $arrSheng[14] = "神奈川県"; $arrSheng[15] = "長野県"; $arrSheng[16] = "山梨県"; $arrSheng[17] = "新潟県"; $arrSheng[18] = "富山県"; $arrSheng[19] = "石川県"; $arrSheng[20] = "福井県"; $arrSheng[21] = "静岡県"; $arrSheng[22] = "愛知県"; $arrSheng[23] = "岐阜県"; $arrSheng[24] = "三重県"; $arrSheng[25] = "滋賀県"; $arrSheng[26] = "京都府"; $arrSheng[27] = "大阪府"; $arrSheng[28] = "兵庫県"; $arrSheng[29] = "奈良県"; $arrSheng[30] = "和歌山県"; $arrSheng[31] = "島根県"; $arrSheng[32] = "鳥取県"; $arrSheng[33] = "岡山県"; $arrSheng[34] = "広島県"; $arrSheng[35] = "山口県"; $arrSheng[36] = "香川県"; $arrSheng[37] = "徳島県"; $arrSheng[38] = "高知県"; $arrSheng[39] = "愛知県"; $arrSheng[40] = "福岡県"; $arrSheng[41] = "佐賀県"; $arrSheng[42] = "長崎県"; $arrSheng[43] = "大分県"; $arrSheng[44] = "熊本県"; $arrSheng[45] = "宮崎県"; $arrSheng[46] = "鹿児島県"; $arrSheng[47] = "沖縄"; $arrXingqi = array(); $arrXingqi[1] = "指定なし"; $arrXingqi[2] = "日曜日"; $arrXingqi[3] = "月曜日"; $arrXingqi[4] = "火曜日"; $arrXingqi[5] = "水曜日"; $arrXingqi[6] = "木曜日"; $arrXingqi[7] = "金曜日"; $arrXingqi[8] = "土曜日"; function error_disp($p_sInfo, $p_sUrl) { if ( !empty($p_sUrl) ){ echo " "; } else { echo " "; } exit; } function upload_file() { global $arrImgPath; if ( sizeof($_FILES["col_picture"]["name"]) ) { $arrImgPath = array(); for ( $i = 0; $i < 5; $i++ ) { if ( !empty($_FILES['col_picture']['name'][$i]) ) { $arrTemp = explode(".", $_FILES['col_picture']['name'][$i]); $arrTemp[1] = strtolower($arrTemp[1]); if ( ($arrTemp[1] != "gif") && ($arrTemp[1] != "jpg") && ($arrTemp[1] != "png") ) { error_disp("gif/jpg/pngファイル以外はアップロードできません",""); } $sDir = "../upload"; $mictime = microtime(); $sFileName = substr($mictime, 11) . substr($mictime,2,6) . ".".$arrTemp[1]; if ( $_FILES['col_picture']['size'][$i] > 1000000 ) error_disp("画像サイズが1MBを超えています",""); copy($_FILES['col_picture']['tmp_name'][$i],$sDir."/".$sFileName); $arrImgPath[$i] = "upload/".$sFileName; } } } } ?> //public class dbOperate { var $db_conn = ""; var $bIfQuaryOk = true; var $db_table = ""; var $db_seq_tiaojian = ""; var $db_opertype = ""; var $db_str = ""; /********************************************************************** * * method name: class_db_connect * date: 2004-11-30 * author: dan * describe: connect to the database * input param: p_sDbHost database address * p_sDbUser user * p_sDbPassword password * p_sDbDatabase db name * output param: $this -> db_conn connection * edit record: * Date Name Reason * **********************************************************************/ function class_db_connect($p_sDbHost, $p_sDbUser, $p_sDbPassword, $p_sDbDatabase) { $this -> db_conn = @mysql_connect($p_sDbHost, $p_sDbUser, $p_sDbPassword) or die ("Sorry, Unable to connect database server"); $sqlDb = @mysql_select_db($p_sDbDatabase, $this -> db_conn) or die ("Sorry, Unable to connect database:$p_sDbDatabase"); } /********************************************************************** * * method name: class_db_query * date: 2004-11-30 * author: dan * describe: operate database * input param: p_sQuaryString operate type * output param: $this -> bIfQuaryOk check the operate is ok * false fault * edit record: * Date Name Reason * **********************************************************************/ function class_db_query($p_sQuaryString) { $sqlQuaryRes = mysql_query($p_sQuaryString, $this->db_conn); if (!$sqlQuaryRes) { $this -> bIfQuaryOk = false; } } /********************************************************************** * * method name: class_db_select * date: 2004-11-30 * author: dan * describe: search database * * input param: p_sSelectString search statement * output param: $this -> bIfQuaryOk check the operate is ok * false fault * arrSelRes search result(array) * edit record: * Date Name Reason * **********************************************************************/ function class_db_select($p_sSelectString) { $sqlSelectRes = mysql_query($p_sSelectString, $this->db_conn); if (!$sqlSelectRes) { $this -> bIfQuaryOk = false; } $iCount = mysql_num_rows($sqlSelectRes); $arrSelRes = array(); for ($i = 0; $i < $iCount; $i++) { $arrSelRes[$i] = mysql_fetch_array($sqlSelectRes); } return $arrSelRes; } /********************************************************************** * * method name: use_table * date: 2005-05-22 * author: dan * describe: set table * * input param: p_sTableName table name * p_sSeqTiaojian edit condition * * output param: * edit record: * Date Name Reason * **********************************************************************/ function use_table($p_sTableName, $p_sSeqTiaojian) { $this->db_table = $p_sTableName; $this->db_seq_tiaojian = $p_sSeqTiaojian; } /********************************************************************** * * method name: db_opertype * date: 2005-05-22 * author: dan * describe: operate type * * input param: p_sOpertype operate type * * output param: * edit record: * Date Name Reason * **********************************************************************/ function db_opertype($p_sOpertype) { $this->db_opertype = $p_sOpertype; if ( $p_sOpertype == "insert" ) $this->db_str = "insert into ".$this->db_table." set"; if ( $p_sOpertype == "update" ) $this->db_str = "update ".$this->db_table." set"; } /********************************************************************** * * method name: db_operate_str * date: 2005-05-22 * author: dan * describe: create string * * input param: p_sZiduan * output param: * edit record: * Date Name Reason * **********************************************************************/ function db_operate_str($p_sZiduan) { global $$p_sZiduan; $this->db_str .= " $p_sZiduan='".$$p_sZiduan."',"; } /********************************************************************** * * method name: db_delete * date: 2005-08-12 * author: dan * describe: delete record * * input param: p_sTiaojian condition * output param: * edit record: * Date Name Reason * **********************************************************************/ function db_delete() { $sSql = "delete from ".$this->db_table." where ".$this->db_seq_tiaojian; $this->class_db_query($sSql); } /********************************************************************** * * method name: db_operate * date: 2005-05-22 * author: dan * describe: database operate * * output param: * edit record: * Date Name Reason * **********************************************************************/ function db_operate() { $this->db_str .= " col_date='".date("Y-m-d")."'"; if (!empty($this->db_seq_tiaojian)) $this->db_str .= " where ".$this->db_seq_tiaojian; $this->class_db_query($this->db_str); } } class commFunc extends dbOperate { /********************************************************************** * * method name: showPages * date: 2004-11-30 * author: dan * describe: page function * * input param: p_iOrigSize oringinal array size p_iNPerPage numbers per page p_iPage page * output param: * edit record: * Date Name Reason * **********************************************************************/ function showPages($p_iOrigSize, $p_iNPerPage, $p_iPage) { global $PHP_SELF; $iArrSize = $p_iOrigSize; $iTotalPage = ceil($iArrSize / $p_iNPerPage); //first page if ($p_iPage < 2) { //only one page if ($iArrSize <= $p_iNPerPage) { $sPages = ""; } //more than one page else { $iNextPage = $p_iPage + 1; //address if (ereg("page=", $_SERVER["QUERY_STRING"])) { $sTemp = str_replace("page=".$p_iPage, "page=".$iNextPage, $_SERVER["QUERY_STRING"]); $sNextStr = $PHP_SELF."?".$sTemp; } else { $sNextStr = $PHP_SELF."?page=".$iNextPage."&".$_SERVER["QUERY_STRING"]; } $sPages = "総数".$iArrSize."件,計".$iTotalPage."頁,第".$p_iPage."頁 次の頁"; } } //middle pages if (($p_iPage < $iTotalPage) and ($p_iPage >= 2)) { $iNextPage = $p_iPage + 1; $iForePage = $p_iPage - 1; //address if (ereg("page=", $_SERVER["QUERY_STRING"])) { $sNextTemp = str_replace("page=".$p_iPage, "page=".$iNextPage, $_SERVER["QUERY_STRING"]); $sForeTemp = str_replace("page=".$p_iPage, "page=".$iForePage, $_SERVER["QUERY_STRING"]); $sNextStr = $PHP_SELF."?".$sNextTemp; $sForeStr = $PHP_SELF."?".$sForeTemp; } else { $sNextStr = $PHP_SELF."?page=".$iNextPage."&".$_SERVER["QUERY_STRING"]; $sForeStr = $PHP_SELF."?page=".$iForePage."&".$_SERVER["QUERY_STRING"]; } $sPages = "総数".$iArrSize."件,計".$iTotalPage."頁,第".$p_iPage."頁 前の頁 次の頁"; } //end page if (($p_iPage == $iTotalPage) && ($p_iPage > 1)) { $iForePage = $p_iPage - 1; //address if (ereg("page=", $_SERVER["QUERY_STRING"])) { $sTemp = str_replace("page=".$p_iPage, "page=".$iForePage, $_SERVER["QUERY_STRING"]); $sForeStr = $PHP_SELF."?".$sTemp; } else { $sForeStr = $PHP_SELF."?page=".$iForePage."&".$_SERVER["QUERY_STRING"]; } $sPages = "総数".$iArrSize."件,計".$iTotalPage."頁,第".$p_iPage."頁 前の頁"; } if (strlen($sPages)) { if (ereg("page", $_SERVER["QUERY_STRING"])) { $sTemp = str_replace("page=".$p_iPage, "", $_SERVER["QUERY_STRING"]); $sFormAction = $PHP_SELF."?".$sTemp; } else { $sFormAction = $PHP_SELF."?".$_SERVER["QUERY_STRING"]; } $sPages = "
"; } return $sPages; } /********************************************************************** * * method name: getPageInfo * date: 2005-05-25 * author: dan * describe: get page * * input param: p_sSearchStr search statement p_iNumPerPage the numbers of every page * output param: * edit record: * Date Name Reason * **********************************************************************/ function getPageInfo($p_sSearchStr, $p_iNumPerPage) { global $page; if ( empty($page) ) { $page = 1; $p_sSearchStr .= " limit $p_iNumPerPage"; } else { $iStart = ($page - 1) * $p_iNumPerPage; $p_sSearchStr .= " limit $iStart,$p_iNumPerPage"; } return $p_sSearchStr; } /********************************************************************** * * method name: error_disp * date: 2004-11-30 * author: dan * describe: error function * * input param: p_sInfo statement * $p_sUrl skip page * output param: * edit record: * Date Name Reason * **********************************************************************/ function error_disp($p_sInfo, $p_sUrl) { echo " "; exit; } /********************************************************************** * * method name: cnSubStr * date: 2005-08-10 * author: dan * describe: get string * * input param: string string * sublen length * output param: * edit record: * Date Name Reason * **********************************************************************/ function cnSubStr($string,$sublen) { if( $sublen >= strlen( $string ) ) { return $string; } $s = ""; for( $i=0; $i<$sublen; $i++ ) { if( ord($string{$i} ) > 127 ) { $s .= $string{$i} . $string{++$i}; continue; } else { $s .= $string{$i}; continue; } } return $s; } function getZhantai() { global $arrZhantai; $sScriptContent = " "; return $sScriptContent; } } class resizeimage { //type of picture var $type; //width var $width; //height var $height; //change with var $resize_width; //change height var $resize_height; // var $cut; //original picture var $srcimg; //target picture var $dstimg; // var $im; function resizeimage($img, $wid, $hei,$c) { $this->srcimg = $img; $this->resize_width = $wid; $this->resize_height = $hei; $this->cut = $c; //type of picture $this->type = substr(strrchr($this->srcimg,"."),1); $this->initi_img(); $this -> dst_img(); //-- $this->width = imagesx($this->im); $this->height = imagesy($this->im); $this->newimg(); ImageDestroy ($this->im); } function newimg() { $resize_ratio = ($this->resize_width)/($this->resize_height); $ratio = ($this->width)/($this->height); if(($this->cut)=="1") { if($ratio>=$resize_ratio) { $newimg = imagecreatetruecolor($this->resize_width,$this->resize_height); imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, $this->resize_width,$this->resize_height, (($this->height)*$resize_ratio), $this->height); ImageJpeg ($newimg,$this->dstimg); } if($ratio<$resize_ratio) { $newimg = imagecreatetruecolor($this->resize_width,$this->resize_height); imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, $this->resize_width, $this->resize_height, $this->width, (($this->width)/$resize_ratio)); ImageJpeg ($newimg,$this->dstimg); } } else { if($ratio>=$resize_ratio) { $newimg = imagecreatetruecolor($this->resize_width,($this->resize_width)/$ratio); imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, $this->resize_width, ($this->resize_width)/$ratio, $this->width, $this->height); ImageJpeg ($newimg,$this->dstimg); } if($ratio<$resize_ratio) { $newimg = imagecreatetruecolor(($this->resize_height)*$ratio,$this->resize_height); imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, ($this->resize_height)*$ratio, $this->resize_height, $this->width, $this->height); ImageJpeg ($newimg,$this->dstimg); } } } function initi_img() { if($this->type=="jpg") { $this->im = imagecreatefromjpeg($this->srcimg); } if($this->type=="gif") { $this->im = imagecreatefromgif($this->srcimg); } if($this->type=="png") { $this->im = imagecreatefrompng($this->srcimg); } } function dst_img() { $full_length = strlen($this->srcimg); $type_length = strlen($this->type); $name_length = $full_length-$type_length; $name = substr($this->srcimg,0,$name_length-1); $this->dstimg = $name."_s.".$this->type; } } ?>