⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 article.asp

📁 网上购物系统
💻 ASP
字号:
<!--#include file="menkan.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="page.asp"-->
<%
action=request.QueryString("action")
aclassid=request.QueryString("aclassid")
edit=request.QueryString("edit")
aid=request.QueryString("aid")
aedit=request.QueryString("aedit")
where=request.QueryString("where")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="Image/Main.css" rel="stylesheet" type="text/css" />
<title>文章管理</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>
<body>
<!--#include file="top.asp"-->
<%if action="classlist" then%>
<table width="760" border="1"align="center" cellpadding="3" cellspacing="1" bordercolor="#CCCCCC" style="border-collapse: collapse">
  <tr>
    <td colspan="3">【<a href="?action=classlist">栏目列表</a>】【<a href="?action=class">添加栏目</a>】【<a href="?action=list">文章列表</a>】【<a href="?action=article">添加文章</a>】</td>
  </tr>
  <tr>
    <td colspan="3" align="center" bgcolor="#eeeeee">文章栏目列表</td>
  </tr>
  <tr>
    <td width="5%" align="center">ID</td>
    <td width="45%" align="center">文章栏目</td>
    <td width="45%" align="center">管理操作</td>
  </tr>
<%
Set mypage=new xdownpage
mypage.getconn=conn
mypage.getsql="select * from articleclass order by aclassid asc"
mypage.pagesize=16
set rspage=mypage.getrs()
Response.Write("<br/>")
for i=1 to mypage.pagesize
if not rspage.eof then
%>  
  <tr>
    <td align="center"><%=rspage("aclassid")%></td>
    <td align="left"><%=rspage("aclassname")%></td>
    <td align="center">
	<a href="?action=class&edit=true&aclassid=<%=rspage("aclassid")%>">编辑</a>|
	<a href="#" onClick="if(confirm('确定删除吗?这将删除此栏目下所有文章'))location.href='?action=delclass&aclassid=<%=rspage("aclassid")%>';else return;">删除</a></td>
  </tr>
<%
rspage.movenext
else
exit for
end if
next
%>  
  <tr>
    <td colspan="3" align="right"><%mypage.showpage()%></td>
  </tr>
</table>
<%
Set mypage=nothing
end if
%>
<%
if action="class" then
if edit="true" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from articleclass where aclassid="&aclassid&""
rs.open sql,conn,1,1
aclassname=rs("aclassname")
rs.close
set rs=nothing
end if
%>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="14"></td>
  </tr>
</table>
<table width="760" border="1"align="center" cellpadding="3" cellspacing="1" bordercolor="#CCCCCC" style="border-collapse: collapse">
<form method="post" name="class" <%if edit<>"true" then%> action="?action=saveclass"<%else%>action="?action=saveclass&edit=true&aclassid=<%=aclassid%>"<%end if%>>
  <tr>
    <td colspan="2">【<a href="?action=classlist">栏目列表</a>】【<a href="?action=class">添加栏目</a>】【<a href="?action=list">文章列表</a>】【<a href="?action=article">添加文章</a>】</td>
  </tr>
  <tr>
    <td colspan="2" align="center" bgcolor="#eeeeee">
<%
if edit="true" then
response.Write("编辑栏目")
else
response.Write("添加栏目")
end if
%>	</td>
  </tr>
  <tr>
    <td width="20%" align="center">栏目名称</td>
    <td>
<%if edit="true" then%>
<input type="text" name="aclassname" value="<%=aclassname%>">
<%else%>
<input type="text" name="aclassname">
<%end if%>	</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="提交">
    <input type="reset" name="Submit2" value="重置"></td>
  </tr>
</form> 
</table>
<%end if%>
<%
if action="saveclass" then
if request.Form("aclassname")="" or len(request.Form("aclassname"))<2 or len(request.Form("aclassname"))>10 then
	response.write "<SCRIPT language=JavaScript>alert('请输入栏目名称不得小于2大于10个字!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
