📄 createmail.asp
字号:
<% ModuleCode="M0910" %>
<!--#include file="../../../Include/Reference.asp"-->
<%
Call PrintPageHead
%>
<!--#include file="../../../Include/connect.asp"-->
<!--#include file="../../../Include/GetSysParam.asp"-->
<!--#include file="../../../Include/WEBCtrl.asp"-->
<!--#include file="../../../Include/SendMail.asp"-->
<%
UserID=session("UserID")
IP=Request.ServerVariables("REMOTE_ADDR")
ProdCode=Request.Form("ProdCode")
MailDomain=Request.Form("maildomain")
MailPassword=Request.Form("mailpassword")
ProdYear=Request.Form("ProdYear")
BuyYear=Request.Form("BuyYear")
if BuyYear=0 or BuyYear="" or (not IsNumeric(BuyYear)) then
Response.Write "<br><br><br><p align='center' class='titletext'>请输入购买的年限!"
Call PrintPageBottom
Response.End
end if
HowLong=Cint(BuyYear)*Cint(ProdYear)
BeginDate=Now()
EndDate=DateAdd("yyyy",HowLong,BeginDate)
strBeginDate=FormatDate(BeginDate)
strEndDate=FormatDate(EndDate)
Set Rs = Server.CreateObject("ADODB.Recordset")
strSQL="Select UserName,EMail,HaveMoney+OverMoney as HaveMoney, LevelCode from T_DNS_UserInfo Where UserID=" & UserID
Rs.open strSQL,Cn
if Rs.eof then
Rs.Close
Response.Write "<br><br><br><p align='center' class='titletext'>用户错误,无法购买!"
Call PrintPageBottom
Response.End
else
UserLevel=Rs("LevelCode")
HaveMoney=CCur(Rs("HaveMoney"))
UserName=Rs("UserName")
EMail=Rs("EMail")
end if
Rs.Close
strSQL="Select ProdPrice from T_DNS_ProdPrice Where ProdCode='" & ProdCode & "' and LevelCode='" & UserLevel & "' and ProdYear='" & ProdYear & "'"
Rs.open strSQL,Cn
if Rs.eof then
Rs.Close
Response.Write "<br><br><br><p align='center' class='titletext'>错误,无法购买!"
Call PrintPageBottom
Response.End
else
ProdPrice=Rs("ProdPrice")
HowMuch=CInt(HowLong)*CCur(ProdPrice)
end if
Rs.Close
Set Rs=Nothing
if HaveMoney<HowMuch then
Response.Write "<br><br><br><p align='center' class='titletext'>对不起,您的帐户余额不足,请先给您的帐户充值!"
Call PrintPageBottom
Response.End
end if
strSQL="exec SP_CreateMail " & +_
"'" & Session("UserID") & "'," & +_
"'" & "查询" & "'," & +_
"'" & Request.ServerVariables("REMOTE_ADDR") & "'," & +_
"'" & ProdCode & "'"
Set Rs= Cn.Execute(strSQL)
%>
<p align="center" class="titletext">
<%
if Rs("result")<>"0" then
Response.Write Rs("msg")
Rs.Close
Call PrintPageBottom
Response.End
end if
ServerCode=Rs("ServerCode")
ServerIP=Rs("ServerIP")
MailSize=Rs("MailSize")
MailUser=Rs("MailUser")
MailSiteNum=Rs("SiteNum")
BPCode=Rs("BPCode")
ProdName=Rs("ProdName")
ServerPubIP=Rs("ServerPubIP")
Rs.Close
strSQL="Select * from T_DNS_AllPost where BPostDN='" & MailDomain & "'"
Rs.open strSQL,Cn
if not Rs.eof then
Rs.Close
Response.Write "此邮局域名重复了,请重新输入邮局域名!"
Call PrintPageBottom
Response.End
end if
Rs.Close
MailDomainList=GetMailDomainList(ServerIP)
if InStr(MailDomainList,MailDomain)>0 then
Response.Write "此虚拟主机名重复了,请重新输入邮局域名!"
Call PrintPageBottom
Response.End
end if
if CreateMailDomain(ServerIP,MailDomain)<>0 then
Response.Write "建立邮局失败, 请重新尝试! 错误码: 1"
Call PrintPageBottom
Response.End
end if
if CreateMailUser(ServerIP,MailDomain,Opt_System_MailManager,MailPassword,"0")<>0 then
Response.Write "建立邮局失败, 请重新尝试! 错误码: 2"
Call PrintPageBottom
Response.End
end if
if ChangeMailDomainProp(ServerIP,MailDomain,Opt_System_MailManager & "@" & MailDomain, MailUser, CStr(Cint(MailSize)*1000))<>0 then
Response.Write "建立邮局失败, 请重新尝试! 错误码: 3"
Call PrintPageBottom
Response.End
end if
if AddIISSiteBindings(ServerIP,MailSiteNum,":80:mail." & MailDomain) then
Response.Write "建立邮局失败, 请重新尝试! 错误码: 4"
Call PrintPageBottom
Response.End
end if
strSQL="exec SP_BuyMail " & +_
"'" & Session("UserID") & "'," & +_
"'" & ProdCode & "'," & +_
"'" & MailDomain & "'," & +_
"" & ProdYear & "," & +_
"" & BuyYear & "," & +_
"'" & IP & "'"
Set sRs= Cn.Execute(strSQL)
if sRs("result")<>"1" then
Response.Write sRs("msg")
Call PrintPageBottom
Response.End
else
UOID=sRs("msg")
end if
sRs.Close
Set sRs=Nothing
Set RsNo= Cn.Execute("SP_PublicNObyRs 'P1140'")
PostID=RsNo("Result")
RsNo.Close
Set RsNo=Nothing
strSQL="Insert into T_DNS_AllPost (PostID,UOID,BPCode,STime,UYear,ETime,UserName,PSW,ServerCode,BPostDN,MaxSize,MaxUser,FeeStat,PostStat,UserID,Stat,IfSubmit) values('" & +_
PostID & "','" & UOID & "','" & BPCode & "',getdate()," & HowLong & ",'" & strEndDate & "','" & Opt_System_MailManager & +_
"','" & MailPassword & "','" & ServerCode & "','" & MailDomain & "'," & MailSize & "," & MailUser & ",'1','1','" & UserID & "','1','0')"
Cn.Execute(StrSQL)
strSQL="Update T_DNS_ServerInfo Set RealSize=RealSize+" & MailSize & ",RealUser=RealUser+" & MailUser & " Where ServerCode='" & ServerCode & "'"
Cn.Execute(StrSQL)
Subject="开通专业邮局成功! --" & Opt_System_CompanyName
MailFile = "../../../Include/MailTemplate/openmail.txt"
Send_Email Email,Subject,MailFile,"$产品名$",ProdName,"$服务器IP$",ServerPubIP,"$绑定域名$",MailDomain,"$年限$",CStr(HowLong),"$密码$",MailPassword,"$用户名$",Opt_System_MailManager & "@" & MailDomain,"$开通日期$",strBeginDate,"$到期日期$",strEndDate,"$注册人$",UserName,"","","","","",""
%>
<form name="form1" method="post" action="CreateMail2.asp">
<input type="hidden" name="ID" value="<%=PostID%>">
<font color=red>您已经完成支付,并购买专业邮局成功! <br>为保证系统正确建立邮局信息,请点击下面按钮再次确认!</font><br>
<input type="submit" name="Submit" value="再次确认邮局购买信息" class="button">
</form>
<br>已经提交购买的邮局信息:
<%
strSQL="Select * from v_MailList Where Stat<>'0' and PostID='" & PostID & "'"
Set Rs= Server.CreateObject("ADODB.Recordset")
Rs.open strSQL,Cn
If Rs.Eof Then
Response.Write "<br><br><P align='center' class='titletext'>对不起, 找不到此邮局,可能注册不成功,请与管理员联系!</p>"
else
'Dim MaxUser,UserNum,MaxSize,UsedSize,GiveSize
if GetDomainInfo(Rs("ServerIP"),Rs("BPostDN"), MaxUser,UserNum,MaxSize,GiveSize,UsedSize)<>0 then
Response.Write "<br><br><P align='center' class='titletext'>对不起, 服务器已经断开, 请重新尝试!!</p>"
Call PrintPageBottom
Response.End
end if
if (not IsNumeric(MaxUser)) or (not IsNumeric(UserNum)) or (not IsNumeric(MaxSize)) or (not IsNumeric(GiveSize)) or (not IsNumeric(UsedSize)) then
Response.Write "<br><br><P align='center' class='titletext'>对不起, 服务器已经断开, 请重新尝试!!</p>"
Call PrintPageBottom
Response.End
end if
%>
<!------------------------------------------------------------------------------------->
<TABLE align=center bgcolor="<%=Opt_Table_BGColor%>" border=0 cellPadding=5 cellSpacing=1 width="95%">
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">邮局绑定域名</td>
<td><%=Rs("BPostDN")%>
</td>
</tr>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">产品名称</td>
<td><%=Rs("MailType")%></td>
</tr>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">服务器</td>
<td><%=Rs("ServerPubIP")%></td>
</tr>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">邮局空间大小</td>
<td><%=Rs("MaxSize")%>M</td>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">已分配空间</td>
<td>
<table border=0 cellPadding=0 cellSpacing=0 width="100%">
<tr>
<td colspan="2">
<%
if Clng(Rs("MaxSize"))=0 then
Per=0
else
Per=Cint((Clng(GiveSize)/1000)/Clng(Rs("MaxSize"))*100)
end if
%>
<table style="BORDER-RIGHT: <%=Opt_TR_BGColor%> 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: <%=Opt_TR_BGColor%> 1px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 1px; BORDER-LEFT: <%=Opt_TR_BGColor%> 1px solid; PADDING-TOP: 1px; BORDER-BOTTOM: <%=Opt_TR_BGColor%> 1px solid" cellspacing=0 cellpadding=0 width="100%" border=0 bgcolor="<%=Opt_Table_BGColor%>">
<tbody>
<tr>
<td width="100%">
<div style="FONT-SIZE: 3px; WIDTH: <%=Per%>%; HEIGHT: 6px; BACKGROUND-COLOR: <%=Opt_TR_BGColor%>"></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<%=Cstr(Clng(GiveSize)\1000)%>M
</td>
<td align="right">
<%=Per%>%
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">已使用空间</td>
<td>
<table border=0 cellPadding=0 cellSpacing=0 width="100%">
<tr>
<td colspan="2">
<%
if Clng(Rs("MaxSize"))=0 then
Per=0
else
Per=Cint((Clng(UsedSize)/1000/1000)/Clng(Rs("MaxSize"))*100)
end if
%>
<table style="BORDER-RIGHT: <%=Opt_TR_BGColor%> 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: <%=Opt_TR_BGColor%> 1px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 1px; BORDER-LEFT: <%=Opt_TR_BGColor%> 1px solid; PADDING-TOP: 1px; BORDER-BOTTOM: <%=Opt_TR_BGColor%> 1px solid" cellspacing=0 cellpadding=0 width="100%" border=0 bgcolor="<%=Opt_Table_BGColor%>">
<tbody>
<tr>
<td width="100%">
<div style="FONT-SIZE: 3px; WIDTH: <%=Per%>%; HEIGHT: 6px; BACKGROUND-COLOR: <%=Opt_TR_BGColor%>"></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<%=FormatNumber(Clng(UsedSize)/1000,2,,,-1)%>K
</td>
<td align="right">
<%=Per%>%
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">邮局邮箱个数</td>
<td>
<table border=0 cellPadding=0 cellSpacing=0 width="100%">
<tr>
<td colspan="2">
<%
if Clng(Rs("MaxUser"))=0 then
Per=0
else
Per=Cint(Clng(UserNum)/Clng(Rs("MaxUser"))*100)
end if
%>
<table style="BORDER-RIGHT: <%=Opt_TR_BGColor%> 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: <%=Opt_TR_BGColor%> 1px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 1px; BORDER-LEFT: <%=Opt_TR_BGColor%> 1px solid; PADDING-TOP: 1px; BORDER-BOTTOM: <%=Opt_TR_BGColor%> 1px solid" cellspacing=0 cellpadding=0 width="100%" border=0 bgcolor="<%=Opt_Table_BGColor%>">
<tbody>
<tr>
<td width="100%">
<div style="FONT-SIZE: 3px; WIDTH: <%=Per%>%; HEIGHT: 6px; BACKGROUND-COLOR: <%=Opt_TR_BGColor%>"></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<%=Rs("MaxUser")%>个邮箱 (已分配 <%=UserNum%> 个)
</td>
<td align="right">
<%=Per%>%
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">开通时间</td>
<td><%=Rs("STime")%></td>
</tr>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">到期时间</td>
<td><%=FormatDateTime(Rs("ETime"),vbShortDate)%></td>
</tr>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">租用年限</td>
<td><%=Rs("UYear")%>年</td>
</tr>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">运行状况</td>
<td>
<%
Select Case Rs("PostStat")
Case "1"
%>
开通
<%
Case "2"
%>
关闭
<%
End Select
%>
</td>
</tr>
<tr bgcolor="<%=Opt_TD_BGColor2%>">
<td width="20%" bgcolor="<%=Opt_TR_BGColor%>" align="right">缴费情况</td>
<td>
<%
Select Case Rs("FeeStat")
Case "1"
Response.Write "正常"
Case "2"
Response.Write "未缴"
End Select
%>
</td>
</tr>
</table>
<%
end if
Rs.Close
Set Rs=Nothing
Call PrintPageBottom
Cn.Close
%>
<%
Function FormatDate(iDate)
FormatDate=DatePart("yyyy",iDate) & "-" & DatePart("m",iDate) & "-" & DatePart("d",iDate)
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -