}
        }
        if (is_uploaded_file($_FILES['b_image']['tmp_name'])) {
            //echo "Wait...."."<br>";
            $Destdir = "upload/images/";
            if (!is_dir($Destdir)) {
                echo "傳輸失敗 : 目錄不存在";
            } elseif (!is_writeable($Destdir)) {
                echo "傳輸失敗 : 無法寫入";
            } else {
                copy($_FILES['b_image']['tmp_name'], $Destdir . "/" . $m_file);
                $m_file_name = 'upload/images/' . $m_file;
                $size = getimagesize($m_file_name);
                if (!($size[2] == 1) && !($size[2] == 2)) {
                    // 1為GIF檔 2為JPG/JPEG檔
                    umsg("圖檔格式僅限 GIF,JPEG,JPG");
                    $m_boolen = true;
                    unlink($m_file_name);
                } else {
                    uimage_reduce($_FILES['b_image']['tmp_name'], $m_file_name, 200, 0);
                    //copy($_FILES['b_image']['tmp_name'] , $m_file_name);
                }
            }
        }
    }
    echo "<script>alert(' 書籍上傳完成! ');</script>";
}
?>
</div>

<!-- 書籍列表 ----------------------------------------------------------------------------->
function ureplace2($lc_query, $ln_second = 2000, $ln_num1, $ln_tdname)
{
    //$lc_query 為sql語言傳回的變數  本TABLE的結構需要有  1.IMG_NAME 2.NO_  3.NAME1(客戶名稱)
    //$ln_second 幾秒呼叫test2()函數(不傳入,則預設為2秒)
    //$ln_num1 為此網頁連結的總數
    //之後的參數則傳入要替換圖片的物件名稱,沒限定傳入幾個
    $m_img = func_get_args();
    $m_alen = count($m_img);
    $m_alen_count = $m_alen - 4;
    if (gettype($m_img[2]) != integer) {
        //判斷第二個參數是否為數值
        umsg("請傳入第二個參數,或第二個參數需為數值");
    } else {
        $m_num = mysql_num_rows($lc_query);
        //求出資料筆數,以利得知陣列元素個數(陣列是從0為起始,所以總筆數要-1,才是陣列元素的總各數)
        $m_i = 0;
        echo "<script>a_array=new Array();</script>";
        //宣告一javascript陣列 --> 存圖片的名稱
        echo "<script>a_par=new Array();</script>";
        //宣告一javascript陣列 --> 存客戶的編號
        echo "<script>a_name=new Array();</script>";
        while ($a_record = mysql_fetch_array($lc_query)) {
            echo "<script>\r\n\t\t\t\t\ta_array[{$m_i}]='{$a_record['IMG_NAME']}';\r\n\t\t\t\t\ta_par[{$m_i}]={$a_record['NO_']};\r\n\t\t\t\t  \ta_name[{$m_i}]='{$a_record['NAME1']}';\r\n\t\t\t\t  </script>";
            //給定javascript陣列值 --> 所有圖片的名稱
            $m_i = $m_i + 1;
        }
        echo "<script>a_img=new Array();</script>";
        //宣告一javascript陣列 --> 存要替換的圖片物件名稱
        $m_m = 0;
        for ($m_j = 4; $m_j < $m_alen; $m_j++) {
            echo "<script>\r\n\t\t\t\t\ta_img[{$m_m}]='{$m_img[$m_j]}';\r\n\t\t\t\t  </script>";
            //給定javascript陣列值 --> 給的參數要替換的圖片物件名稱
            $m_m = $m_m + 1;
        }
        echo "<script>setInterval('jset_img(a_array,a_par,a_name,a_img,{$m_alen_count},{$m_num},{$ln_num1},{$ln_tdname})',{$ln_second});</script>";
        //↑呼叫javescript內建函數setInterval計時器(每$ln_second秒,呼叫test2()函數一次)
    }
    echo "<script>\r\n\t\tvar m_num;\r\n\t\tfunction jset_img(lc_array,ln_par,lc_name,lc_img,ln_count,ln_num,ln_num1,ln_tdname){\r\n\t\t\tvar m_obj_name, m_num2;\r\n\t\t\tm_l=jrand(0,ln_num-ln_count);\r\n\t\t\tm_num = ln_num1;\r\n\t\t\tfor(m_j=0;m_j<ln_count;m_j++){\r\n\t\t\t\tm_num2 = m_j+ln_tdname;\r\n\t\t\t\tm_obj_name = 'td'+m_num2.toString() ;\r\n\t\t\t\tdocument.links[m_num].href='../0435001188/heart_pc.php?m_par='+ln_par[m_l+m_j];\r\n\t\t\t\tdocument.getElementById(lc_img[m_j]).src='../A6200A_IMAGE/'+lc_array[m_l+m_j];\r\n\t\t\t\tdocument.getElementById(m_obj_name).innerHTML = lc_name[m_l+m_j];\r\n\t\t\t\tm_num = m_num + 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\t</script>";
}