⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addlink.asp

📁 是一个关于小学信息化教育的平台,提供了学校论坛,和聊天室功能!
💻 ASP
字号:
<!--#include file="../../include/db.asp"-->
<!--#include file="../../include/admin_check.asp"-->
<!--#include file="power.asp"-->
<%
Dim InsertSql,imagespath
imagepath ="/images/links/"
Set conn = OpenOrGet_Database("sql_conn")
set ff=Server.CreateObject("LyfUpload.UploadFile")
ff.maxsize=200000
path=server.mappath("/images/links/")

linkname = ff.request("link_name")
linkhref = ff.request("link_href")
linktarget = ff.request("link_target")
If ff.request("act") = "mo" Then
		Id = ff.request("id")
		If ff.request("isimage") = "1" Then
		'response.end
		call UploadFile("U")
		Else
		Conn.Execute "Update friendlink set linkname = '" & linkname & "',linkhref = '" & linkhref & "',linktarget = '" & linktarget & "' where id = '" & id & "'"
		End If
		call goback("修改成功!","window.location='edit_link.asp'")
Else
		If ff.request("isimage") = "1" Then
		'上传图片
		call UploadFile("I")
		Else
			Conn.Execute "Insert Into friendlink (linkname,linkhref,linktarget) Values ('"&linkname&"','"&linkhref&"','"&linktarget&"')"
		End IF
'添加成功,返回
call goback("添加成功!","window.location='edit_link.asp'")
End If


Sub UploadFile(SqlType)
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") 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 文件!')","")
			response.end
		end if
		imagelink = imagepath&ss
		Dim SqlStr
		If SqlType = "U" Then
		SqlStr = "Update friendlink set linkname = '" & linkname & "',linkhref = '" & linkhref & "',linktarget = '" & linktarget & "',linkimage = '" & imagelink & "' where id = '" & id & "'"
		Else
		SqlStr = "Insert Into friendlink (linkname,linkhref,linktarget,linkimage) Values ('"&linkname&"','"&linkhref&"','"&linktarget&"','"&imagelink&"')"
		End If
		Conn.Execute (SqlStr)
		'response.write SqlStr
		'response.end
Else
	call goback("请选择需要上传的图片文件!","")
End if
End Sub

function Deal(initstring)
	tempstring=replace(initstring,chr(39),"’")
	tempstring=Replace(tempstring,"<","&lt;")
	tempstring=Replace(tempstring,">","&gt;")
	tempstring=replace(tempstring,chr(34),"“")
	tempstring=replace(tempstring,chr(32),"&nbsp;")	
	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 + -