addlink.asp

来自「小游戏网站演示www.4399.io 拥有4万条游戏数据」· ASP 代码 · 共 99 行

ASP
99
字号
<!--#include file="../conn.asp"-->
<!--#include file="../inc/const.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/classmenu.asp"-->
<%
'dim rs, sql, founderr,errmsg
dim islock,htmlcontent,listcontent
founderr = false

newasp.preventinfuse

newasp.loadtemplates 9999, 6, 0

htmlcontent = newasp.htmlcontent
htmlcontent = replace(htmlcontent,"{$installdir}", newasp.installdir)
htmlcontent = replace(htmlcontent, "{$channelid}", 0)
htmlcontent = replace(htmlcontent,"{$pagetitle}","申请友情连接")

islock = newasp.chknumeric(newasp.htmlsetting(3))   '设置申请连接默认状态。0=正常显示,1=锁定

htmlcontent = readclassmenu(htmlcontent)
htmlcontent = readclassmenubar(htmlcontent)
listcontent = newasp.cutfixcontent(htmlcontent, "<!--listbegin", "listend-->", 1)
htmlcontent = replace(htmlcontent, listcontent, newasp.htmlsetting(5))

if newasp.checkstr(lcase(request.form("action"))) = "save" then
	call friendlinksave
else
	if cint(newasp.stopapplylink) <> 0 then
		call outalertscript(newasp.htmlsetting(6))
	else
		response.write htmlcontent
	end if
end if

sub friendlinksave()
	call preventrefresh
	if cint(newasp.stopapplylink) <> 0 then
		call outalertscript(newasp.htmlsetting(6))
		founderr = true
	end if
	if trim(request.form("linkname")) = "" then
		errmsg = errmsg + "网站名称不能为空\n"
		founderr = true
	end if
	if trim(request.form("linkurl")) = "" then
		errmsg = errmsg + "网站url不能为空\n"
		founderr = true
	end if
	if trim(request.form("readme")) = "" then
		errmsg = errmsg + "网站简介不能为空\n"
		founderr = true
	end if
	if trim(request.form("password1")) = "" then
		errmsg = errmsg + "管理密码不能为空\n"
		founderr = true
	end if
	if trim(request.form("password2")) = "" then
		errmsg = errmsg + "确认管理密码不能为空\n"
		founderr = true
	end if
	if newasp.isvalidpassword(request("password2")) = false then
		errmsg = errmsg + "管理密码中含有非法字符\n"
		founderr = true
	end if
	if trim(request.form("password1")) <> trim(request.form("password2")) then
		errmsg = errmsg + "管理密码和确认密码不一至,请重新输入管理密码\n"
		founderr = true
	end if
	set rs = newasp.execute("select linkid from nc_link where linkname='" & newasp.checkbadstr(request.form("linkname")) & "' and linkurl='" & newasp.checkbadstr(request.form("linkurl")) & "'")
	if not (rs.eof and rs.bof) then
		errmsg = "您申请的友情连接已经存在!"
		founderr = true
	end if
	set rs = nothing
	if founderr = true then
		call outalertscript(errmsg)
		exit sub
	end if
	set rs = server.createobject("adodb.recordset")
	sql = "select * from nc_link where (linkid is null)"
	rs.open sql,conn,1,3
	rs.addnew
		rs("linkname") = newasp.formencode(request.form("linkname"),50)
		rs("linkurl") = newasp.formencode(request.form("linkurl"),200)
		rs("logourl") = newasp.formencode(request.form("logourl"),200)
		rs("readme") = newasp.formencode(request.form("readme"),200)
		rs("linktime") = now()
		rs("password") = md5(request.form("password2"))
		rs("linkhist") = 0
		rs("islogo") = newasp.chknumeric(request.form("islogo"))
		rs("isindex") = 0
		rs("islock") = islock
	rs.update
	rs.close:set rs = nothing
	call outputscript(newasp.htmlsetting(7),"index.asp")
end sub
closeconn
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?