\r\n"; // Print Reply database $conn = mysql_connect($dbhost, $dbuser, $dbpass); mysql_query("SET NAMES 'utf8'"); mysql_select_db($dbname) or die ("Unable to connect to MySQL"); $list_query = ("SELECT * FROM ex_post WHERE (ex_media != '' AND ex_close = '0') ORDER BY ex_postid DESC LIMIT ".(($_GET["page"]-1)*$allLimit).", $allLimit"); //$list_query = ("SELECT * FROM ex_post WHERE ex_media != '' ORDER BY id DESC"); $result = mysql_query($list_query) or die("No Data"); $k = 0; while ( $row = mysql_fetch_array($result) ) { $ex_postidxx = $row[ex_postid]; $ex_replynumxx = $row[ex_replynum]; $ex_asknumxx = $row[ex_asknum]; $ex_clicknumxx = $row[ex_clicknum]; $ex_cataloguesxx = $row[ex_catalogues]; $ex_catalogues_name = $l_add_catalogues_array[$ex_cataloguesxx]; $ex_yearxx = $row[ex_year]; $ex_year_name = "$l_add_year_array[$ex_yearxx]"; $ex_sourcexx = $row[ex_source]; $ex_source_name = $l_add_source_array[$ex_sourcexx]; $ex_namexx = $row[ex_name]; $ex_descriptionxx = $row[ex_description]; $p_catalogues_name = ""; $p_cataloguesxx = $row[p_catalogues]; //String 字串 $p_cataloguesxx_num = substr_count("$p_cataloguesxx", ","); // 字串數 $temps = split (",","$p_cataloguesxx"); for ($i = 0; $i <= $p_cataloguesxx_num; $i++) { for ($j=1;$j <= $l_add_catalogues_num;$j++) { if ($temps[$i] == $j) { if ($p_catalogues_name == '') { $p_catalogues_name = $l_add_catalogues_array[$j]; } else { $p_catalogues_name = "$p_catalogues_name" . ", " . "$l_add_catalogues_array[$j]"; } } // end if } // end for } // End for $p_year_name = ""; $p_yearxx = $row[p_year]; //String 字串 $p_yearxx_num = substr_count("$p_yearxx", ","); // 字串數 $temps = split (",","$p_yearxx"); for ($i=0; $i <= $p_yearxx_num; $i++) { for ($j=0;$j <= $l_add_year_num;$j++) { if ($temps[$i] == $j) { if ($p_year_name == '') { $p_year_name = "$l_add_year_array[$j]"; } else { $p_year_name .= ", " . "$l_add_year_array[$j]"; } } } } $p_source_name = ""; $p_sourcexx = $row[p_source]; //String 字串 $p_sourcexx_num = substr_count("$p_sourcexx", ","); // 字串數 $temps = split (",","$p_sourcexx"); for ($i=0; $i <= $p_sourcexx_num; $i++) { for ($j=0;$j <= $l_add_source_num;$j++) { if ($temps[$i] == $j) { if ($p_source_name == '') { $p_source_name = $l_add_source_array[$j]; } else { $p_source_name .= ", " . "$l_add_source_array[$j]"; } } } } $p_namexx = $row[p_name]; $p_descriptionxx = $row[p_description]; $m_emailxx = $row[m_email]; $m_idxx = $row[m_id]; $ex_postdatexx = $row[ex_postdate]; $ex_closexx = $row[ex_close]; $ex_closedatexx = $row[ex_closedate]; $ex_removexx = $row[ex_remove]; $ex_removedatexx = $row[ex_removedate]; $ex_winneridxx = $row[ex_winnerid]; $randomcodexx = $row[randomcode]; $balance = $k%4 ; if ($balance == 0) { ECHO "\r\n"; } else { ECHO "\r\n"; } $ex_mediaxx = $row[ex_media]; //字串 $ex_media_num = substr_count("$ex_mediaxx", ","); // 字串數 $temps_ex_media = split (",","$ex_mediaxx"); for ($i = 0; $i <= $ex_media_num ; $i++) { if ($temps_ex_media[$i] != "") { $ex_media[$i] = $temps_ex_media[$i]; $ex_last5ext[$i] = substr($ex_media[$i],-5,5); //// 取出自串的最後五碼 $ex_ext[$i] = strstr($ex_last5ext[$i],'.'); //// 取出最後五碼中包含 .及後面的字串 if (($ex_ext[$i] == '.jpg') || ($ex_ext[$i] == '.gif') || ($ex_ext[$i] == '.png')){ $mainfilename = substr($ex_media[$i],0,-4); $smailfilename = "$mainfilename" . "s" . "$ex_ext[$i]"; $short_ex_namexx = mb_substr($ex_namexx,0,13,"Big-5"); ECHO "
\r\n"; ECHO "\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "\r\n"; ECHO "\r\n"; ECHO "
$short_ex_namexx ..
$l_reply ($ex_replynumxx)  |  點閱: ($ex_clicknumxx)  |  $l_ask ($ex_asknumxx)
\r\n"; $i = $ex_media_num; } } // End if } // End for if ($balance == 3) { ECHO " \r\n"; } else { ECHO "\r\n"; } $k++; } // End While if ($balance == 0) { ECHO "\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "
\r\n"; ECHO "
 
\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "\r\n"; ECHO "
 
\r\n"; ECHO " \r\n"; ECHO "\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "
\r\n"; ECHO "
 
\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "\r\n"; ECHO "
 
\r\n"; ECHO " \r\n"; ECHO "\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "
\r\n"; ECHO "
 
\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "\r\n"; ECHO "
 
\r\n"; ECHO " \r\n"; ECHO " \r\n"; } elseif ($balance == 1) { ECHO "\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "
\r\n"; ECHO "
 
\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "\r\n"; ECHO "
 
\r\n"; ECHO " \r\n"; ECHO "\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "
\r\n"; ECHO "
 
\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "\r\n"; ECHO "
 
\r\n"; ECHO " \r\n"; ECHO " \r\n"; } elseif ($balance == 2) { ECHO "\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "
\r\n"; ECHO "
 
\r\n"; ECHO "
\r\n"; ECHO "\r\n"; ECHO "\r\n"; ECHO "
 
\r\n"; ECHO " \r\n"; ECHO " \r\n"; } ECHO ""; $qresult = mysql_query("SELECT * FROM ex_post WHERE (ex_media != '' AND ex_close = '0') ORDER BY ex_postid DESC"); $nrResults=mysql_num_rows($qresult); if (($nrResults%$allLimit)<>0) { $pmax=floor($nrResults/$allLimit)+1; } else { $pmax=floor($nrResults/$allLimit); } ECHO "
    \r\n"; //ECHO $_GET[page]; if ($_GET[page] < 20) {$i = 1;} elseif (( 20 < $_GET[page]) && ($_GET[page] <= 40)) {$i = 20;} elseif (( 40 < $_GET[page]) && ($_GET[page] <= 60)) {$i = 40;} elseif (( 60 < $_GET[page]) && ($_GET[page] <= 80)) {$i = 60;} elseif (( 80 < $_GET[page]) && ($_GET[page] <= 100)) {$i = 80;} elseif (( 100 < $_GET[page]) && ($_GET[page] <= 120)) {$i = 100;} elseif (( 120 < $_GET[page]) && ($_GET[page] <= 140)) {$i = 120;} elseif (( 140 < $_GET[page]) && ($_GET[page] <= 160)) {$i = 140;} elseif (( 160 < $_GET[page]) && ($_GET[page] <= 180)) {$i = 160;} elseif (( 180 < $_GET[page]) && ($_GET[page] <= 200)) {$i = 180;} elseif (( 200 < $_GET[page]) && ($_GET[page] <= 220)) {$i = 200;} else {$i = 220;} $imax = $i + 20; while ($i <= $pmax) { if ($i == $_GET["page"]) { ECHO "\r\n"; } elseif ($i != $_GET["page"]) { ECHO "\r\n"; } if ($i < $imax) { $i++;} } ECHO "
\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "$i\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "$i\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "
\r\n"; ECHO "
"; ?>