dim linkname,imgurl,linkurl
linkname=checkStr(request.Form("webname"))
linkurl=checkStr(request.Form("weburl"))
imgurl=checkStr(request.Form("imgurl"))
if linkname="" then
response.Write("alert('网站名称不能为空!');history.back()")
response.End()
end if
if linkurl="" then
response.Write("alert('网站地址不能为空!');history.back()")
response.End()
end if
if imgurl="" then
response.Write("alert('网站地址不能为空!');history.back()")
response.End()
end if
dim id
id=checkStr(request.Form("id"))
if id"" then
call modify()
else
call add()
end if
sub add()
conn.execute("insert into img (webname,imgurl,weburl) values('"&linkname&"','"&imgurl&"','"&linkurl&"')")
conn.close
set conn=nothing
response.Write("alert('添加成功!');location='img.asp'")
end sub
sub modify()
dim rs,lmufso,webid
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from img where id="&id,conn,1,3
if rs.bof or rs.eof then
response.Write("alert('参数错误!');history.back()")
response.End()
end if
'if imgurl"" then
'Set lmufso = Server.CreateObject("Scripting.FileSystemObject")
'if lmufso.fileExists(Server.MapPath(rs("imgurl"))) then
'lmufso.DeleteFile(Server.MapPath(rs("imgurl")))
'end if
'end if
rs("webname")=linkname
rs("weburl")=linkurl
rs("imgurl")=linkurl
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.Write("alert('修改成功!');location='img.asp'")
end sub
%>