이번 예제는 도움이 될까해서 해외사이트에서 퍼온 소스입니다.

참고하세요.


<%


    Dim eConn, ePath, rs,Sql,my_count
    Set eConn = Server.CreateObject("ADODB.Connection")
    ePath = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("YOUR DB!")
   
    eConn.Open ePath
    'Count the records to get a High number
    Sql = "select count(b_id)as cnt from tblbanner"
   
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open Sql, eConn, 3, 3
    'plug it into a varibale
    my_count = rs("cnt")
 


    'If the table is empty write something
    if my_count < "1" Then
     Response.Write("Empty banner text")
    else
    'Get the ID and the Text for the banner
     Sql = "select b_id,b_text from tblbanner"
     Set rs = Server.CreateObject("ADODB.Recordset")
     rs.Open Sql, eConn, 3, 3
     RANDOMIZE
     Small = 1
    'vaiable for the high number
     High = my_count
     RandomNumber = INT((High-Small+1)*Rnd+Small)
    'Loop thru the results
     Do While Not rs.EOF
     Select Case RandomNumber
    'when the random number has a match us i
    '     t
      Case rs("b_id")
    'write the random number text
       Response.Write(rs("b_text"))
      End Select
     rs.MoveNext
     Loop
    End if
   
%>

2008/02/21 15:15 2008/02/21 15:15

<%


'해당 아이피가 로그인후 경과한 시간을 체크
function loginTimeCheck(tblname,strIP,tValue)
 

   Dim TimeCheck, bCheck

        set dbcon = server.CreateObject("ADODB.Connection")
   dbCon.Open strConnect
 
  '해당 아이피의 idate의 값을 가지고 온다
  'idate의 데이타형식은 datetime형입니다.
  SQLtime="Select idate from " & tblname & " where ip='" & strIP & "'"
  SQLtime=SQLtime & " order by no desc"
  set rs = dbCon.Execute(SQLtime)

 
  'TimeCheck=datediff("n", rs("idate"),now) '몇분이 지났는지 확인

   TimeCheck=datediff( "h", rs("idate"),now) '몇시간이 지났는지 확인
   if int(TimeCheck)>int(tValue) then 'tValue의 값이 2이면 2시간이 지났는지 확인

    '//--------필요한 처리를 여기서 한다
    '//--------tValue의 시간이 지났으면  bCheck = true 아니면 false
    '//--------처리끝 ----------------
   
 
  end if

 

  rsTime.close
  set rsTime = nothing
  dbCon.close
  set dbCon = nothing

  loginCheckTime = bCheck


end function


%>








%>

2008/02/21 15:14 2008/02/21 15:14

CDONTS객체를 사용한 이메일 발송예제는 너무나 쉽습니다.

아래는 직접사용하고 있는 소스인데 이미지 부분만 빼고 텍스트는 변경하고 올립니다.

참고하세요.


<%
  mail = name & "<table width='658' border='0' cellspacing='0' cellpadding='0'>"
  mail = mail & "<tr bgcolor='BDBABD'>"
  mail = mail & "<td colspan='3' height='1'></td>"
  mail = mail & "</tr>"
  mail = mail & "<tr>"
  mail = mail & "<td bgcolor='BDBABD' width='1'></td>"
  mail = mail & "<td width='656'>"
  mail = mail & "<table width='656' border='0' cellspacing='0' cellpadding='0'>"
  mail = mail & "<tr>"
  mail = mail & "<td></td>"
  mail = mail & "</tr>"
  mail = mail & "<tr>"
  mail = mail & "<td height='8'></td>"
  mail = mail & "</tr>"
  mail = mail & "<tr>"
  mail = mail & "<td align='center'><table width='566' border='0' cellspacing='0' cellpadding='0'>"
  mail = mail & "<tr>"
  mail = mail & "<td align='center'><p><strong>메일 발송 예제입니다</strong></p></td>"
  mail = mail & "</tr>"
  mail = mail & "</table></td>"
  mail = mail & "</tr>"
  mail = mail & "<tr>"
  mail = mail & "<td align='center'>&nbsp;</td>"
  mail = mail & "</tr>"
  mail = mail & "<tr>"
  mail = mail & "</tr>"
  mail = mail & "<tr>"
  mail = mail & "<td align='center'>&nbsp;</td>"
  mail = mail & "</tr>"
  mail = mail & "<tr>"
  mail = mail & "<td align='center'><table width='566' border='0' cellspacing='0' cellpadding='0'>"
  mail = mail & "<tr>"
  mail = mail & "<td><p>안녕하세요.. 이메일 발송 예제입니다. <br>"
  mail = mail & "여기다가 내용을 기재하여 주시고 이미지도 첨부하시면 멋진 이메일이 완성됩니다 <br>"
  mail = mail & "내용을 여기다가 계속 적어주십시오 <br>"
  mail = mail & "이메일 발송 예제 끝입니다.</td>"
  mail = mail & "</tr>"
  mail = mail & "</table></td>"
  mail = mail & "</tr>"
  mail = mail & "<tr>"
  mail = mail & "<td align='center'>&nbsp;</td>"
  mail = mail & "</tr>"
  mail = mail & "<tr>"
  mail = mail & "<td height='66' background='http://61.100.181.53/e-mail/image/bg_01.gif' align='center'>"
  mail = mail & "<table width='656' border='0' cellspacing='0' cellpadding='0'>"
  mail = mail & "<tr>"
  mail = mail & "<td width='210' align='right' height='67'></td>"
  mail = mail & "<td width='390' height='67'><font color='#666666'>Copyright @"
  mail = mail & "http://cafe.naver.com/webdeveloper  </font></td>"
  mail = mail & "</tr>"
  mail = mail & "</table>          </td>"
  mail = mail & "</tr>"
  mail = mail & "</table>"
  mail = mail & "</td>"
  mail = mail & "<td bgcolor='BDBABD' width='1'></td>"
  mail = mail & "</tr>"
  mail = mail & "<tr bgcolor='BDBABD'>"
  mail = mail & "<td colspan='3' height='1'></td>"
  mail = mail & "</tr>"
  mail = mail & "</table>"


  name = "테스트" '받는고객 이름
  Email = "test@testto.co.kr" '받는사람 메일주소
  fromMail = "test@test.co.kr" '보낸사람 메일주소

 

  content=Replace(Replace(mail,chr(13)&chr(10),""),"[고객이름]",name)
 
  Set objMail = Server.CreateObject("CDONTS.NewMail")
  objMail.From = fromMail
  objMail.To = Email
  objMail.subject = name &"님께 메일을 보냅니다"
  objMail.Body = content
  objMail.BodyFormat = 0     ' HTML일떄 0, 일반 Text일때 1 으로 설정한다.
  objMail.MailFormat = 0      ' HTML일떄 0, 일반 Text일때 1 으로 설정한다.
  objMail.Send
  Set objMail = nothing
%>

2008/02/21 15:14 2008/02/21 15:14
해외사이트에서 퍼온 소스입니다. 칼라테이블이 나오고 테이블을 클릭하면 그 테이블의

컬러로 텍스트 색상을 변경해줍니다.  웹서버에 넣고 돌려보니 잘 돌아갑니다.


<%
   Dim arrColors   ' Array of usable colors

   Dim iMinColor   ' LBound of the array
   Dim iMaxColor   ' UBound of the array

   Dim iR, iG, iB  ' Index vars for looping of each color

   Dim strColor    ' Temp var for building color string in loop


   ' Assign acceptable color components in hex.
   ' This is the 216 color web-safe palette.
   arrColors = Array("00", "33", "66", "99", "CC", "FF")

   ' Note I use the same array for all the colors since
   ' it's really just a mechanism to hold the hex values.

   ' I do this to save the processing time that would o/w
   ' result from doing this computation on each pass of the loop.

   iMinColor = LBound(arrColors)
   iMaxColor = UBound(arrColors)


    ' Table the colors for neat display
    Response.Write "<table cellspacing=""0"" cellpadding=""0"" " _
    & "border=""0"">" & vbCrLf


    ' Loop through reds
    For iR = iMinColor To iMaxColor
    ' Put in a row break so we can see the whole thing on one page
    Response.Write "<tr>" & vbCrLf
    ' Loop through greens
    For iG = iMinColor To iMaxColor
        ' Loop through blues
        For iB = iMinColor To iMaxColor
            ' calculate the color and show it
            strColor = "#" & arrColors(iR) & arrColors(iG) & arrColors(iB)
            Response.Write "<td bgcolor=""" & strColor & """>" _
                & "<a href=""color_chooser.asp?color=" & Server.URLEncode(strColor) _
                & """><img src=""images/spacer.gif"" width=""15"" height=""15"" " _
                & "alt=""" & strColor & """ border=""0""></a></td>" & vbCrLf
        Next 'iB
    Next 'iG
    Response.Write "</tr>" & vbCrLf
    Next 'iR
    Response.Write "</table>" & vbCrLf
%>

<p>
<strong>
<font size="+2" color="<%= Request.QueryString("color") %>">
This text will appear in the color you click above.
</font>
</strong>
</p>

2008/02/21 15:12 2008/02/21 15:12