갤러리#1 ( gallery.asp ) 리스트 > 기술자료 | 해피정닷컴

갤러리#1 ( gallery.asp ) 리스트 > 기술자료

본문 바로가기

사이트 내 전체검색

갤러리#1 ( gallery.asp ) 리스트 > 기술자료

ClassicASP 갤러리#1 ( gallery.asp ) 리스트

페이지 정보


본문

db_conn.asp 내용
<%
Dim Sql, Con
Set Con = Server.CreateObject("ADODB.Connection")
Con.Open ("Provider=SQLOLEDB;Data Source=디비주소;Initial Catalog=디비명;user ID=아이디;password=비밀번호;")
%>

<%@ Language=VBScript %>
<%  Option Explicit   %>
<%
' 작성자: 해피정닷컴 ( https://www.happyjung.com )
' 2008-06-23 : 1차 작성
' 2008-08-02 : 디비 테이블 이름 변경   tbl_gallery  →  hp_gallery
' 2009-01-20 : 오타 및 img 폴더명 변경  "../..imgs/noimage.jpg  ->  "../../img/noimage.jpg
' 2009-11-11 : 검색기능 개선
'
'
'
%>
<!--#include virtual="/inc/db_conn.asp" -->

<%
dim str,val      ' 해피정닷컴 추가 2008-05-27
' 인젝션 방지관련 https://www.happyjung.com/bbs/board.php?bo_table=lecture&wr_id=480
'function sqlCheck(str)
'...
'end function

dim page, pagesize, block, j, nanuki, num, name, title, email, url, write_diff, writeday, visit, filename1, i_width1, i_height1, nowday, first_page, end_page, i, recordCount, pagecount, id_num, SearchStr, SearchPart, wc

Page       = sqlCheck(request("page"))
SearchStr  = sqlCheck(request("SearchStr"))
SearchPart = sqlCheck(request("SearchPart"))

if page="" then
  page=1
end if
 
'#################################
pagesize = 8 '## 한페이지에 나타낼 이미지 수
block = 10  '## 페이지 네비게이션의 수
nanuki = 4  '## 한줄에 표시할 이미지 수
'#################################
if SearchPart = "" then SearchPart  = "name"
if SearchStr  <> "" then
  wc = " where " & SearchPart & " like '%"& SearchStr & "%'"
end if

SQL = "select count(num) as recCount from hp_gallery" & wc  '### 저장된 글 수를 가져온다.
Set rs = Con.Execute(SQL)

recordCount = Rs(0) '### 저장된 전체 글 수
pagecount = int((recordCount-1)/pagesize) +1 '### 페이지가 나눠진 수
id_num = recordCount - (Page -1) * PageSize  '### 글 번호 순차적으로 처리하는 부분. 갤러리에서는 쓰이지 않음.
 
'### 글을 가져오는 부분
if SearchStr  = "" then
  SQL = "SELECT TOP " & pagesize & " * FROM hp_gallery"
  if int(page) > 1 then
    SQL = SQL & " WHERE num not in "
    SQL = SQL & "(SELECT TOP " & ((page - 1) * pagesize) & " num FROM hp_gallery"
    SQL = SQL & " ORDER BY num DESC)"
  end if
else
  SQL = "SELECT TOP " & pagesize & " * FROM hp_gallery " & wc
  if int(page) > 1 then
    SQL = SQL & " and num not in "
    SQL = SQL & "(SELECT TOP " & ((page - 1) * pagesize) & " num FROM hp_gallery"
    SQL = SQL & " ORDER BY num DESC)"
  end if
end if
SQL = SQL & " order by num desc"
set rs = Con.execute(sql)
%>

<!--#include file="../inc/_happyjung_.asp"-->
<title>갤러리</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</head>

<body>
<!-- 갤러리 -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td>총 <%=recordcount%>개의 이미지가 있습니다. (<%=page%> page / <%=pagecount%> page)<br></td>
  </tr>
  <tr>
    <td height="2" bgcolor="#333333"></td>
  </tr>
  <%
  Do until Rs.EOF
  %>
  <tr>
    <td height="120"><table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr>
      <%
        for j=1 to nanuki

        num = rs("num")
        name = rs("name")
        title = rs("title")
        email = rs("email")
        url = rs("url")
        write_diff=rs("writeday")
        writeday = left(write_diff,10)
        visit = rs("visit")
        filename1 = rs("filename1")
        i_width1 = rs("i_width1")
        i_height1 = rs("i_height1")

        if filename1 = "" then
          filename1 = "../../img/noimage.jpg"
          i_height1 = 100
          i_width1 =  145
        else
          filename1 = "../../upload/" & filename1
          i_height1 = 100
          i_width1 =  145
        end if

        if writeday = left(nowday,10) then
          writeday=right(write_diff,11)
          writeday=left(writeday,8)
        end if
      %>
        <td valign="top" style="padding:5;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center"><a href="gallery_view.asp?num=<%=num%>&page=<%=page%>"><img src="<%=filename1%>" width="<%=i_width1%>" height="<%=i_height1%>" border="0"></a></td>
          </tr>
          <tr>
            <td align="center"><%=title%></td>
          </tr>
        </table></td>
      <%
        Rs.Movenext
        id_num = id_num - 1

        if rs.EOF then
          exit for
        end if
        next
      %>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="2" bgcolor="#333333"></td>
  </tr>
<%
 Loop
%>
  <tr>
    <td align="center" style="padding-left:5;">
    <% '페이지 네비게이션 시작
      If Rs.BOF Then
      
      Else
        If Int(Page) <> 1 Then
        %>
          <a href="gallery.asp?page=<%=Page-1%>" onFocus="this.blur()"><font color="#000000" style="font-size:8pt;">[prv]</font></a>
        <%
        end if
        
        First_Page = Int((Page-1)/Block)*Block+1
       
        If First_Page <> 1 Then
        %>
          [<a href="gallery.asp?page=1" onFocus="this.blur()"><font color="#000000" style="font-size:8pt;">1</font></a>]&nbsp;..
        <%
        end if
       
        If PageCount - First_Page < Block Then
          End_Page = PageCount
        Else
            End_Page = First_Page + Block - 1
        End If
       
        For i = First_Page To End_Page
         
          If Int(Page) = i Then
          %>
            [<font color="#FF0000" style="font-size:8pt;"><b><%=i%></b></font>]
          <%
          Else
          %>
            [<a href="gallery.asp?page=<%=i%>" onFocus="this.blur()"><font color="#000000" style="font-size:8pt;"><%=i%></font></a>]
          <%
          End If
        Next
          If End_Page <> PageCount Then
          %>
            &nbsp;..&nbsp;[<a href="gallery.asp?page=<%=PageCount%>" onFocus="this.blur()"><font color="000000" style="font-size:8pt;"><%=PageCount%></font></a>]
          <%
          end if
         
          If Int(Page) <> PageCount Then 
          %>
            &nbsp;<a href="gallery.asp?page=<%=page+1%>" onFocus="this.blur()"><font color="#000000" style="font-size:8pt;">[next]</font></a>
          <%
        End If
      End If
      '페이지 네비게이션 끝
    %></td>
  </tr>
  <tr>
    <td align="center" style="padding-top:10px;"><table width="100%" border="0" cellspacing="0" bordercolor="0">
      <tr>
        <form action="gallery.asp" method="post" name="search" id="search">
        <td><select name="SearchPart" class="input_box">
            <option value="title" <% if SearchPart = "title" then Response.Write("selected") end if %>>제목 </option>
            <option value="content" <% if SearchPart = "content" then Response.Write("selected") end if %>>내용 </option>
            <option value="name"    <% if SearchPart = "name" then Response.Write("selected") end if %>>작성자 </option>
          </select>
          <input name="SearchStr" type="text" class="input_box" value="<%=SearchStr %>" size="30" />
          <input name="submit" type="image" onClick="submit();" value="찾  기" src="img/searchs.gif" width="34" height="20" align="absmiddle" /></td>
        </form>
        <td align="right"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top" style="padding:0 5 0 0;">
            <% if session("admin") = "administrator" then %>
              <a href="gallery_write.asp?page=<%=Page %>&SearchPart=<%=SearchPart %>&SearchStr=<%=SearchStr %>"><img src="img/bbs_write.gif" border="0"></a>
            <% end if%></td>
            <td valign="top"><a href="gallery.asp"><img src="img/bbs_list.gif" border="0"></a></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

댓글목록

등록된 댓글이 없습니다.


Total 198건 8 페이지
  • RSS
기술자료 목록
58
ClassicASP   15162  2008-08-02 18:01  
57
ClassicASP   35972  2008-07-16 16:44  
56
ClassicASP   12930  2008-07-10 13:38  
55
ClassicASP   12116  2008-07-01 18:28  
54
ClassicASP   12619  2008-06-23 19:58  
53
ClassicASP   11937  2008-06-23 19:54 ~ 2008-08-02 00:00  
52
ClassicASP   16914  2008-06-23 19:46 ~ 2016-10-21 00:00  
51
ClassicASP   20339  2008-06-23 19:37  
50
ClassicASP   23219  2008-06-23 19:31 ~ 2008-05-27 00:00  
열람
ClassicASP   18236  2008-06-23 19:22 ~ 2009-11-11 00:00  
48
ClassicASP   20662  2008-06-19 21:59 ~ 2018-12-01 22:44  
47
ClassicASP   17704  2008-06-14 19:57  
46
ClassicASP   13995  2008-06-11 09:54 ~ 2009-07-20 00:00  
45
ClassicASP   12558  2008-06-10 19:47 ~ 2009-10-26 00:00  
44
ClassicASP   15377  2008-05-29 22:14  
43
ClassicASP   15494  2008-05-23 23:29  
42
ClassicASP   21934  2008-05-23 23:14 ~ 2016-01-23 00:00  
41
ClassicASP   10069  2008-05-20 19:10  
40
ClassicASP   25394  2008-05-04 09:58  
39
ClassicASP   12538  2008-04-26 15:38  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 1동 222호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 제2024-대전대덕-0405호 [사업자등록확인]  
Copyright 2001~2024 해피정닷컴. All Rights Reserved.