-
Notifications
You must be signed in to change notification settings - Fork 0
/
upnews.asp
105 lines (105 loc) · 3.29 KB
/
upnews.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--#include file="../include/conn.asp" -->
<!--#include file="chk_admin.asp" -->
<!--#include file="../include/include.asp" -->
<script language = "JavaScript">
function addnews()
{
if(document.myform.user.value=="")
{
document.myform.user.focus();
alert("请输入发表人!");
return false;
}
if(document.myform.shijian.value=="")
{
document.myform.shijian.focus();
alert("请输新闻时间!");
return false;
}
if(document.myform.biaoti.value=="")
{
document.myform.biaoti.focus();
alert("请输新闻biaoti!");
return false;
}
if(document.myform.neirong.value=="")
{
document.myform.neirong.focus();
alert("请输新闻内容!");
return false;
}
}
</script>
<%
if request("action")="update" then
if trim(request("user"))="" or trim(request("shijian"))="" or trim(request("biaoti"))="" or trim(request("neirong"))="" then
response.Write("<script>alert('请详细填写!');history.back();</script>")
response.End()
end if
sql="select * from [news] where id="&request("id")&";"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,3,3
rs("user")=trim(request("user"))
rs("shijian")=trim(request("shijian"))
rs("biaoti")=trim(request("biaoti"))
rs("neirong")=trim(request("neirong"))
rs.update
rs.close
set rs=nothing
response.Write("<script>alert('站内新闻修改成功!');window.location.href='news.asp';</script>")
end if
%>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#799AE1">
<tr>
<td align="center"><font color="#FFFFFF">修改站内新闻</font></td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF"><br>
<table width="90%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="799AE1">
<%
sql="select * from [news] where id="&request("id")&";"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,3,3
%>
<form name="myform" action="upnews.asp" method="post" onSubmit="return addnews();">
<tr height="20" bgcolor="#FFFFFF" align="center">
<td width="25%">发表人:</td>
<td width="75%"><div align="left">
<input name="user" type="text" value="<%=session("admin")%>">
</div></td>
</tr>
<tr height="20" bgcolor="#FFFFFF" align="center">
<td>时 间:</td>
<td><div align="left">
<input name="shijian" type="text" value="<%=now()%>">
</div></td>
</tr>
<tr height="20" bgcolor="#FFFFFF" align="center">
<td>标题名:</td>
<td><div align="left">
<input name="biaoti" type="text" size="40" value="<%=rs("biaoti")%>">
</div></td>
</tr>
<tr height="20" bgcolor="#FFFFFF" align="center">
<td>内 容:</td>
<td><div align="left"><textarea name="neirong" cols="80" rows="18"><%=rs("neirong")%></textarea>
</div></td>
</tr>
<tr height="20" bgcolor="#FFFFFF" align="center">
<td colspan="2">
<input name="action" type="hidden" value="update">
<input name="id" type="hidden" value="<%=request("id")%>">
<input name="submit" type="submit" value="修改">
<input type="reset" name="reset" value="重写">
</td>
</tr>
</form>
<%
rs.close
set rs=nothing
%>
</table>
<br></td>
</tr>
</table>