ASP+ajax实现顶一下、踩一下同支持与反对的实现代码(ajax刷新整个页面)怎么可以错过

随心笔谈11个月前发布 admin
81 0


mycookies=0
id=clng(request.form(“id”))
dingcai=request.form(“dingcai”)
if id<>”” then
if request.cookies(“mycookies”&id)<>id then
‘写入cookies,有效期24小时
Response.cookies(“mycookies”&id)=id
Response.Cookies(“mycookies”&id).expires=dateadd(“H”,24,now())
else
mycookies=1
end if
else
mycookies=1
end if

‘接受对应的id
‘如果顶踩过来的id不为空,并且获取是顶的操作或踩的操作
if request.form(“id”)<>”” and request.form(“dingcai”)<>”” then

‘如果是顶的操作
if dingcai=1 then
sql=”update dingcai set ding=ding+1 where id=”&id
else
sql=”update dingcai set cai=cai+1 where id=”&id
end if

if mycookies=0 then
conn.execute(sql)
response.write “yang_yes”
else
response.write “yang_no”
end if
end if

© 版权声明

相关文章