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

📄 news.asp

📁 1.理解Winsock编程模型; 2.掌握Winsock编程的基本方法
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 
<!--#include file="conn.asp"-->
<% 
if session("action")<>"welcome110" then
if session("uname")="" then
%>
<script language="javascript">
				if 	(confirm("您进行的是非法登录,请重新登录!"))
				  location.href="admin.asp";			
				</script>
<%

end if 
end if
%>
<html>
<head>
<META content="" name=keywords>
<META content="" name=description>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>新闻管理</title>
<base target="_self">
<STYLE type="text/css">
<!--
a:link       {text-decoration: none; font-family: AdobeSm; color: #000000 }
a:visited    {text-decoration: none; color: #000000 }
A:hover      {COLOR: green; FONT-FAMILY: "宋体,MingLiU"; TEXT-DECORATION: underline}
body         {font-size: 9pt; font-family: 宋体,MingLiU, Arial;color: #000000}
TD           {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000;table-layout:fixed;word-break:break-all}
p            {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
input        {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
body         {margin-top: 0; margin-bottom: 0;margin-left:0;margin-right:0; color: #000000}
select       {FONT-SIZE: 9PT;}
option       {FONT-SIZE: 9pt;}
textarea     {FONT-SIZE: 9pt;}
-->
</STYLE>
<base target="_self">
<script language="JavaScript" type="text/JavaScript">
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
 
 function news(URL)
  { window.open(URL,"news","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,width=550,height=300");
  }
</script>

</head>

<body topmargin="0" text=#ffffff>

          <%
action=request("action")
if action="关闭" then
	NewsId=replace(request("id")," ","")
	call prodclose()
end if

if action="打开" then
	NewsId=replace(request("id")," ","")
	call prodopen()
end if

if action="删除" then
delid=replace(request("id")," ","")
aa=replace(request("id")," ","")
call proddel()
end if

if action="加新闻" then
call newsadd()
end if

if action="修改" then
id=replace(request("id")," ","")
call modify()
end if
sub prodopen()
	if NewsId="" or isnull(NewsId) then
		Response.write "<BLOCKQUOTE><br><br>操作失败,没有选择合适参数!<A HREF='news.asp'><b>点击返回</b></A><BR><br><meta http-equiv=refresh content=""2;URL=news.asp""></BLOCKQUOTE>"
	else
		Set rs=Server.CreateObject("ADODB.Recordset")
		sql="select * from News where NewsId in ("&NewsId&")"
		rs.open sql,conn,3,2
		if err.number<>0 then '错误处理
			response.write "数据库操作失败:" & err.description
			err.clear
		else
			if rs.eof and rs.bof then
				response.write "<script language='javascript'>"
				response.write "alert('该新闻不存在,或者被删除了!');"	
				response.write "location.href='news.asp';"							
				response.write "</script>"			
			else
				Do while not rs.eof
				rs("online")=true
				rs.update
				rs.movenext
				loop				 
				response.write "<script language='javascript'>"
				response.write "alert('新闻 在线显示 设置成功!');"
				response.write "location.href='news.asp';"			
				response.write "</script>"
			end if
			rs.close
			conn.close
			set rs=nothing
			set conn=nothing
		end if
	end if
end sub

sub prodclose()
if NewsId="" or isnull(NewsId) then
		Response.write "<BLOCKQUOTE><br><br>操作失败,没有选择合适参数!<A HREF='news.asp'><b>点击返回</b></A><BR><br><meta http-equiv=refresh content=""2;URL=news.asp""></BLOCKQUOTE>"
	else
		Set rs=Server.CreateObject("ADODB.Recordset")
		sql="select * from News where NewsId in ("&NewsId&")"
		rs.open sql,conn,3,2
		if err.number<>0 then '错误处理
			response.write "数据库操作失败:" & err.description
			err.clear
		else
			if rs.eof and rs.bof then
				response.write "<script language='javascript'>"
				response.write "alert('该新闻不存在,或者被删除了!');"	
				response.write "location.href='news.asp';"				
				response.write "</script>"			
			else
				Do while not rs.eof
				rs("online")=false
				rs.update
				rs.movenext
				loop		 
				response.write "<script language='javascript'>"
				response.write "alert('新闻 离线 设置成功!');"
				response.write "location.href='news.asp';"			
				response.write "</script>"
			end if
			rs.close
			conn.close
			set rs=nothing
			set conn=nothing
		end if
	end if
end sub

sub proddel()
	if delid="" or isnull(delid) then
		Response.write "<BLOCKQUOTE><br><br>操作失败,没有选择合适参数!<A HREF='news.asp'><b>点击返回</b></A><BR><br><meta http-equiv=refresh content=""2;URL=news.asp""></BLOCKQUOTE>"
	else
		conn.execute("delete from News where NewsId in ("&delid&")")		
		Set rs4=Server.CreateObject("ADODB.Recordset")
		sql4="select * from sptp where spid in ("&delid&")"
		rs4.open sql4,conn,3,2
		if not rs4.eof then
		rs4.delete
		end if
		rs4.close
		if err.number<>0 then '错误处理
			response.write "<font color=black>数据库操作失败:</font>" & err.description
			err.clear
		else		
			conn.close
			set conn=nothing
			Response.write "<tr><td colspan=8><BLOCKQUOTE><br><br><font color=black>新闻删除成功!</font><A HREF='admin_news_lm.asp'><b><font color=black>点击返回</font></b></A><BR><br><meta http-equiv=refresh content=""2;URL=news.asp""></BLOCKQUOTE></td></tr>"
		end if
	end if
end sub


sub newsadd()

	if request("add") ="ok" then
	
	if request("title")="" then
	%>
<script language="javascript">
				if 	(confirm("新闻标题不能为空!"))
				  location.href="news.asp?action=加新闻";			
				</script>

<%	
elseif request("newsclass")="请选择" then
%>
<script language="javascript">
				if 	(confirm("请您选择所添加的新闻类型!"))
				  location.href="news.asp?action=加新闻";			
				</script>

<%
elseif request("content")="" then
%>
<script language="javascript">
				if 	(confirm("请添加新闻内容!"))
				  location.href="news.asp?action=加新闻";			
				</script>

<%
if request("hug")<>"" then
For m=1 to request("Hug")
	if request("Hug"&m&"")="" then
		%>
<script language="javascript">
				if 	(confirm("请您上传所要添加的图片!"))
				  location.href="news.asp?action=加新闻";			
				</script>
<%
			end if
							
				next
	end if		
				
else
	
		Set rs=Server.CreateObject("ADODB.Recordset")
		sql = "select * from News"
		rs.open sql,conn,3,2
		if err.number<>0 then '错误处理
			response.write "<font color=black>数据库操作失败:</font>" & err.description
			err.clear
		else		
		rs.Addnew
		lm=trim(request("newsclass"))
  aaa=split(lm,"|")
  lm1=aaa(0)
  lm2=aaa(1)
		titlecolor=request.form("titlecolor")
		rs("lm")=lm1
  rs("lm2")=lm2
		rs("titlecolor")=request.form("titlecolor")
		rs("title")=request.form("title")
		rs("content")=request.form("content")
		rs("PubDate")=now()
		rs("newsclass")=lm				
		rs("Online")=request.form("Online")
		rs("tupian")=false
		'if bb2<>"" then			
		'end if
		rs.update	
		rs.close		
		set rs=nothing	
		if request("Hug")<>"" then
set rs2=Server.CreateObject("adodb.recordset")
sql2 = "select * from News"
		rs2.open sql2,conn,3,2
rs2.movelast
n=rs2("newsid")
rs2("tupian")=true
rs2("jizhang")=request("Hug")
rs2.update
		 Set rs1=Server.CreateObject("ADODB.Recordset")
				sql1 = "select * from sptp"
		rs1.open sql1,conn,3,2
				For m=1 to request("Hug")
				rs1.addnew
				rs1("FilePath")=request("Hug"&m&"")
				rs1("content")=request(""&m&"")
				rs1("spid")=n
				rs1.update
				next								
				rs1.close
				rs2.close
				end if
		%>
<script language="javascript">
				if 	(confirm("新闻添加成功!"))
				  location.href="news.asp?action=加新闻";			
				</script>
<%
		end if
		end if	
	else
%><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFF00" bgcolor="#66CCFF" style="border-collapse: collapse" dwcopytype="CopyTableCell">
        <tr>
        <td width="100%" background="images/nihao.gif" height="27"><span class="style2">&nbsp;&nbsp;&nbsp;&nbsp;当前位置:<a href="admin.asp" class="style2"><font color="black">网站管理中心</font></a>--新闻管理</span></td>
      </tr></table>
		<table width="100%" border=1 cellpadding=3 style="border-collapse: collapse" bordercolor="#3D5489" align=center>
   <form name=form1 method="post" action='news.asp?action=加新闻'>
    <tr background="images/wo.gif">
      <td width="11%" align="right" background="images/wo.gif"><font color="black">新闻<br>
        标题</font></td>
      <td width="37%" colspan="2" background="images/wo.gif">
<input name="title" type="text" value="" size="50" maxlength="100"></td>
      <td width="52%" background="images/wo.gif">
<select size="1" name="titlecolor">
	            <option>默认颜色</option>
	            <OPTION <%if titlecolor="#000000" then response.write "selected"%> value="#000000" style="background-color:#000000"></OPTION>
                <OPTION <%if titlecolor="#FFFFFF" then response.write "selected"%> value="#FFFFFF" style="background-color:#FFFFFF"></OPTION>
                <OPTION <%if titlecolor="#008000" then response.write "selected"%> value="#008000" style="background-color:#008000"></OPTION>
                <OPTION <%if titlecolor="#800000" then response.write "selected"%> value="#800000" style="background-color:#800000"></OPTION>
                <OPTION <%if titlecolor="#808000" then response.write "selected"%> value="#808000" style="background-color:#808000"></OPTION>
                <OPTION <%if titlecolor="#000080" then response.write "selected"%> value="#000080" style="background-color:#000080"></OPTION>
                <OPTION <%if titlecolor="#800080" then response.write "selected"%> value="#800080" style="background-color:#800080"></OPTION>
                <OPTION <%if titlecolor="#808080" then response.write "selected"%> value="#808080" style="background-color:#808080"></OPTION>
                <OPTION <%if titlecolor="#FFFF00" then response.write "selected"%> value="#FFFF00" style="background-color:#FFFF00"></OPTION>
                <OPTION <%if titlecolor="#00FF00" then response.write "selected"%> value="#00FF00" style="background-color:#00FF00"></OPTION>
                <OPTION <%if titlecolor="#00FFFF" then response.write "selected"%> value="#00FFFF" style="background-color:#00FFFF"></OPTION>
                <OPTION <%if titlecolor="#FF00FF" then response.write "selected"%> value="#FF00FF" style="background-color:#FF00FF"></OPTION>
                <OPTION <%if titlecolor="#FF0000" then response.write "selected"%> value="#FF0000" style="background-color:#FF0000"></OPTION>
                <OPTION <%if titlecolor="#0000FF" then response.write "selected"%> value="#0000FF" style="background-color:#0000FF"></OPTION>
                <OPTION <%if titlecolor="#008080" then response.write "selected"%> value="#008080" style="background-color:#008080"></OPTION>
					</select></td>
    </tr>
    <tr>
      <td align="right" background="images/009.gif"><font color="black">新闻<br>类型</font></td>
      <td colspan="3" background="images/017.gif"><select name="newsclass"> 
	     <option value="请选择">请选择</option>
					  <%					  
					  sql = "select * from lm where lm<>'' order by id asc"
					  Set rs = Server.CreateObject("ADODB.RecordSet")
					  rs.Open sql,conn,1,1
					  while not rs.eof
					  if rs("moban")="1" then
					  %>
					   <option value='<%=rs("id")%>|'><%=rs("lm")%></option>
					   <% else 
					       response.write "<optgroup label='"&rs("lm")&"'>"
						    end if
							sql2 = "select * from lm where lmid='"&rs("id")&"' order by id asc"
							Set rs2 = Server.CreateObject("ADODB.RecordSet")
							rs2.Open sql2,conn,1,1
							while not rs2.eof
							%>
							   <option value='<%=rs("id")%>|<%=rs2("id")%>' <% if int(lmid)=rs2("id") then response.write " selected" %>>├(编号:<%=rs2("id")%>)<%=rs2("lm2")%></option>
							<%
							rs2.movenext
							wend
					  rs.movenext
					  wend 
					  rs.close
					  set rs=nothing
					
					%>
					
					</select>	
      </td>
    </tr>
	<tr>	
      <td align="center" bgcolor="#cbe1fc"><textarea name="content" style="display:none" cols="1" rows="1"><%if content<>"" then response.write content%></textarea></td>
      <td colspan="3"><IFRAME ID="eWebEditor1" SRC="edit/ewebeditor.asp?id=content&style=news" FRAMEBORDER="0" SCROLLING="no" WIDTH="100%" HEIGHT="399" marginwidth="1" marginheight="1" name="wfasdg"></IFRAME>
          </td>
    </tr>
    <tr>
      <td colspan="4" align="right"><div align="left">
          <table width="100%" border="1" cellpadding="0" cellspacing="0" background="images/015.gif">
            <div>
              <tr>
                <td width="100" align="right"><div align="center"></div>                  
                  <div align="right"><font color="black">商品图片:</font></div></td>

⌨️ 快捷键说明

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