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

📄 article.asp

📁 windowsCE 串口
💻 ASP
字号:
<!--#include file=check.asp-->
<!--#include file=conn.asp-->
<title>文章管理</title>
<link href=../style.css rel=stylesheet type=text/css>

<body topmargin="0" leftmargin="0" style="cursor:url(../images/2.gif)">

<table width="100%"  border="0" cellspacing="0" cellpadding="0">

   <form method=post action=article.asp>
      <tr>
         <td height="22" bgcolor="#9AFF9A">当前管理:<font color="#FF0000">文章管理</font>
            <input name="add" type="submit" id="add" value="增加"class="button">
            <input name="del" type="submit" id="del" value="删除"class="button">
            <input name="edit" type="submit" id="edit" value="修改"class="button"></td>
      </tr>
   </form>
  
<%if request("add")="增加" then%>
    <tr><td height=20></td></tr>
    <tr><td>
	<%if request("add2")="添加" then
	title=trim(request("title"))
	content=trim(request("content"))
	bigclsid=request("bigclsid")
	smlclsid=request("smlclsid")
	
	if title="" then
	response.write"<script>alert('文章标题不能为空!');history.back();</script>"
	elseif content="" then
	response.write"<script>alert('文章内容不能为空!');history.back();</script>"
	elseif bigclsid="" then
	response.write"<script>alert('新闻项目不能为空!');history.back();</script>"
	elseif smlclsid="" then
	response.write"<script>alert('新闻主题不能为空!');history.back();</script>"
	else
	rs.open"select * from article",conn,1,3
	rs.addnew
	rs("title")=title
	rs("content")=html(content)
	rs("views")=0
    rs("bigclsid")=bigclsid
	rs("smlclsid")=smlclsid
	rs("sender")=session("admin")
	rs("sendtime")=now
	rs.update
	response.write"<script>alert('文章添加成功!');window.navigate('article.asp?add=增加');</script>"
	rs.close
	end if
	end if%>
	
	<form method=post action=article.asp?add=增加 name="form1">
	
	<table width="80%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#99CC99">
        <tr align="center" bgcolor="eeeeee">
          <td height="25" colspan="2"><span class="style1">添加文章</span></td>
        </tr>
		
	   <tr>
        <td width="21%" height="22" align="center">项目</td>
        <td width="79%">
		<select size=1 name="bigclsid">
		<%if request("bigclsid")="" then%>
		  <%rs2.open"select * from class where parent=0",conn,1,1%>
		  <%while not rs2.eof%><option value=<%=rs2("id")%>><%=rs2("clsname")%></option>
		  <%rs2.movenext
		   wend
		   rs2.close%>
		<%else
		rs2.open"select * from class where id="&request("bigclsid"),conn,1,1%>
		<option value=<%=request("bigclsid")%>><%=rs2("clsname")%></option>
		<%rs2.close
		
		rs2.open"select * from class where parent=0 and id<>"&request("bigclsid"),conn,1,1
		while not rs2.eof%>
		<option value=<%=rs2("id")%>><%=rs2("clsname")%></option>
		<%rs2.movenext
		wend
		rs2.close%>
		<%end if%>
		</select><input type=submit value="选择项目"class="button"></td>
      </tr>
	  
	  <%if request("bigclsid")<>"" then%>
      <tr>
        <td width="21%" height="22" align="center">主题</td>
        <td width="79%"><select size=1 name="smlclsid">
		<%rs2.open"select * from class where parent="&request("bigclsid"),conn,1,1%>
		<%while not rs2.eof%>
		<option value=<%=rs2("id")%>><%=rs2("clsname")%></option>
		<%rs2.movenext
		wend
		rs2.close%>
		</select></td>
		
      </tr><%end if%>
      <tr>
        <td width="21%" height="22" align="center">标题</td>
        <td width="79%"><input name="title" type="text" size="38" class="style2"></td>
      </tr>
      <tr>
        <td height="22" align="center">内容</td>
        <td><textarea cols=80 rows=10 name="content"></textarea></td>
      </tr>
	  <tr align="center" bgcolor="eeeeee">
        <td height="25" colspan="2"><input name="add2" type="submit" id="add2" value="添加"class="button">
          <input name="clear" type="reset" id="clear" value="清除"class="button"></td>
        </tr>
    </table></form></td>
  </tr>
  
  
  <%elseif request("del")="删除" then%>
  <tr><td height=20></td></tr>
    <tr>
    <td>
	<%if request("del3")="删除" then
	id=cint(request("id"))
	rs.open"select * from article where id="&id,conn,1,3
	rs.delete
	rs.close
	response.write"<script>alert('删除文章成功!');window.navigate('article.asp?del=删除');</script>"
	end if%>
	
	<%if request("del2")="删除" then
	id=cint(request("id"))
	rs.open"select * from article where id="&id,conn,1,3%>
	
	<form method=post action=article.asp?id=<%=id%>&del=删除>
    <table width="60%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">
    <tr align="center" bgcolor="99cc99">
    <td height="22">删除文章</td></tr>
	<tr bgcolor="eeeeee">
    <td height="22">标题<input type=text name="title" value=<%=rs("title")%> readonly="" style="background-color:eeeeee "></td></tr>
		<tr bgcolor="eeeeee">
    <td height="22">内容<br><textarea cols=80 rows=10 name="content" readonly style="background-color:eeeeee"><%=rs("content")%></textarea></td></tr>
	<tr bgcolor="99cc99" align="center">
    <td height="22"><input type=submit name="del3" value="删除"></td></tr>
	</table></form>
	<%rs.close
	response.end
	end if%>
	
	<table width="90%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">
      <tr align="center" bgcolor="99cc99">
	  <td height="22" width="50">项目</td>
	  <td height="22" width="50">主题</td>
        <td height="22">标题</td>
        <td>内容</td>
        <td height="22">时间</td>
        <td>操作</td>
      </tr>
	  <%rs.open"select * from article order by id desc",conn,1,1
	  if not rs.eof then
	  rs.pagesize=12
	  maxpage=rs.pagecount
	  maxrecord=rs.recordcount
	  if cint(request("p"))<>"" then
	  p=cint(request("p"))
	  else
	  p=1
	  end if
	  if p>maxpage then
	  p=maxpage
	  end if
	  if p=0 then
	  p=1
	  end if
	  if p<>1 then
	  rs.move (p-1)*rs.pagesize
	  end if
	  for i=1 to rs.pagesize%>
	  <form method=post action=article.asp?del=删除&id=<%=rs("id")%>>
      <tr><td height="22" width="50">
	  <%rs2.open"select * from class where id="&rs("bigclsid"),conn,1,1%><%=rs2("clsname")%><%rs2.close%></td>
	  <td height="22" width="50">
	  <%rs2.open"select * from class where id="&rs("smlclsid"),conn,1,1%><%=rs2("clsname")%><%rs2.close%>
	  </td>
        <td align="center"><%=rs("title")%></td>
        <td align="center"><%=left(rs("content"),15)&"..."%></td>
		<td><%=rs("sendtime")%></td>
        <td align="center"><input type=submit name="del2" value="删除"></td>
      </tr></form>
	  <%rs.movenext
	  if rs.eof then exit for
	  next
	  end if
	  rs.close%>
	  <tr align="center" bgcolor="99cc99">
        <td height="22" colspan="6">共有<font color=red><%=maxrecord%></font>篇文章,每页<font color=red>10</font>篇文章,共有<font color=red><%=maxpage%></font>页,当前页码<font color=red><%=p%></font>,
		<a href=article.asp?p=1&del=删除>首页</a>|
		<a href=article.asp?p=<%=p-1%>&del=删除>上页</a>|
		<a href=article.asp?p=<%=p+1%>&del=删除>下页</a>|
		<a href=article.asp?p=<%=maxpage%>&del=删除>尾页</a></td>
      </tr>  
    </table></td>
  </tr>
  
  <%elseif request("edit")="修改" then%>
    <tr><td height=20></td></tr>
    <tr>
    <td>
	<%if request("edit3")="修改" then
	id=cint(request("id"))
	title=trim(request("title"))
	content=trim(request("content"))
	if title="" then
	response.write"<script>alert('文章标题不能为空!');window.navigate('article.asp?edit=修改&id="&id&"&edit2=修改');</script>"
	elseif content="" then
	response.write"<script>alert('文章内容不能为空!');window.navigate('article.asp?edit=修改&id="&id&"&edit2=修改');</script>"
	else
	rs.open"select * from article where id="&id,conn,1,3
	rs("title")=title
	rs("content")=html(content)
	rs("sendtime")=now
	rs("sender")=session("admin")
	rs.update
	response.write"<script>alert('修改文章成功!');window.navigate('article.asp?edit=修改');</script>"
	rs.close
	end if
	end if %>
	<%if request("edit2")="修改" then
	id=cint(request("id"))
	rs.open"select * from article where id="&id,conn,1,1
	%><form method=post action=article.asp?edit=修改&id=<%=id%>>
    <table width="60%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">
    <tr align="center" bgcolor="99cc99">
    <td height="22">修改文章</td></tr>

	<tr bgcolor="eeeeee">
    <td height="22">标题<input type=text name="title" value=<%=rs("title")%> size=45></td></tr>
		<tr bgcolor="eeeeee">
    <td height="22">内容<br><textarea cols=80 rows=10 name="content" ><%=rs("content")%></textarea></td></tr>
	<tr bgcolor="99cc99" align="center">
    <td height="22"><input type=submit name="edit3" value="修改"></td></tr>
	</table></form>
<%
	response.end
	end if%>
	<table width="90%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">
      <tr align="center" bgcolor="99cc99">
	  <td height="22" width="50">项目</td>
	  <td height="22" width="50">主题</td>
        <td height="22">标题</td>
        <td>内容</td>
        <td height="22">时间</td>
        <td>操作</td>
      </tr>
	  <%rs.open"select * from article order by id desc",conn,1,1
	  if not rs.eof then
	  rs.pagesize=12
	  maxpage=rs.pagecount
	  maxrecord=rs.recordcount
	  if cint(request("p"))<>"" then
	  p=cint(request("p"))
	  else
	  p=1
	  end if
	  if p>maxpage then
	  p=maxpage
	  end if
	  if p=0 then
	  p=1
	  end if
	  if p<>1 then
	  rs.move (p-1)*rs.pagesize
	  end if
	  for i=1 to rs.pagesize%>
	  <form method=post action=article.asp?edit=修改&id=<%=rs("id")%>>
      <tr><td align="center"><%rs2.open"select * from class where id="&rs("bigclsid"),conn,1,1%><%=rs2("clsname")%><%rs2.close%></td>
        <td align="center"><%rs2.open"select * from class where id="&rs("smlclsid"),conn,1,1%><%=rs2("clsname")%><%rs2.close%></td>
		<td align="center"><%=rs("title")%></td>
        <td align="center"><%=left(rs("content"),15)&"..."%></td>
		<td><%=rs("sendtime")%></td>
        <td align="center"><input type=submit name="edit2" value="修改"></td>
      </tr></form>
	  <%rs.movenext
	  if rs.eof then exit for
	  next
	  end if
	  rs.close%>
	  <tr align="center" bgcolor="99cc99">
        <td height="22" colspan="6">共有<font color=red><%=maxrecord%></font>篇文章,每页<font color=red>10</font>篇文章,共有<font color=red><%=maxpage%></font>页,当前页码<font color=red><%=p%></font>,
		<a href=article.asp?p=1&edit=修改>首页</a>|
		<a href=article.asp?p=<%=p-1%>&edit=修改>上页</a>|
		<a href=article.asp?p=<%=p+1%>&edit=修改>下页</a>|
		<a href=article.asp?p=<%=maxpage%>&edit=修改>尾页</a></td>

      </tr>  
    </table></td>
  </tr>
  <%end if%>

</table>

⌨️ 快捷键说明

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