<!--#include file="../conn.asp"--><!--#include file="../function/function.asp"-->
<%if session("username")="" then response.Redirect "Admin_Index.asp"%>
<link href="css.css" rel="stylesheet" type="text/css" />
<%
lanmu="评论"
table="Comment"
modiurl="?developer=yongfa365"
Normalurl="?developer=yongfa365"
action=request("action")
select case action
case "add"
call add()
case "addok"
call addok()
response.redirect Normalurl
case "modi"
call modi()
case "modiok"
call modiok()
response.redirect Normalurl
case "delok"
call delok()
response.redirect Normalurl
case "show"
call show()
case else
call list()
end select
%>
<%Sub add()%>
<table border=1 bordercolor=#3770A9 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=100% align='center'>
<form name="form1" method="post" action="?action=addok" >
<tr class="title">
<td colspan="2">添加<%=lanmu%></td>
</tr>
<tr class="tr">
<td width="45%" align="right">标题:</td>
<td width="55%"><input type="text" name="txtTitle" size="20" class="form"/></td>
</tr>
<tr class="tr">
<td colspan="2" align="center"><input type="submit" name="Submit3" value="添加" />
<input type="reset" name="Submit4" value="重置" /></td>
</tr>
</form>
</table>
<%End Sub%>
<%Sub modi()%>
<%
Set rs=Server.Createobject("Adodb.Recordset")
sql="select * from "&table&" where id="&request("id")
rs.open sql,conn,1,3
if not rs.eof then
%>
<table border=1 bordercolor=#3770A9 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=100% align='center'>
<form name="form1" method="post" action="?action=modiok" >
<tr class="title">
<td colspan="2">修改<%=lanmu%></td>
</tr>
<tr class="tr">
<td width="44%" align="right">标题:</td>
<td width="56%"><input type="text" name="txtTitle" size="20" class="form" value="<%=rs("txtTitle")%>"/>
<input type="hidden" name="id" value="<%=rs("id")%>" /></td>
</tr>
<tr class="tr">
<td colspan="2" align="center"><input type="submit" name="Submit5" value="修改" />
<input type="reset" name="Submit6" value="重置" /></td>
</tr>
</form>
</table>
<%end if%>
<%End Sub%>
<%Sub show()%>
<%
Set rs=Server.Createobject("Adodb.Recordset")
sql="select * from "&table&" where id="&request("id")
rs.open sql,conn,1,1
if not rs.eof then
%>
<table border=1 bordercolor=#3770A9 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=100% align='center'>
<tr class="title">
<td colspan="2"><%=lanmu%>详细信息</td>
</tr>
<tr class="tr">
<td width="45%" align="right">标题:</td>
<td width="55%"><%=rs("txtTitle")%></td>
</tr>
<tr class="tr">
<td colspan="2" align="center"><input type="button" name="Submit7" value="<-返回->" onclick="window.history.go(-1)" /></td>
</tr>
</table>
<%end if%>
<%End Sub%>
<%Sub list()%>
<table border=1 bordercolor=#3770A9 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=100% align='center'>
<tr class="title">
<td colspan="4"><%=lanmu%>列表</td>
</tr>
<tr class="tr">
<td colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<form id="form2" name="form2" method="post" action="">
<tr>
<td colspan="3"><input type="button" name="Submit" value="添加<%=lanmu%>" onclick="window.location.href='?action=add'" />
标题:
<input type="text" name="txtTitle" />
<input type="submit" name="Submit2" value="搜索" /></td>
</tr>
</form>
</table></td>
</tr>
<tr class="title2">
<td width="5%">编号</td>
<td width="42%">标题</td>
<td width="43%"> </td>
<td width="10%">操作</td>
</tr>
<%
Set rs=Server.Createobject("Adodb.Recordset")
sql="select * from "&table&" where id<>0 "
if request("txtTitle")<>"" then sql=sql&" and txtTitle like '%"&request("txtTitle")&"%'"
sql=sql&" order by id desc"
response.Write sql
rs.open sql,conn,1,1
call SetPage(rs,pagecount,10)
for i=1 to rs.recordcount
if rs.eof then exit for
%>
<tr class="tr">
<td><%=rs("id")%></td>
<td><a href="?action=show&id=<%=rs("id")%>"><%=rs("txtTitle")%></a> </td>
<td> </td>
<td align="center"><a href="<%=modiurl%>&action=modi&ID=<%=rs("ID")%>">修改</a> <a href="<%=modiurl%>&action=delok&ID=<%=rs("ID")%>" onClick="return confirm('确定删除?')">删除</a></td>
</tr>
<%
rs.movenext
if i>rs.PageSize then exit for
next
%>
</table>
<%
call PrintPage(pagecount, rs, Normalurl)
%>
<%End Sub%>
<%Sub addok()%>
<%
Set rs=Server.Createobject("Adodb.Recordset")
sql="select * from "&table
rs.open sql,conn,1,3
rs.addnew
rs("txtTitle")=request("txtTitle")
'rs("")=request("")
rs.update
rs.close
%>
<%End Sub%>
<%Sub modiok()%>
<%
Set rs=Server.Createobject("Adodb.Recordset")
sql="select * from "&table&" where id="&request("id")
rs.open sql,conn,1,3
if not rs.eof then
rs("txtTitle")=request("txtTitle")
'rs("")=request("")
rs.update
end if
rs.close
%>
<%End Sub%>
<%Sub delok()%>
<%conn.execute("delete from "&table&" where id in("&request("id")&")")%>
<%End Sub%>
引用本页地址:
http://www.yongfa365.com/item/51c2d2f5202b5f08.html