|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
专业性的服务。有的ASP商提供垂直型的应用服务,针对某一特定行业提供应用服务。虚拟主机
创立虚拟主机大体牵扯到用户、站点、目次、FTP、DNS等几项内容,另外,能够还有EMAIL。QWEB组件对此做了较周全的封装,需求的可以和qaymuic@163.com接洽。
以下是创立一个虚拟主机的代码:
config.xml(设置装备摆设信息)
<Root_Element>
<admin>Administrator</admin>
<adminpass>xxxxxx</adminpass>
<readuser>IUSR_MACHINE</readuser>
<domain>cocoo.net</domain>
<dnsadmin>dnsadmin</dnsadmin>
<dnsadminpass>yyyyy</dnsadminpass>
<dnsip>10.1.143.227</dnsip>
<group>tryit</group>
<webdir>http://hanhong.cocoo.net</webdir>
</Root_Element>
global.asa(设置装备摆设文件)
<SCRIPT LANGUAGE=vbscript RUNAT=Server>
Sub Application_OnStart
set ff=server.createobject("microsoft.xmldom")
ff.async=false
ff.load server.mappath("config.xml")
set rootElem = ff.documentElement
for e1=0 to rootElem.childNodes.length-1
application(trim(rootElem.childNodes.item(e1).nodeName))=trim(rootElem.childNodes.item(e1).text)
next
End Sub
</script>
index.asp(请求页面)
<%
user=trim(request("user"))
pass=trim(request("pass"))
email=trim(request("email"))
if user<>"" then
if pass="" or instr(email,"@")<2 then
response.write "<font color='red'>填写毛病</font>"
else
SET GG=SERVER.CREATEOBJECT("QWEB.USER")
gg.logon application("admin") & "@" & application("domain"),application("adminpass")
SET RR=GG.CREATE(user,application("group"))
if gg.iserr then
response.write "<font color='red'>不克不及创立用户:" & gg.errstring & "</font>"
else
gg.value("pwdLastSet",rr)=-1
gg.changepassword "", pass,rr
response.write gg.errstring
gg.value("accountdisabled",rr)=TRUE
gg.value("accountexpirationdate",rr)=now()+2
gg.value("description",rr)=session.SessionID
SET FF=CreateObject("QWEB.dns")
domainn=right(email,len(email)-instr(email,"@"))
SET cc=CREATEOBJECT("qmail.newmail")
cc.sender="AA收集<anyone@anyone.net>"
cc.receiver=email
cc.sendashtml=true
cc.subject="注册确认"
cc.body="<a href='" & application("webdir") & "/active.asp?user=" & user & "&id=" & session.SessionID & "&pass=" & pass & "'>感谢您的注册,请在24小时内(" & (now()+1) & ")激活您的帐户。</a>"
vv=ff.mxrecord(application("dnsip"),domainn)
HH=SPLIT(VV," ")
FOR G=0 TO UBOUND(HH)
cc.smtpsvr=hh(g)
cc.send
if cc.errcode=true then exit for
next
if cc.errcode=false then
gg.delete rr
response.write "<font color='red'>没法发送注册信息</font>"
else
response.write "<font color='red'>注册胜利,请24小时外调看邮件,激活帐户.</font>"
response.end
end if
set cc=nothing
set ff=nothing
end if
set gg=nothing
end if
end if
%>
<h1 align="center">收费空间请求</h1>
<form name="form1" method="post" action="<% =request.ServerVariables("SCRIPT_NAME") %>">
<p>用户名:
<input type="text" name="user">
</p>
<p>密 码:
<input type="password" name="pass">
</p>
<p>电子邮件:
<input type="text" name="email">
</p>
<p>
<input type="submit" name="Submit" value="如今请求">
</p>
</form>
<p align="center"> </p>
active.asp(确认页面,创立站点、守旧FTP、EMAIL、设置装备摆设DNS记载)
<%
user=request("user")
id=request("id")
SET UU=SERVER.CREATEOBJECT("QWEB.MEMBER")
SET GG=SERVER.CREATEOBJECT("QWEB.USER")
SET z1=SERVER.CreateObject("QWEB.DIR")
set bb=server.createobject("MDUsercom.MDUser")
Set mUserInfo =server.createobject("MDUsercom.MDUserInfo")
set ff=createobject("qweb.dns&q</p> ASP在国内异常流行,因为国内大多使用的是盗版的Windows和盗版的SQLServer,而ASP+COM+SQLServer实际上也是一种不错的搭配,其性能也不输于PHP+MYSQL,特别是Windows系统和SQLServer都有图形界面,比APACHE和MYSQL易于维护,因此对于不重视知识产权的国家来说也是一种不错的选择。 |
|