+++ ȨÁ¦ÀÛ ¹ÙÀ̺í +++
ȨÁ¦ÀÛ ¹ÙÀ̺í ÀÌ »çÀÌÆ®´Â ÀÌ¿µÂù´ÔÀÇ »çÀÌÆ®¸¦ º¹¿øÇÑ °ÍÀÔ´Ï´Ù.
Untitled Document
Html
Dhtml
Css
Php
Asp
Cgi
Java Script
Java Applet
Multimedia
Win Tip
°Ô½ÃÆǸ¸µé±â (7) - ±Û»èÁ¦
¿Ã·ÁÁø ±Û »èÁ¦Çϱâ (1)

À̹ø¿¡´Â Àб⠸ðµå¿¡ »èÁ¦Çϱ⠱â´ÉÀ» ³Ö¾î º¸ÀÚ. ¿ì¼± Àб⠸ðµå¿¡ »èÁ¦¶ó´Â ±ÛÀ» »ðÀÔÇÏ°í ÀÌ ±Û¿¡ »èÁ¦¸¦ ´ã´çÇÏ´Â delete.asp ¹®¼­¸¦ ÀÛ¼ºÇÑ´Ù. ¸ÕÀú read.asp ¹®¼­¿¡ ´ÙÀ½°ú °°ÀÌ ¼öÁ¤ÇÑ´Ù.

<!--METADATA TYPE= "typelib"  NAME= "ADODB Type Library"
      FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll"
-->
<%
Option Explicit

Dim key
key = Request.QueryString("key")

Dim strConnect
strConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\DataStore\board.mdb"
Dim objConn,SQL,objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnect
SQL = "select * from MyBoard where b_key LIKE " & key
Set objRS = objConn.Execute(SQL)

Response.Write "<table border=1 width=500>" & _
               "<tr><td align=center>Á¦¸ñ</td></tr>" & _
               "<tr><td align=center>" & objRS("b_comment") & "</td></tr>" & _
               "<tr><td align=center>" & objRS("b_home") & "</td></tr>" & _
               "<tr><td align=center>" & objRS("b_ip") & "</td></tr>" & _
               "</table>"
Response.Write "<table border=0 width=500>" & _
               "<tr><td><a href=./delete.asp?key=" & _
               objRS("b_key") & ">±Û»èÁ¦</a></td></tr>" & _
               "</table>"

Set objRS = nothing
Set objConn = nothing
%>




ÀÌÁ¦ »èÁ¦¸¦ ´ã´çÇÏ´Â delete.asp ¹®¼­¸¦ ´ÙÀ½°ú °°ÀÌ ÀÛ¼ºÇÑ´Ù.

<!--METADATA TYPE= "typelib"  NAME= "ADODB Type Library"
      FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll"
-->
<%
Option Explicit

Dim key
key = Request.QueryString("key")

Dim strConnect
strConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\DataStore\board.mdb"
Dim objConn,SQL,objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnect
SQL = "delete * from MyBoard where b_key LIKE " & key
Set objRS = objConn.Execute(SQL)
Set objRS = nothing
Set objConn = nothing
Response.redirect "list.asp"
%>


¿©±â±îÁö¸¸ ÇÏ°í ½ÇÁ¦·Î ±ÛÀ» ¿Ã¸®°í ±ÛÀб⠸ðµå¿¡¼­ ±Û»èÁ¦¸¦ ´­·¯ ±ÛÀ» »èÁ¦½ÃÄѺ¸ÀÚ. ¹®Á¦¾ø´Ù¸é ¼º°øÀÌ´Ù.

±×·±µ¥....»ç½Ç ÀÌ°Ç ¸»µµ ¾ÈµÈ´Ù. ¿Ö³ÄÇÏ¸é ¾Æ¹«³ª ±ÛÀ» Áö¿ö¼­´Â ¾ÈµÇÁö ¾Ê´Â°¡. ±ÛÀ» Áö¿ï¶§´Â ±ÛÀ» µî·ÏÇÒ¶§ ºñ¹Ð¹øÈ£¸¦ °°ÀÌ µî·ÏÇϵµ·Ï ÇÏ°í ÀÌ µî·ÏµÈ ºñ¹Ð¹øÈ£¸¦ ÀÌ¿ëÇÏ¿© ±Û»èÁ¦½Ã ºñ¹Ð¹øÈ£ È®ÀÎ È­¸éÀ» º¸¿©Á־ ¾ÏÈ£¸¦ ¾Æ´Â »ç¶÷¸¸ÀÌ Áö¿ï ¼ö ÀÖµµ·Ï ÇØ¾ß ÇÑ´Ù. ÀÚ ÀÌ°É Çѹø Çغ¸ÀÚ.

¿Ã·ÁÁø ±Û »èÁ¦Çϱâ (2)

¸ÕÀú ±Û µî·Ï½Ã ºñ¹Ð¹øÈ£µµ °°ÀÌ µî·ÏÇϵµ·Ï ÇÏ°í ÀÌ°É ÀúÀåÇÒ Çʵ带 Ãß°¡ÇÑ´Ù.



±×¸®°í write.asp ¹®¼­¿¡¼­ ºñ¹Ð¹øÈ£ÀÔ·ÂÀ» Ãß°¡ÇÑ´Ù.

<html>
<head><title>±Û¾²±â</title></head>
<body>
    <form method='POST' action='Insert.asp'>
    <table border='1' width='450'>
    <tr>
    <td align='center'>Á¦¸ñ</td>
    <td><input type='text' name='title' size='50'></td>
    </tr><tr>
    <td align='center'>À̸§</td>
    <td><input type='text' name='name' size='50'></td>
    </tr><tr>
    <td align='center'>À̸ÞÀÏ</td>
    <td><input type='text' name='email' size='50'></td>
    </tr><tr>
    <td align='center'>ȨÁÖ¼Ò</td>
    <td><input type='text' name='home' size='50'></td>
    </tr><tr>
    <td align='center'>±Û</td>
    <td>
    <textarea wrap='hard' rows='10' name='comment' cols='50'></textarea>
    </td></tr>
    <td align='center'>ºñ¹Ð¹øÈ£</td>
    <td><input type='password' name='passwd' size='50'></td>
    </tr>
<tr>
    <td align='right' colspan='2' style='padding-right:25'>
    <input type='submit' value='±Û ÀúÀå'>
    </td></tr>
    </table>
    </form>
</body>
</html>


ÀÌÁ¦ write.asp ¹®¼­ÀÇ ³»¿ëÀÌ Àü´ÞµÇ´Â insert.asp ¹®¼­¿¡¼­ Àü´Þ¹ÞÀº ¾ÏÈ£¸¦ DB¿¡ ÀúÀåÇÏ´Â ºÎºÐÀ» Ãß°¡ÇÑ´Ù.

<!--METADATA TYPE= "typelib"  NAME= "ADODB Type Library" FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll"  -->
<%
Option Explicit

Dim name, title, comment, email,home,passwd
name = Request.form("name")
title = Request.form("title")
email = Request.form("email")
home = Request.form("home")
comment = Request.form("comment")
passwd = Request.form("passwd")

Dim strConnect,objRS
strConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\DataStore\board.mdb"
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open "Myboard", strConnect, adOpenStatic, adLockPessimistic,adCmdTable

with objRS
.AddNew
.Fields("b_name") = name
.Fields("b_title") = title
.Fields("b_comment") = comment
      .Fields("b_ip") = Request.ServerVariables("REMOTE_ADDR")
      .Fields("b_email") = email
.Fields("b_home") = home
      .Fields("b_date") = now()
      .Fields("b_passwd") = passwd
.Update
.Close
end with
Set objRS = nothing
Response.redirect "list.asp"
%>


ÀÚ ¿©±â±îÁö°¡ ±Ûµî·Ï½Ã Ãß°¡µÈ ºñ¹Ð¹øÈ£¸¦ DBÀÇ b_passwd Çʵ忡 ÀúÀå½ÃÅ°´Â ¹æ¹ýÀÌ´Ù. ÀÌÁ¦ ÀÌ ÀúÀåµÈ ±Ûºñ¹Ð¹øÈ£À» ÀÌ¿ëÇؼ­ ±Û»èÁ¦¸¦ ´©¸£¸é ¾ÏÈ£¸¦ ¹¯´Â È­¸éÀ» º¸¿©ÁÖ°í ÀÌ°÷¿¡ ÀÔ·ÂÇÑ °ª°ú DB¿¡ ÀúÀåµÈ ±Û¾ÏÈ£¸¦ ºñ±³Çؼ­ °°À¸¸é ±ÛÀ» »èÁ¦½ÃÅ°°í °°Áö ¾ÊÀ¸¸é °è¼Ó ¾ÏÈ£¸¦ ¹¯´Â È­¸éÀ» º¸¿©ÁÖµµ·Ï ÇÏÀÚ.

ÀÌ ºÎºÐÀº ¸ÕÀú ±ÛÀб⠸ðµå¿¡¼­ ±Û»èÁ¦¸ðµå·Î º¸³»Áö´Â Äõ¸®°ªÀ» °í·ÁÇØ¾ß ÇÑ´Ù. ±×¸®°í ±Û»èÁ¦½Ã ¾ÏÈ£¸¦ ¹¯´Â Æûű״ ´Ù½Ã ±Û»èÁ¦¸ðµå·Î µ¹¾Æ°¡µµ·Ï ÁöÁ¤ÇØ¾ß ÇÑ´Ù. À̶§ ¾ÏÈ£´Â È÷µçÀ¸·Î º¸³»¼­ ó¸®ÇÑ´Ù.

ÀÚ ´ÙÀ½°ú °°ÀÌ delete.asp¹®¼­¸¦ ¼öÁ¤ÇÑ´Ù.

<!--METADATA TYPE= "typelib"  NAME= "ADODB Type Library"
      FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll"
-->
<%
Option Explicit

Dim key,passwd
key = Request("key")
passwd = Request("passwd")

Dim strConnect
strConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\DataStore\board.mdb"
Dim objConn,SQL,objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnect

SQL = "select b_passwd from MyBoard where b_key LIKE " & key
Set objRS = objConn.Execute(SQL)

Dim db_passwd
db_passwd=objRS("b_passwd")
Set objRS = nothing

if db_passwd = passwd then
    SQL = "delete * from MyBoard where b_key LIKE " & key
    Set objRS = objConn.Execute(SQL)
    Set objRS = nothing
    Set objConn = nothing
    Response.redirect "list.asp"
else
    response.write "<form method=post action=delete.asp>" & _
    "<input type=hidden name=key value=" & key & ">" &_
    "<center><table border=1 width=200>" &_
    "<tr><td align=center>ºñ¹Ð¹øÈ£</td></tr>" &_
    "<tr><td align=center><input type=password name=passwd size=10></td></tr>" &_
    "<tr><td align=right><input type=submit value=È®ÀÎ></td></tr>" &_
    "</table>" &_
    "</form>"
end if

%>


Update : 2001/05/29 [µ¹¾Æ°¡±â]