📄 add_banner2.asp
字号:
<!--#include file="../../include/db.asp"-->
<!--#include file="../../include/admin_check.asp"-->
<!--#include file="power.asp"-->
<%
Dim InsertSql,imagespath
imagepath ="/images/banner/"
Set conn = OpenOrGet_Database("sql_conn")
set ff=Server.CreateObject("LyfUpload.UploadFile")
ff.maxsize=200000
path=server.mappath("/images/banner/")
ban_name = deal(ff.request("link_name"))
ban_href = deal(ff.request("link_href"))
ban_target = ff.request("link_target")
If ff.request("act") = "mo" Then
ban_width = ff.request("ban_width")
ban_height= ff.request("ban_height")
Id = ff.request("id")
call UploadFile("U")
call goback("修改成功!","window.location='Show_banner.asp'")
Else
ban_width = ff.request("ban_width")
ban_height= ff.request("ban_height")
'上传图片
call UploadFile("I")
'添加成功,返回
call goback("添加成功!","window.location='Show_banner.asp'")
End If
Sub UploadFile(SqlType)
If SqlType = "U" Then
Conn.Execute "Update banner set ban_name = '" & ban_name & "',ban_href = '" & ban_href & "',ban_target = '" & ban_target & "',ban_width = '" & ban_width & "',ban_height = '" & ban_height & "' where id = '" & id & "'"
Else
if not dealname(ff.Request("link_image"))="" then
if instr(lcase(ff.Request("link_image")),".gif") or instr(lcase(ff.Request("link_image")),".jpg") or instr(lcase(ff.Request("link_image")),".bmp") or instr(lcase(ff.Request("link_image")),".swf") then
ss=ff.SaveFile("link_image",path,false)
if ss= "0" then
call goback("图片1:文件尺寸不应超过200K,请选择文件后重新上传","")
response.end
end if
if ss= "3" then
call goback("图片1:服务器上已经有同名的文件,请选择文件后重新上传","")
response.end
end if
if ss = "" then
call goback("图片1:文件上传失败!')","")
response.end
end if
else
call goback("图片1:文件必须为.bmp 文件或.jpg 文件或.gif 文件或 .swf文件!","")
response.end
end if
imagelink = imagepath&ss
Dim SqlStr
SqlStr = "Insert Into banner (ban_name,ban_href,ban_target,ban_src,ban_width,ban_height,ban_use) Values ('"&linkname&"','"&linkhref&"','"&linktarget&"','"&imagelink&"','" & ban_width & "','" & ban_height & "','0')"
Conn.Execute (SqlStr)
Else
call goback("请选择需要上传的图像文件!","")
End if
End If
End Sub
function Deal(initstring)
tempstring=replace(initstring,chr(39),"’")
tempstring=Replace(tempstring,"<","<")
tempstring=Replace(tempstring,">",">")
tempstring=replace(tempstring,chr(34),"“")
tempstring=replace(tempstring,chr(32)," ")
deal=(tempstring)
end function
function Dealname(mystring)
arrName=split(Cstr(mystring),chr(34))
Dealname=arrName(1)
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -