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

📄 modyinfo.asp

📁 功能说明: 1
💻 ASP
字号:
<!--#include file="adminconn.asp"-->
<!--#include file="include/function.asp"-->
<!--#include file="lib.asp" -->
<%
  if session("aleave")="" then
      response.redirect "adminlogin.asp"
	  response.end
  end if
  
	fname = makefilename(now()) 		 'makefilename为自定义函数 
	folder = "../news/"&year(date())&"/"&month(date())&"-"&day(date())&"/"		 '"&month(date())&"取值月份
	filepath = folder&fname

  //修改后提交数据
if request("no")="modi" then
newsid=request("newsid")
d_title=request("d_title")
BigClassName=request("BigClassName")
SmallClassName=request("SmallClassName")
d_content=request("d_content")
mimageNum = Request.form("imageNum")
firstImageName = trim(Request.form("editFirstImageName"))
d_user=request("d_user")
ok=request("ok")

set js = server.CreateObject("ADODB.RecordSet")
sql="select * from bigclass"
set js = conn.Execute (Sql) 
do while not js.eof
    bigclass=js("BigClassName")   
goaler = goaler + " <td height='30' align='center'  onmouseover='this.bgColor='#FFFFFF'>"&"<a href=../../../otype.asp?owen1="&BigClass&">"&BigClass&"</a></td>"
js.movenext 
loop
goaler = "<table width='100%' height='29' border='0' cellpadding='0' cellspacing='1'><tr>" + goaler + "</tr></table>"
js.close
set js = nothing


set rs=server.createobject("adodb.recordset")
sql="select * from NEWS where id="&newsid
rs.open sql,conn,1,3
rs("title")=d_title						'标题
rs("memo")=d_content					'新闻内容
rs("user")=d_user  						'发布人
rs("BigClassName")=BigClassName			'大分类
rs("SmallClassName")=SmallClassName			'小分类
Rs("titlecolor")=titlecolor							'标题颜色
Rs("D_Picture") = sPicture								'上传的图片
'if ok<>"" then rs("ok") = ok
if mimageNum<>"" then rs("imageNum") = mimageNum  '如果上传的图片不为空,上传的图片数
if firstImageName<>"" then rs("firstImageName") = firstImageName
rs.update
rs.close
set rs=nothing

'调用第一个模板生成HTML文件
sql1="select m_id,m_html from c_moban where m_id=3"
set rs1=Server.CreateObject("adodb.recordset")
rs1.open sql1,conn,1,1
mb_code=rs1("m_html")
rs1.close
set rs1=nothing
c_title=htmlencode(d_title)
c_content=d_mcontent
mb_code=replace(mb_code,"$aoyi_infotime$",now())									'$aoyi_infotime$替代发布时间
mb_code=replace(mb_code,"$aoyi_title$",d_title)									'$aoyi_title$替代新闻标题
mb_code=replace(mb_code,"$aoyi_bigclass$",goaler)									'$aoyi_bigclass$替代导航条
mb_code=replace(mb_code,"$aoyi_bigclassname$",bigclassname)							'$aoyi_bigclassname$替代大类
mb_code=replace(mb_code,"$aoyi_smallclassname$",smallclassname)						'$aoyi_smallclassname$替代小类
mb_code=replace(mb_code,"$aoyi_user$",d_user)										'$aoyi_user$替代发布人
mb_code=replace(mb_code,"$aoyi_newsid$",newsid)									'$aoyi_newsid$替代新闻ID
mb_code=replace(mb_code,"$aoyi_memo$",d_Content)									'$aoyi_memo$替代新闻ID
if newsid<>"" then
    Set rs = Server.CreateObject ("ADODB.Recordset")
    sql="select * from news where id="&newsid
    rs.Open sql,conn,1,1
    c_filepath=rs("c_filepath")   
rs.close
set rs=nothing
conn.close
set conn=nothing
end if

'if c_filepath="" then
'Set fso = Server.CreateObject("Scripting.FileSystemObject")
'fso.CreateFolder(Server.MapPath(folder))
'Set fout = fso.CreateTextFile(Server.MapPath(filepath))
'fout.WriteLine mb_code
'fout.close
'elseif c_filepth<>"" then

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(Server.MapPath(c_filepath))
fout.WriteLine mb_code
fout.close
'end if

