📄 edit.asp
字号:
<!--#include file="users.asp" -->
<%
function strLength(str)
ON ERROR RESUME NEXT
dim WINNT_CHINESE
WINNT_CHINESE = (len("论坛")=2)
if WINNT_CHINESE then
dim l,t,c
dim i
l=len(str)
t=l
for i=1 to l
c=asc(mid(str,i,1))
if c<0 then c=c+65536
if c>255 then
t=t+1
end if
next
strLength=t
else
strLength=len(str)
end if
if err.number<>0 then err.clear
end function
if session("user")="" then
Response.redirect "index.asp"
response.end
else
Set admin = Server.CreateObject("ADODB.Recordset")
asql="SELECT * FROM admin where admin='"&session("user")&"'"
admin.OPEN asql, Conn,1,1
if admin.eof and admin.bof then
Response.redirect "index.asp"
response.end
else
if session("pas")<>admin("pws") then
Response.redirect "index.asp"
response.end
end if
end if
admin.close
set admin=nothing
end if
if request("delete")<>"" then
call delete()
response.end
end if
if request("save")<>"" then
call save()
response.end
end if
if request("sub")="ok" then
if request("del")="" then
response.write "大哥拜托,不要黑我的程序啊~"
response.end
else
sql = "delete from download where id="&request("del")
conn.execute sql
response.write "删除成功"
response.write "<a href=""list.asp"">返回</a>"
response.end
end if
end if
Set rs = Server.CreateObject("ADODB.Recordset")
if request("id")<>"" then
sql="SELECT * FROM download where id="&request("id")
else
sql="SELECT * FROM download"
end if
rs.OPEN sql, Conn,1,1
%>
<!--#include file="code.asp" -->
<!--#include file="first.asp" -->
<table border=0 cellspacing=0 style='border-collapse:collapse' width=735 height=233 cellpadding=3>
<tr>
<td width=185 valign=top>
<!--#include file="inc.asp" -->
</td>
<td width=550 height=233 valign=top>
<center>
<table style="border-collapse: collapse" bordercolor="#111111" bgcolor=#efefef border=1 cellspacing=0 cellpadding=3 width=500><col width=100><col width=400>
<tr bgcolor=#f7f7f7>
<form action="edit.asp?save=yes" method="POST">
<td align=right>编号:</td>
<td><input type=text name=id size=15
<%if request("id")<>"" then%>
value="<%=request("id")%>"
<%else%>
value=""
<%end if%>
style='color:#000000; border:0px; background-color:#f7f7f7' readonly></td>
</tr>
<tr>
<td align=right>名称:</td>
<td><input type=text name=name size=30
<%if request("id")<>"" then%>
value="<%=rs("name")%>"
<%else%>
value=""
<%end if%>
></td>
</tr>
<tr bgcolor=#f7f7f7>
<td align=right>更新日期:</td>
<td><input type=text name=time size=20
<%if request("id")<>"" then%>
value="<%=rs("time")%>"
<%else%>
value="<%=now()%>"
<%end if%>></td>
</tr>
<tr>
<td align=right>文件大小:</td>
<td><input type=text name=size size=20
<%if request("id")<>"" then%>
value="<%=rs("size")%>"
<%else%>
value=""
<%end if%>
></td>
</tr>
<tr bgcolor=#f7f7f7>
<td align=right>授权方式:</td>
<td><input type=text name=mode size=20
<%if request("id")<>"" then%>
value="<%=rs("mode")%>"
<%else%>
value=""
<%end if%>
></td>
</tr>
<tr>
<td align=right>应用平台:</td>
<td><input type=text name=roof size=20
<%if request("id")<>"" then%>
value="<%=rs("roof")%>"
<%else%>
value=""
<%end if%>
></td>
</tr>
<tr bgcolor=#f7f7f7>
<td align=right>推荐程度:</td>
<td><select size=1 name=commend>
<option value='0' selected>0 颗星</option>
<option value='1'>1 颗星</option>
<option value='2'>2 颗星</option>
<option value='3'>3 颗星</option>
<option value='4'>4 颗星</option>
<option value='5'>5 颗星</option>
</select></td>
</tr>
<tr>
<td align=right>程序主页:</td>
<td><input type=text name=homepage size=50
<%
if request("id")<>"" then
if rs("homepage")<>"" then
%>
value="<%=rs("homepage")%>"
<%
end if
else
%>
value=""
<%end if%>
></td>
</tr>
<tr bgcolor=#f7f7f7>
<td align=right>演示地址:</td>
<td><input type=text name=demo size=50
<%
if request("id")<>"" then
if rs("demo")<>"" then
%>
value="<%=rs("demo")%>"
<%
end if
else
%>
value=""
<%end if%>
></td>
</tr>
<tr>
<td align=right>图片地址:</td>
<td><input type=text name=pic size=50
<%
if request("id")<>"" then
if rs("pic")<>"" then
%>
value="<%=rs("pic")%>"
<%
end if
else
%>
value=""
<%end if%>
></td>
</tr>
<tr bgcolor=#f7f7f7>
<td align=right>程序分类:</td>
<td><select size=1 name=sort2id>
<%
Set rq = Server.CreateObject("ADODB.Recordset")
sqq="SELECT * FROM small"
rq.OPEN sqq, Conn,1,1
if not (rq.eof and rq.bof) then
rq.movefirst
do while not rq.eof
%>
<option value='<%=rq("id")%>'><%=rq("small")%>(<%=rq("sortid")%>)</option>
<%
rq.movenext
loop
end if
rq.close
set rq=nothing
%>
</select>
</tr>
<tr>
<td width=131 valign=top valign=top align=right>程序简介:</td>
<td>
<textarea rows=8 name=brief cols=50>
<%
if request("id")<>"" then
if rs("show")<>"" then
%>
<%=rs("show")%>
<%
end if
end if
%>
</textarea>
</td>
</tr>
<tr bgcolor=#f7f7f7>
<td align=right>下载地址1:</td>
<td><input type=text name=down1 size=40
<%if request("id")<>"" then%>
value="<%=rs("down1")%>"
<%else%>
value=""
<%end if%>
>
不能为空</td>
</tr>
<tr>
<td align=right>下载地址2:</td>
<td><input type=text name=down2 size=50
<%
if request("id")<>"" then
if rs("down2")<>"" then
%>
value="<%=rs("down2")%>"
<%
end if
else
%>
value=""
<%end if%>
></td>
</tr>
<tr bgcolor=#f7f7f7>
<td align=right>下载地址3:</td>
<td><input type=text name=down3 size=50
<%
if request("id")<>"" then
if rs("down3")<>"" then
%>
value="<%=rs("down3")%>"
<%
end if
else
%>
value=""
<%end if%>
></td>
</tr>
<tr>
<td align=right>下载地址4:</td>
<td><input type=text name=down4 size=50
<%
if request("id")<>"" then
if rs("down4")<>"" then
%>
value="<%=rs("down4")%>"
<%
end if
else
%>
value=""
<%end if%>
></td>
</tr>
<tr bgcolor=#f7f7f7>
<td align=right>下载地址5:</td>
<td><input type=text name=down5 size=50
<%
if request("id")<>"" then
if rs("down5")<>"" then
%>
value="<%=rs("down5")%>"
<%
end if
else
%>
value=""
<%end if%>
></td>
</tr>
<tr>
<td width=492 colspan=2 align=center>
<input type=submit value=提交 name=sendadd>
<input type=reset value=重填></td>
</form>
</tr>
</table>
</center><br><br>
</td>
</tr>
</table>
</body>
</html>
<%
sub delete()
%>
<body topmargin="120">
<form method="POST" action="edit.asp?del=<%=request("delete")%>&sub=ok">
<p align="center">确认删除</p>
<p align="center"><input type="submit" value="确认" name="ok"> <a href="list.asp">返回</a></p>
</form>
</body>
<%
end sub
sub save()
Set rs1 = Server.CreateObject("ADODB.Recordset")
if request("id")<>"" then
sql1="SELECT * FROM download where id="&request("id")
else
sql1="SELECT * FROM download"
end if
rs1.OPEN sql1, Conn,1,3
if request("id")<>"" then
if trim(request("name"))<>"" then
if strLength(trim(request("name")))>40 then
response.write "输入的软件名称过长"
response.end
else
rs1("name")=trim(request("name"))
end if
else
response.write "请输入软件名称"
response.end
end if
if request("time")<>"" then
if isdate(request("time"))=true then
rs1("time")=cdate(request("time"))
else
response.write "输入的字符不符合日期规格"
response.end
end if
end if
if request("size")<>"" then
if strLength(request("size"))>40 then
response.write "输入的软件大小字符过长"
response.end
else
rs1("size")=request("size")
end if
else
rs1("size")="不详"
end if
if request("mode")<>"" then
if strLength(request("mode"))>40 then
response.write "输入的字符过长"
response.end
else
rs1("mode")=request("mode")
end if
else
rs1("mode")="不详"
end if
if request("roof")<>"" then
if strLength(request("roof"))>40 then
response.write "输入的字符过长"
response.end
else
rs1("roof")=request("roof")
end if
else
rs1("roof")="不详"
end if
if request("commend")="0" then
rs1("commend")="0stars.gif"
elseif request("commend")="1" then
rs1("commend")="1stars.gif"
elseif request("commend")="2" then
rs1("commend")="2stars.gif"
elseif request("commend")="3" then
rs1("commend")="3stars.gif"
elseif request("commend")="4" then
rs1("commend")="4stars.gif"
elseif request("commend")="5" then
rs1("commend")="5stars.gif"
end if
if request("homepage")<>"" then
if strLength(request("homepage"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("homepage")=request("homepage")
end if
end if
if request("demo")<>"" then
if strLength(request("demo"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("demo")=request("demo")
end if
end if
if request("pic")<>"" then
if strLength(request("pic"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("pic")=request("pic")
end if
end if
if request("sort2id")<>"" then
Set rssort = Server.CreateObject("ADODB.Recordset")
sqlsort="SELECT * FROM small where id="&request("sort2id")
rssort.OPEN sqlsort, Conn,1,1
rs1("sort")=rssort("small")
rs1("big")=rssort("sortid")
rs1("sortcount")=rssort("id")
rssort.close
set rssort=nothing
else
response.write "没有添加分类,或者非法操作"
response.end
end if
if request("brief")<>"" then
rs1("show")=request("brief")
else
rs1("show")="不详"
end if
if request("down1")<>"" then
if strLength(request("down1"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("down1")=request("down1")
end if
else
response.write "不能没有下载地址"
response.end
end if
if request("down2")<>"" then
if strLength(request("down2"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("down2")=request("down2")
end if
end if
if request("down3")<>"" then
if strLength(request("down3"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("down3")=request("down3")
end if
end if
if request("down4")<>"" then
if strLength(request("down4"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("down4")=request("down4")
end if
end if
if request("down5")<>"" then
if strLength(request("down5"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("down5")=request("down5")
end if
end if
else
rs1.addnew
if trim(request("name"))<>"" then
if strLength(trim(request("name")))>40 then
response.write "输入的软件名称过长"
response.end
else
rs1("name")=trim(request("name"))
end if
else
response.write "请输入软件名称"
response.end
end if
if request("time")<>"" then
if isdate(request("time"))=true then
rs1("time")=cdate(request("time"))
else
response.write "输入的字符不符合日期规格"
response.end
end if
end if
if request("size")<>"" then
if strLength(request("size"))>40 then
response.write "输入的软件大小字符过长"
response.end
else
rs1("size")=request("size")
end if
else
rs1("size")="不详"
end if
if request("mode")<>"" then
if strLength(request("mode"))>40 then
response.write "输入的字符过长"
response.end
else
rs1("mode")=request("mode")
end if
else
rs1("mode")="不详"
end if
if request("roof")<>"" then
if strLength(request("roof"))>40 then
response.write "输入的字符过长"
response.end
else
rs1("roof")=request("roof")
end if
else
rs1("roof")="不详"
end if
if request("commend")="0" then
rs1("commend")="0stars.gif"
elseif request("commend")="1" then
rs1("commend")="1stars.gif"
elseif request("commend")="2" then
rs1("commend")="2stars.gif"
elseif request("commend")="3" then
rs1("commend")="3stars.gif"
elseif request("commend")="4" then
rs1("commend")="4stars.gif"
elseif request("commend")="5" then
rs1("commend")="5stars.gif"
end if
if request("homepage")<>"" then
if strLength(request("homepage"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("homepage")=request("homepage")
end if
end if
if request("demo")<>"" then
if strLength(request("demo"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("demo")=request("demo")
end if
end if
if request("pic")<>"" then
if strLength(request("pic"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("pic")=request("pic")
end if
end if
if request("sort2id")<>"" then
Set rssort = Server.CreateObject("ADODB.Recordset")
sqlsort="SELECT * FROM small where id="&request("sort2id")
rssort.OPEN sqlsort, Conn,1,1
rs1("sort")=rssort("small")
rs1("big")=rssort("sortid")
rs1("sortcount")=rssort("id")
rssort.close
set rssort=nothing
else
response.write "没有添加分类,或者非法操作"
response.end
end if
if request("brief")<>"" then
rs1("show")=request("brief")
else
rs1("show")="不详"
end if
if request("down1")<>"" then
if strLength(request("down1"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("down1")=request("down1")
end if
else
response.write "不能没有下载地址"
response.end
end if
if request("down2")<>"" then
if strLength(request("down2"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("down2")=request("down2")
end if
end if
if request("down3")<>"" then
if strLength(request("down3"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("down3")=request("down3")
end if
end if
if request("down4")<>"" then
if strLength(request("down4"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("down4")=request("down4")
end if
end if
if request("down5")<>"" then
if strLength(request("down5"))>200 then
response.write "输入的字符过长"
response.end
else
rs1("down5")=request("down5")
end if
end if
end if
rs1.Update
rs1.close
set rs1=nothing
response.write "添加成功!"
response.write "<a href=""edit.asp"">返回继续</a>"
end sub
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -