生命交响曲在线听:更改asp代码!

来源:百度文库 编辑:高考问答 时间:2024/05/01 00:24:39
高手帮我下,我想将下载页面不通过登陆来下载,只要点击下载链接就可以下载。请帮改下。
<%

dim founderr,errmsg
errmsg=""
founderr=false
call chkparam()
if founderr then
call diserror()
response.end
else
if guestsoft="yes" then

softdowncount
call geturl()
else
if session("userlogin")<>"" then
softdowncount
call geturl()
else
Response.Write ("<script>alert(' 错误!\n\n您还没有登陆或登陆超时,请先登陆。');javascript:window.close();</script>")
Response.end
end if
end if

end if

sub chkparam()
if request.querystring("soft_id")<>"" then
if not isInteger(request.querystring("soft_id")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的文件ID参数。"
end if
else
founderr=true
errmsg=errmsg+"<br>"+"<li>你没有指定要下载的文件。"
end if
if request.querystring("url")<>"" then
if not isInteger(request.querystring("url")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的下载地址参数。"
end if
else
founderr=true
errmsg=errmsg+"<br>"+"<li>你没有指定下载地址参数。"
end if
end sub

sub geturl()
if(request.querystring("soft_id") <> "") then
colname = request.querystring("soft_id")
end if
url="soft_url"+request("url")
sql="select "&url&" from soft where soft_id="&colname&""
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
downurl=rs(0)
response.redirect downurl
rs.close
set rs=nothing
end sub

function softdowncount()
if(request.querystring("soft_id") <> "") then
upddcount__colname = request.querystring("soft_id")
end if
set rs=conn.execute("select soft_id,soft_dcount from soft")
sql="UPDATE soft SET soft_dcount = soft_dcount + 1 WHERE soft_id = " + Replace(upddcount__colname, "'", "''") + ""
conn.execute (sql)
rs.close
set rs=nothing
end function
%>

把登陆的验证去掉就可以了,这段改为:

dim founderr,errmsg
errmsg=""
founderr=false
call chkparam()
if founderr then
call diserror()
response.end
else
''直接记录下载次数,并且下载
softdowncount
call geturl()
end if

<%

dim founderr,errmsg
errmsg=""
founderr=false
call chkparam()
if founderr then
call diserror()
response.end
else

softdowncount
call geturl()

end if

sub chkparam()
if request.querystring("soft_id")<>"" then
if not isInteger(request.querystring("soft_id")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的文件ID参数。"
end if
else
founderr=true
errmsg=errmsg+"<br>"+"<li>你没有指定要下载的文件。"
end if
if request.querystring("url")<>"" then
if not isInteger(request.querystring("url")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的下载地址参数。"
end if
else
founderr=true
errmsg=errmsg+"<br>"+"<li>你没有指定下载地址参数。"
end if
end sub

sub geturl()
if(request.querystring("soft_id") <> "") then
colname = request.querystring("soft_id")
end if
url="soft_url"+request("url")
sql="select "&url&" from soft where soft_id="&colname&""
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
downurl=rs(0)
response.redirect downurl
rs.close
set rs=nothing
end sub

function softdowncount()
if(request.querystring("soft_id") <> "") then
upddcount__colname = request.querystring("soft_id")
end if
set rs=conn.execute("select soft_id,soft_dcount from soft")
sql="UPDATE soft SET soft_dcount = soft_dcount + 1 WHERE soft_id = " + Replace(upddcount__colname, "'", "''") + ""
conn.execute (sql)
rs.close
set rs=nothing
end function
%>