set rs=server.CreateObject("adodb.recordset")
if edit="true" then
sql="select * from articleclass where aclassid="&aclassid&""
rs.open sql,conn,1,3
else
sql="select * from articleclass"
rs.open sql,conn,1,3
Rs.AddNew
end if
rs("aclassname")=request.Form("aclassname")
rs.update
rs.close
set rs=nothing
response.Redirect "?action=classlist"
end if

if action="delclass" then
conn.execute("delete * from article where aclassid in ("&aclassid&")")
conn.execute("delete * from articleclass where aclassid in ("&aclassid&")")
response.Redirect "?action=classlist"
end if
%>
<%if action="list" then%>
<table width="760" border="1"align="center" cellpadding="3" cellspacing="1" bordercolor="#CCCCCC" style="border-collapse: collapse">
  <tr>
    <td colspan="4">【<a href="?action=classlist">栏目列表</a>】【<a href="?action=class">添加栏目</a>】【<a href="?action=list">文章列表</a>】【<a href="?action=article">添加文章</a>】</td>
  </tr>
  <tr>
    <td colspan="4" align="center" bgcolor="#eeeeee">
	文章列表</td>
  </tr>
  <tr>
    <td width="5%" align="center">ID</td>
    <td width="45%" align="center">文章名称</td>
    <td width="25%" align="center">文章栏目</td>
    <td width="20%" align="center">管理操作</td>
  </tr>
<%
Set mypage=new xdownpage
mypage.getconn=conn
if where<>""then
mypage.getsql="select * from article where aclassid="&where&" order by aid desc"
else
mypage.getsql="select * from article order by aid desc"
end if
mypage.pagesize=16
set rspage=mypage.getrs()
Response.Write("<br/>")
for i=1 to mypage.pagesize
if not rspage.eof then
%>  
  <tr>
    <td align="center"><%=rspage("aid")%></td>
    <td align="left"><a target="_blank" href="showarticle.asp?action=show&aid=<%=rspage("aid")%>"><%=rspage("aname")%></a></td>
    <td align="center">
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from articleclass where aclassid="&rspage("aclassid")
rs.open sql,conn,1,1
response.Write rs("aclassname")
rs.close
set rs=nothing
%>	
	</td>
    <td align="center">
	<a href="?action=article&aedit=true&aid=<%=rspage("aid")%>">编辑</a>|
	<a href="#" onClick="if(confirm('确定删除吗?'))location.href='?action=del&aid=<%=rspage("aid")%>';else return;">删除</a></td>
  </tr>
<%
rspage.movenext
else
exit for
end if
next
%>  
  <tr>
    <td colspan="4" align="right"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><select name='where' onChange='javascript:location=this.options[this.selectedIndex].value;'>
          <%Set TiaoRs=Server.CreateObject("AdoDb.RecordSet")
TiaoRs.Open "Select * From articleclass",Conn,1,1
response.Write "<option ><-请选择类别!-></option>"
Do While Not TiaoRs.eof 
response.Write "<option value=?action=list"
response.Write "&where="
response.Write TiaoRs(0)
response.Write ">"
response.Write TiaoRs(1)
response.Write "</option>"
tiaors.movenext
Loop
TiaoRs.Close
Set TiaoRs=Nothing%>
        </select></td>
        <td align="right"><%mypage.showpage()%></td>
      </tr>
    </table>
    </td>
  </tr>
</table>
<%
Set mypage=nothing
end if
%>
<%
if action="article" then
if aedit="true" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from article where aid="&aid&""
rs.open sql,conn,1,1
aclassid=rs("aclassid")
aname=rs("aname")
apicture=rs("apicture")
acontent=rs("acontent")
rs.close
set rs=nothing
end if
%>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="14"></td>
  </tr>
</table>
<table width="760" border="1"align="center" cellpadding="3" cellspacing="1" bordercolor="#CCCCCC" style="border-collapse: collapse">
<form method="post" name="article" <%if aedit<>"true" then%> action="?action=save"<%else%>action="?action=save&aedit=true&aid=<%=aid%>"<%end if%>>
  <tr>
    <td colspan="2">【<a href="?action=classlist">栏目列表</a>】【<a href="?action=class">添加栏目</a>】【<a href="?action=list">文章列表</a>】【<a href="?action=article">添加文章</a>】</td>
  </tr>
  <tr>
    <td colspan="2" align="center" bgcolor="#eeeeee">
<%
if aedit="true" then
response.Write("编辑文章")
else
response.Write("添加文章")
end if
%>	</td>
  </tr>
  <tr>
    <td align="center"><span class="STYLE1">*</span>文章栏目</td>
    <td>
	<select name="aclassid" id="aclassid">
	<option value="0"><-请选择文章栏目-></option>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from articleclass order by aclassid asc"
rs.open sql,conn,1,1
do while not rs.eof
%>	
<option value="<%=rs("aclassid")%>"<%if aedit="true" then%><%if rs("aclassid")=aclassid then%>selected="selected"<%end if%><%end if%>><%=rs("aclassname")%> </option>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>	  
    </select>    </td>
  </tr>
  <tr>
    <td width="20%" align="center"><span class="STYLE1">*</span>文章名称</td>
    <td>
<%if aedit="true" then%>
<input type="text" name="aname" value="<%=aname%>">
<%else%>
<input type="text" name="aname">
<%end if%>	</td>
  </tr>
  <tr>
    <td align="center">文章图片</td>
    <td>
<%
if aedit="true" then
if apicture<>""then
%>
<img src="<%=apicture%>" width="100" height="100"><br>
<%end if%>
    <input name="apicture" type="text" id="apicture" size="30" value="<%=apicture%>"/> 
    <input class="button" type="button" name="Submit3121" value="上传图片" onClick="window.open('UploadPic.asp?formname=article&editname=apicture&uppath=upload/article&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" />
<%else%>	
    <input name="apicture" type="text" id="apicture" size="30"/> 
    <input class="button" type="button" name="Submit3121" value="上传图片" onClick="window.open('UploadPic.asp?formname=article&editname=apicture&uppath=upload/article&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" />
<%end if%>	</td>
  </tr>
  
  <tr>
    <td align="center"><span class="STYLE1">*</span>文章介绍</td>
    <td>
<%if aedit="true" then%>
<textarea name="acontent" cols="60" rows="8"><%=acontent%></textarea>
<%else%>
<textarea name="acontent" cols="60" rows="8"></textarea>
<%end if%>	</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
	<input type="submit" name="Submit" value="提交">
    <input type="reset" name="Submit2" value="重置"></td>
  </tr>
</form> 
</table>
<%end if%>
<%
if action="save" then
if request.Form("aclassid")="" or request.Form("aclassid")="0" then
	response.write "<SCRIPT language=JavaScript>alert('请选择文章栏目!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
if request.Form("aname")="" or len(request.Form("aname"))<2 or len(request.Form("aname"))>25 then
	response.write "<SCRIPT language=JavaScript>alert('请输入文章名称不得小于2大于25个字!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
if request.Form("acontent")="" then
	response.write "<SCRIPT language=JavaScript>alert('请输入文章内容!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
set rs=server.CreateObject("adodb.recordset")
if aedit="true" then
sql="select * from article where aid="&aid&""
rs.open sql,conn,1,3
else
sql="select * from article"
rs.open sql,conn,1,3
Rs.AddNew
end if
rs("aclassid")=request.Form("aclassid")
rs("aname")=request.Form("aname")
rs("apicture")=request.Form("apicture")
rs("acontent")=request.Form("acontent")
rs.update
rs.close
set rs=nothing
response.Redirect "?action=list"
end if

if action="del" then
conn.execute("delete * from article where aid in ("&aid&")")
response.Redirect "?action=list"
end if
%>
<!--#include file="foot.asp"-->
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -