<% // @Author: Dhunva Saisom ( Dun ) // @Project Name: Honsen // Number of Files: many // Files Name: photobank.jsp // // // Code provided by Author Dhunva Saisom ( Dun ) // as is,with warranties as to performance, fitness, merchantability,and any other warranty // ( whether expressed or implied ).Terms of Agreement: By using this source code, you agree // to the following terms... // 1) You may use this source code in personal or business projects by buying license. // 2) You MAY NOT redistribute this source code (for example to a web site) without // written permission from the original author.Failure to do so is a violation of copyright // laws. // If you find any bug in this source codes please e-mail : thedun_dec@hotmail.com %> <%@ page contentType="text/html;charset=utf-8" %> <%@ page import="java.sql.*,java.util.*" %> <% ResultSet rs; String strSQL; int pid = 0; int firstRow = 0; int totalRow = 0; int totalPage = 0; int intlinkGroup = 0; int preview = 15; int pageLinkLen = 10; String chDelete = null; String pageNo = request.getParameter ( "pageNo" ); String linkGroup = request.getParameter ( "linkGroup" ); String search = request.getParameter ( "search" ); if ( search != null ) { search = search.trim ( ); if ( search.equals ( "" ) ) { search = null; } } String search2 = null; if ( search != null ) { search2 = new String ( search.getBytes ( "ISO8859_1" ), "utf-8" ); } if ( pageNo == null ) { pageNo = "1"; } if ( linkGroup == null ) { linkGroup = "0"; } pid = Integer.parseInt ( pageNo ); intlinkGroup = Integer.parseInt ( linkGroup ); int rec_no = ( pid * preview ) - preview; int sysid = 5; %> <%@ include file = "preview.jsp" %> photobank
<% int imgCount = 0; int rowCount = 0; int imageid = 0; int tdCount = 5; String img_name = null; String url_image = null; if ( search != null ) { strSQL = "Select * from up_images where img_store='S' and img_name Like '%" + search + "%' order by img_name"; } else { strSQL = "Select * from up_images where img_store='S' order by img_name"; } rs = dbcon.executeQuery ( strSQL, chDelete, preview, pid ); pid = dbcon.getpageID ( ); totalRow = dbcon.getTotalRow ( ); totalPage = dbcon.getTotalPage ( ); %>
หน้า <%= pid %> จาก <%= totalPage %>
 
<% Vector imgFunction = new Vector ( ); while ( rs.next ( ) ) { imageid = rs.getInt ( "imageid" ); img_name = rs.getString ( "img_name" ); url_image = rs.getString ( "url_image" ); // @@@ START LINUX // img_name = new String ( img_name.getBytes ( "ISO8859_1" ), "MS874" ); // @@@ END LINUX imgFunction.addElement ( "" + imageid ); if ( imgCount == 0 ) { out.print ( "" ); } %> <% imgCount++; rowCount++; if ( imgCount >= tdCount ) { out.print ( "" ); imgCount = 0; } if ( rowCount >= preview ) { rs.afterLast ( ); } } rs.close ( ); for ( int i = imgCount; i < tdCount; i++ ) { out.print ( "" ); if ( i == tdCount ) { out.print ( "" ); } } if ( rowCount == 0 ) { pid = 0; } %>
<% if ( img_name != null ) { out.print ( img_name ); } %>
  
หน้า <%= pid %> จาก <%= totalPage %> ( <%= totalRow %> ภาพ )
<% int goPage = 0; int totalpageLink = totalPage/pageLinkLen; int start_pageLink = pageLinkLen * intlinkGroup; if ( totalPage % pageLinkLen > 0 ) { totalpageLink = totalpageLink + 1; } if ( start_pageLink > 0 ) { out.print ( " " ); out.print ( "<< " + ( ( start_pageLink + 1 ) - pageLinkLen ) + "-" + start_pageLink + "" ); out.print ( " | " ); } for ( int i = 1; i <= pageLinkLen; i++ ) { goPage = i + start_pageLink; if ( goPage <= totalPage ) { if ( pid == goPage ) { out.print ( "" + goPage + " | " ); } else { out.print ( "" + goPage + " | " ); } } else { goPage = totalPage; } } if ( goPage < totalPage ) { out.print ( " " + ( goPage + 1 ) ); if ( ( goPage + pageLinkLen ) < totalPage ) { out.print ( "-" + ( goPage + pageLinkLen ) + " >>" ); } else { if ( ( goPage + 1 ) < totalPage ) { out.print ( "-" + totalPage + " >>" ); } else { out.print ( "" ); } } } %>
<%@ include file = "footer.jsp" %>