response.write "<script language='javascript'>" & chr(13)
		response.write "alert('新闻修改成功!');" & Chr(13)
		response.write "window.document.location.href='admin_info.asp';"&Chr(13)
		response.write "</script>" & Chr(13)
Response.End
end if
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from SmallClass order by SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs("SmallClassName"))%>","<%= trim(rs("BigClassName"))%>","<%= trim(rs("SmallClassName"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.addNEWS.SmallClassName.length = 1; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.addNEWS.SmallClassName.options[document.addNEWS.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
    }    
function CheckForm()
{
     document.addNEWS.cnWords.value = document.frames.cnEditBox.getHTML(true);     
     document.addNEWS.imageNum.value = document.frames.cnEditBox.document.all("editImageNum").value;
     document.addNEWS.editFirstImageName.value = document.frames.cnEditBox.document.all("editFirstImageName").value;

	if (document.addNEWS.title.value.length == 0) {
		alert("新闻标题没有填写.");
		document.addNEWS.title.focus();
		return false;
	}
		if (document.addNEWS.user.value.length == 0) {
		alert("新闻发布人没有填写");
		document.addNEWS.user.focus();
		return false;
	}
	return true;
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link href="../images/yxwancss.css" rel="stylesheet" type="text/css">
<style>
.red{
	background-color: #FF0000;
	border: 1px solid #FF0000;
}
.black{
	background-color: #000000;
	border: 1px solid #000000;
}
.blue{
	background-color: #0000ff;
	border: 1px solid #0000ff;
}
.green{
	background-color: #00ff00;
	border: 1px solid #00ff00;
}
.yello{
	background-color: #ffff00;
	border: 1px solid #ffff00;
}
.hese{
	background-color: #660000;
	border: 1px solid #660000;
}
.fenhon{
	background-color: #ff00ff;
	border: 1px solid #ff00ff;
}
.hui{
	background-color: #666666;
	border: 1px solid #666666;
}
.luse{
	background-color: #006600;
	border: 1px solid #006600;
}
.lanse{
	background-color: #3366ff;
	border: 1px solid #3366ff;
}
.zise{
	background-color: #cc00cc;
	border: 1px solid #cc00cc;
}
</style>
</head>
<body style="margin:0">
<% 
newsid=request("id")
Set rso=Server.CreateObject("ADODB.RecordSet") 
sql="select * from NEWS where  id="&newsid
rso.Open sql,conn,1,1
if rso.eof and rso.bof then
response.Write("没有记录")
else
%>
<form name="addNEWS" method="post" action="modyinfo.asp?no=modi" style="margin:0">
<input type=hidden name=d_originalfilename value="<%=rso("d_originalfilename")%>">
	<% '取保存的方件名,如果不要带路径的填充下拉框,可以在下面的表单项加入onchange事件 %>
	<input type=hidden name=d_savefilename value="<%=rso("d_savefilename")%>">
	<% '取保存的文件名(带路径),使用带路径的填充下拉框 %>
	<input type=hidden name=d_savepathfilename  value="<%=rso("d_savepathfilename")%>">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="5"></td>
    </tr>
  </table>
  <div align="center">
  <table width="580" border="0" cellpadding="0" cellspacing="0">
    <tr> 
      <td width="580" colspan="2"><table width="550" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <th height="20">修改新闻</th>
          </tr>
        </table></td>
    </tr>
    <tr> 
      <td width="580" colspan="2"><hr size="1" color="#FF0000"></td>
    </tr>
	 <tr> 
      <td height="30" class="px12" width="373"> 标题: 
        <input name="d_title" type="text" size="40" value="<%=rso("title")%>">
        </td>
      <td height="30" class="px12" width="211">发布人:<input name="d_user" type="text" size="15" value="<%=rso("user")%>" ></td>
    </tr>    
	<tr> 
      <td height="30" class="px12" width="580" colspan="2"> 标题颜色:
        <input name="titlecolor" type="radio" class="black" value="000000" <%if rso("titlecolor")="000000" then response.Write("checked")%>>
        <input type="radio" name="titlecolor" value="ff0000" class="red" <%if rso("titlecolor")="ff0000" then response.Write("checked")%>>
        <input type="radio" name="titlecolor" value="0000ff" class="blue" <%if rso("titlecolor")="0000ff" then response.Write("checked")%>>
        <input type="radio" name="titlecolor" value="00ff00" class="green" <%if rso("titlecolor")="00ff00" then response.Write("checked")%>>
        <input type="radio" name="titlecolor" value="ffff00" class="yello" <%if rso("titlecolor")="ffff00" then response.Write("checked")%>>
        <input type="radio" name="titlecolor" value="660000" class="hese" <%if rso("titlecolor")="660000" then response.Write("checked")%>>
        <input type="radio" name="titlecolor" value="ff00ff" class="fenhon" <%if rso("titlecolor")="ff00ff" then response.Write("checked")%>>
        <input type="radio" name="titlecolor" value="666666" class="hui" <%if rso("titlecolor")="666666" then response.Write("checked")%>>
        <input type="radio" name="titlecolor" value="006600" class="luse" <%if rso("titlecolor")="006600" then response.Write("checked")%>>
        <input type="radio" name="titlecolor" value="3366ff" class="lanse" <%if rso("titlecolor")="3366ff" then response.Write("checked")%>>
        <input type="radio" name="titlecolor" value="cc00cc" class="zise" <%if rso("titlecolor")="cc00cc" then response.Write("checked")%>>
      </td>
    </tr>
	<tr> 
      <td height="30" class="px12" width="580" colspan="2">   <%
	if session("aleave")="check" then
		response.write rso("BigClassName") & "<input name='BigClassName' type='hidden' value='" & rso("BigClassName") & "'>&gt;&gt;"
	else		
        sql = "select * from BigClass"
        rs.open sql,conn,1,1
		if rs.eof and rs.bof then
			response.write "请先添加栏目。"
		else
		%>
                    <select name="BigClassName" onChange="changelocation(document.addNEWS.BigClassName.options[document.addNEWS.BigClassName.selectedIndex].value)" size="1">
                      <%
		    do while not rs.eof
			%>
                      <option <% if rs("BigClassName")=rso("BigClassName") then response.Write("selected") end if%> value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
                      <%
		        rs.movenext
    	    loop
		end if
        rs.close
			%>
                    </select> 
                    <%
	end if
	if session("aleave")="check" then
		response.write rso("SmallClassName") & "<input name='SmallClassName' type='hidden' value='" & rso("SmallClassName") & "'>"
	else
	%>
                    <select name="SmallClassName">
                      <option value="" <%if rso("SmallClassName")="" then response.write "selected"%>>不指定小类</option>
                      <%
			sql="select * from SmallClass where BigClassName='" & rso("BigClassName") & "'" 
			rs.open sql,conn,1,1 
			if not(rs.eof and rs.bof) then  
				do while not rs.eof %> 
                      <option <% if rs("SmallClassName")=rso("SmallClassName") then response.Write("selected") end if%> value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
                      <%
			    	rs.movenext
				loop
			end if
	        rs.close
			%>
                    </select> 
                    <%
	end if
	%>      </td>
    </tr>
	<tr> 
     <td height="300" valign="top" width="580" colspan="2"><textarea name="d_content" style="display:none"><%=rso("memo")%></textarea> 
 <iframe ID="eWebEditor1" src="ewebeditor.asp?id=d_content&style=s_green&originalfilename=d_originalfilename&savefilename=d_savefilename&savepathfilename=d_savepathfilename" frameborder="0" scrolling="no" width="100%" HEIGHT="350"></iframe>
 	</td>
    </tr>
    <tr> 
      <td width="580" colspan="2"><hr size="1" color="#FF0000"></td>
    </tr>
    <tr> 
      <td style="font-size:12px" height="20" width="580" colspan="2"><input type="submit" name="Submit" value="提交">
      <input type="hidden" name="newsId" value="<%=newsId%>"> 
        <input type="reset" name="Submit2" value="重置">
        <input type="button" name="Submit3" value="放弃" onClick="javascript:window.location.href='info.asp'"> </td>
    </tr>
  </table>
</div>
</form>
<% End If
rso.close
set rso=nothing
 %>
</body>
</html>

⌨️ 快捷键说明

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