vaddo.asp

来自「ASP入门与提高实用教程 源文件(上传网站)」· ASP 代码 · 共 79 行

ASP
79
字号
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/const.asp"-->
<!--#include file="../inc/md5.asp"--><%
checkadmin()

dim opt,title,multi,id
dim foundErr,i
dim rs,exec1
foundErr=false

opt=encodestr(Request.form("opt"))
ID=encodestr(Request.form("ID"))
multi=encodestr(Request.form("multi1"))
opt=split(opt,",")

for i=0 to ubound(opt)
	if len(opt(i))<1 then
		session("error")="选项或标题不能为空!!<br>"
		foundErr=true
	end if
next

if foundErr then
	connclose()
	response.redirect("error.asp")
end if

Set rs = Server.CreateObject("ADODB.Recordset")
if id="" then
	exec1="select top 1 * from vote order by id desc"
	rs.Open exec1,conn,1,3
	if not rs.eof then 
		id=rs("id")+1
	else
		id=1
	end if
for i=0 to Ubound(opt)
	rs.addnew
		rs("id")=id
		rs("options")=i
		rs("title")=opt(i)
		rs("multi")=multi
		rs("username")=session("admin")
		rs("Lastip")=request.servervariables("remote_addr")
	rs.update
next
else
	exec1="select  * from vote where id ="&id
	rs.Open exec1,conn,1,3
for i=0 to Ubound(opt)
		rs("options")=i
		rs("title")=opt(i)
		rs("username")=session("admin")
		rs("Lastip")=request.servervariables("remote_addr")
	rs.movenext
next
	rs.updatebatch

end if
rsclose()
connclose()
%>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="142">&nbsp;</td>
    <td width="224">提交成功!</td>
    <td width="134">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><a href="Vlist.asp">返回管理页</a></td>
    <td>&nbsp;</td>
  </tr>
</table>

⌨️ 快捷键说明

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