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

📄 const.asp

📁 功能: 创建站点/删除站点/修改站点/修改密码/创建池/修改池/删除池 环境要求: IIS6.0 + MsFTP有+ NTFS
💻 ASP
字号:
<%
' 系统管理员帐号
const master="admin"

' 数据库
const dbfile="data.mdb"
	
' 被控访问IP	
const myiis_ip="127.0.0.1"
	
' 组件类型
const myiis_obj="Microsoft.XMLHTTP"
		
' 序列号
const myiis_key=""
	
' 被控访问端口
const myiis_port="8080"
	
' 被控访问密码
const myiis_pass="123456"
	
dim conn,myiis

call initialize()

' 初始化
function initialize()
	on error resume next
	set conn = server.createobject("adodb.connection")
	conn.open "Provider=Microsoft.Jet.OLEdb.4.0;Data Source=" & server.mappath(dbfile)
	if err then response.write "无法链接数据库<br />" & err.description & "" : response.end
	set myiis = server.createobject("myiis.control")
	if err then response.write "无法创建MyIIS对象<br />" & err.description & "" : response.end
	myiis.ip=myiis_ip
	myiis.obj=myiis_obj
	myiis.key=myii_key
	myiis.port=myiis_port
	myiis.pass=myiis_pass
end function

' 注销
function terminate()
	on error resume next
	conn.close
	set conn=nothing
	set myiis=nothing
	if err then err.clear
end function

' 创建网站
function createsite(byval vuser,byval vpass,byval vsize,byval vpath,byval vdom,byval vmap,byval vapp,byval vdoc,byval vband,byval viis)
	myiis.action="createsite"
	myiis.item "user",vuser
	myiis.item "pass",vpass
	myiis.item "size",vsize
	myiis.item "path",vpath
	myiis.item "dom",vdom
	myiis.item "map",vmap
	myiis.item "app",vapp
	myiis.item "doc",vdoc
	myiis.item "band",vband
	myiis.item "iis",viis
	createsite=myiis.send
	createsite=int(createsite)
	if createsite=0 then
		createsite=false
	else
		conn.execute "insert into `site` (`id`,`user`,`pass`,`size`,`path`,`dom`,`map`,`app`,`doc`,`band`,`iis`,`used`) values ('"&createsite&"','"&vuser&"','"&vpass&"','"&vsize&"','"&vpath&"','"&vdom&"','"&vmap&"','"&vapp&"','"&vdoc&"','"&vband&"','"&viis&"','0')"
		conn.execute "update `app` set `sitecount`=`sitecount`+1 where `app`='"&vapp&"'"
		createsite=true
	end if
end function

' 删除网站
function deletesite(byval vid)
	myiis.action="deletesite"
	myiis.item "id",vid
	deletesite=myiis.send
	if deletesite then conn.execute "delete from `site` where `id`='"&vid&"'"
end function

' 修改密码
function modifypass(byval vid,byval vnew)
	dim ts,vold
	set ts=conn.execute("select `pass` from `site` where `id`='"&vid&"'")
	if ts.eof then modifypass=false : exit function
	vold=ts(0) : ts.close
	myiis.action="modifypass"
	myiis.item "id",vid
	myiis.item "old",vold
	myiis.item "new",vnew
	modifypass=myiis.send
	if modifypass then conn.execute "update `site` set `pass`='"&vnew&"' where `id`='"&vid&"'"
end function

' 修改属性
function modifysite(byval vid,byval vattr,byval vval)
	myiis.action="modifysite"
	myiis.item "id",vid
	myiis.item "attr",vattr
	myiis.item "val",vval
	modifysite=myiis.send
	if modifysite then conn.execute "update `site` set `"&vattr&"`='"&vval&"' where `id`='"&vid&"'"
end function

' 获取已用空间
function getsitesize(byval vid)
	myiis.action="getsitesize"
	myiis.item "id",vid
	getsitesize=myiis.send
	getsitesize=int(getsitesize)
	if getsitesize>=0 then
		conn.execute "update `site` set `used`='"&getsitesize&"' where `id`='"&vid&"'"
		getsitesize=true
	else
		getsitesize=false
	end if
end function

' 创建程序池
function createapp(byval vapp,byval vcpu,byval vmemory)
	myiis.action="createapp"
	myiis.item "app",vapp
	myiis.item "cpu",vcpu
	myiis.item "memory",vmemory
	createapp=myiis.send
	if createapp then conn.execute "insert into `app` (`app`,`cpu`,`memory`) values ('"&vapp&"','"&vcpu&"','"&vmemory&"')"
end function

' 删除程序池
function deleteapp(byval vapp)
	myiis.action="deleteapp"
	myiis.item "app",vapp
	deleteapp=myiis.send
	if deleteapp then conn.execute "delete from `app` where `app`='"&vapp&"'"
end function

' 修改程序池
function modifyapp(byval vapp,byval vcpu,byval vmemory)
	myiis.action="modifyapp"
	myiis.item "app",vapp
	myiis.item "cpu",vcpu
	myiis.item "memory",vmemory
	modifyapp=myiis.send
	if modifyapp then conn.execute "update `app` set `cpu`='"&vcpu&"',`memory`='"&vmemory&"' where `app`='"&vapp&"'"
end function

' 回收程序池
function recycleapp(byval vapp)
	myiis.action="recycleapp"
	myiis.item "app",vapp
	recycleapp=myiis.send
end function

' 通信测试
function hello()
	myiis.action="hello"
	hello=myiis.send
end function

' 重启服务器
function reboot()
	myiis.action="reboot"
	reboot=myiis.send
end function

' 重新IIS
function iisreset()
	myiis.action="iisreset"
	iisreset=myiis.send
end function


function getinput(byval frmtitle,byval frmhelp,byval frmname,byval frmvalue,byval frmwidth,byval frmattr)
	if isnull(frmvalue) then frmvalue="" else frmvalue=server.htmlencode(frmvalue)
	if len(frmwidth) = 0 or not isnumeric(frmwidth) then frmwidth = 200
	if len(frmtitle)>0 then  getinput="<label>" & frmtitle & "<span id=""help_" & frmname & """>" & frmhelp & "</span></label>"
	getinput=getinput&"<input type=""text"" name=""" & frmname & """ id=""" & frmname & """ class=""input"" style=""width:" & frmwidth & "px;"" value=""" & frmvalue & """ " & frmattr & " />"
	if len(frmvalues) > 0 then
		getinput = getinput & "<span class=""values"" id=""values_"&frmname&""">"
		dim i,val0,val1
		frmvalues = split(frmvalues,";")
		for i = 0 to ubound(frmvalues)
			if instr(frmvalues(i),":") = 0 then
				val0 = frmvalues(i) : val1 = val0
			else
				val0 = split(frmvalues(i),":")(0) : val1 = split(frmvalues(i),":")(1)
			end if
			val1 = replace(replace(val1,"'",""),"""","")
			getinput = getinput & "<a href=""javascript:;"" onclick=""$('" & frmname & "').value='" & val1 & "';"">[" & val0 & "]</a>"
		next
		getinput = getinput & "</span>"
	end if	
	response.write getinput	
end function

function getselect(byval frmtitle,byval frmhelp,byval frmname,byval frmvalue,byval frmvalues,byval frmwidth)
	if isnull(frmvalue) then frmvalue = ""
	if len(frmwidth) = 0 or not isnumeric(frmwidth) then frmwidth = ""
	if len(frmtitle)>0 then getselect="<label>" & frmtitle & "<span id=""help_" & frmname & """>" & frmhelp & "</span></label>"
	getselect=getselect&"<select name=""" & frmname & """ id=""" & frmname & """ style=""width:" & frmwidth & "px;"" class=""select"">"
	if len(frmvalues) > 0 then
		dim i,val0,val1
		frmvalues = split(frmvalues,";")
		for i = 0 to ubound(frmvalues)
			if instr(frmvalues(i),":") = 0 then
				val0 = frmvalues(i) : val1 = val0
			else
				val0 = split(frmvalues(i),":")(0) : val1 = split(frmvalues(i),":")(1)
			end if
			val1 = replace(replace(val1,"'",""),"""","")
			if cstr(val1) = cstr(frmvalue) then
				getselect = getselect & "<option value=""" & val1 & """ selected>" & val0 & "</option>"
			else
				getselect = getselect & "<option value=""" & val1 & """>" & val0 & "</option>"
			end if
		next
	else
		getselect = getselect & "<option value=""" & frmvalue & """>" & frmvalue & "</option>"
	end if
	getselect = getselect & "</select>"	
	response.write getselect
end function
%>

⌨️ 快捷键说明

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