<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <% response.charset="gb2312" conn.open constr productid=trim(Requesta("productid")) freeid=requesta("freeid") isfree=getFreedatebase(freeid,f_freeproid,f_content) if isfree then productid=f_freeproid module=trim(requesta("module")) isAgent=false newisMysql=false ischecked="" if isnumeric(session("u_levelid")) and session("u_levelid")>1 then isAgent=true SELECT CASE module CASE "checkftpname"'检查ftp用户名 call checkftpname() CASE "addshopcart" '购买/下订单 call buyhost() END SELECT tpl.set_unknowns "remove" call setHeaderAndfooter() call setwebhostingLeft() sql="select top 1 * from productlist where p_type=1 and p_proid='"& productID &"' and iif(isNull(p_proid),0,1)<>0" rs.open sql,conn,1,1 if rs.eof and rs.bof then rs.close:conn.close:errpage "抱歉,该产品不存在" productName=rs("p_name") p_size=rs("p_size") p_iis=rs("p_maxmen") p_traffic=rs("p_traffic") p_test=rs("p_test") p_picture = rs("p_picture") if p_test="" or isnull(p_test) then p_test=1 if rs("p_server")=10 or rs("p_server")=14 or instr(productName,"mysql")>0 then newisMysql=true if isSmaller(session("user_name")) and instr(productName,"集群")>0 then url_return "抱歉,个人用户不能购买集群主机产品,请购买我司其他产品,谢谢!",-1 rs.close Sql="Select productlist.p_size as pf_size,productlist.p_maxmen as pf_user from productlist,protofree where productlist.p_proID=protofree.freeproid and protofree.proid='" & productid & "'" Set MailRs=conn.Execute(Sql) p_MailSize=0 p_MailUser=0 if not MailRs.eof then p_MailSize=MailRs("pf_size"):p_MailUser=MailRs("pf_user") MailRs.close Set MailRs=nothing '''''''''''''''''''模板''''''''''''''''''''''''''''''''' tpl.set_file "main", USEtemplate&"/services/webhosting/buy.html" tpl.set_var "ismysql",newisMysql,false tpl.set_var "productname",productName,false tpl.set_var "productid",productid,false tpl.set_var "freeid",freeid,false tpl.set_var "p_mailsize",p_MailSize,false tpl.set_var "setroomlist","
"&xltinxing()&"
"&setRoom(productid),false tpl.set_var "agentJscript",agentjsscriptstr,false tpl.set_var "p_size",p_size,false tpl.set_var "buyHostpriceList",buyHostpriceList,false tpl.set_var "isdisabled",isdisabledStr(newisMysql,buyischecked),false tpl.set_var "ischecked",buyischecked,false tpl.set_var "isTestDisabled",isTestDisabled(p_test),false tpl.set_var "alertmessage",isdishost(productid),false if isNumeric(demoprice) then tpl.set_var "demoprice",demoprice,false end if call setagentbuytable(isagent) tpl.parse "mains","main",false tpl.p "mains" set tpl=nothing function isdishost(proid) if lcase(left(proid,1))<>"c" then isdishost="提示:目前国内主机均须办理备案,一般需要20至30天的时间,大部分省份要求邮寄网站备案核验单原件,急需开通网站或觉得备案麻烦的客户推荐购买港台主机,即买即用。优惠活动:国内空间免费赠送一个月使用时间,赠送域名URL转发服务和二级域名。" else isdishost="郑重提示:为了保证集集群主机的服务品质,我司集群主机仅允许企业用户购买,个人用户请购买我司其他产品。集群主机在绑定域名时会做验证,必须是在我司备案系统备案成功,且主办单位性质为企业的才允许绑定域名。禁止外挂、私服游戏等易受攻击的网站购买,否则永久关闭不予退款。" end if end function function isTestDisabled(byVal myp_test) if isfree or instr(api_autoopen,"vhost")<=0 then isTestDisabled=" disabled " elseif instr(productName,"集群")>0 then isTestDisabled=" disabled " else if myp_test=0 then isTestDisabled=" " else isTestDisabled=" disabled " end if end if end function function isdisabledStr(byval newisMysql,byref buyischecked) if instr(api_autoopen,"vhost")<=0 then isdisabledStr=" checked " buyischecked= " disabled " else if isfree then isdisabledStr=" disabled " buyischecked=" checked " else if newisMysql then isdisabledStr=" disabled " buyischecked=" checked " else isdisabledStr=" checked " buyischecked="" end if end if end if end function sub setagentbuytable(byval isagent) if isagent then tpl.set_file "agentbuytable",USEtemplate&"/config/webhostingLeft/agentbuytable.html" tpl.parse "#agentbuytable.html","agentbuytable",false end if end sub function agentjsscriptstr() jsStr = "if(document.form1.appEmail.value!=''){" & vbcrlf & _ "if(!isEmail(document.form1.appEmail.value)){" & vbcrlf & _ "alert ('\n\n联系用户的邮箱格式错误!');" & vbcrlf & _ "document.form1.appEmail.focus();"& vbcrlf & _ "return false;}}" & vbcrlf & _ "if(document.form1.appTel.value!=''){" & vbcrlf & _ "if(!isMobile(document.form1.appTel.value)){" & vbcrlf & _ "alert ('\n\n联系用户的手机号码格式错误!');" & vbcrlf & _ "document.form1.appTel.focus();" & vbcrlf & _ "return false;}}" & vbcrlf & _ agentjsscriptstr=jsStr end function function buyHostpriceList() if isfree then hostpricelist= "" else selstr = getpricelist(session("user_name"),productid) if selstr<>"" then strArray=split(selstr,"|") if ubound(strArray)>=10 then oneyearsprice=strArray(0) hostpricelist ="" if trim(session("user_name"))&""="" then hostpricelist = hostpricelist & "您没有登陆,按直接客户身份计算价格" end if end if end if buyHostpriceList=hostpricelist end function sub checkftpname() ftpname=trim(requesta("ftpname")) if not checkhostnameIn(ftpname,errstr2) then response.write toerrStr(errstr2) response.write "" else response.write torightStr("恭喜,此ftp可以注册") response.write "" end if response.end end sub sub buyhost() newisMysql=false vyears=trim(Requesta("years")) ftpaccount=Lcase(trim(Requesta("ftpaccount"))) ftppassword=trim(Requesta("ftppassword")) ftppassword1=trim(Requesta("ftppassword1")) domainnametop=trim(Requesta("domainnametop")) domainname=trim(Requesta("domainname")) pmver=trim(Requesta("pmver")) paytype=Requesta("paytype") room=requesta("room") newisMysql=Requesta("ismysql") domainall=domainnametop & "." & domainname if isBad(ftpaccount,ftppassword,binfo) then url_return "FTP密码很重要,您输入的密码过于简单,请重新设置。",-1 if checkPassStrw(ftppassword) then url_return "密码中含有不可识别的字符,请重新设置。",-1 cdntype=requesta("cdntype") if cdntype="" then url_return "请选择您的网站类型",-1 end if 'if not checkRegExp(ftppassword,"^[\w]{5,20}$") then url_return "密码应为字母数字或_组成,长度在5-20位之间",-1 '===================联系方式================== dllstr="" if isAgent then s_appName=trim(requesta("appName")) s_appAdd=trim(requesta("appAdd")) s_appTel=trim(requesta("appTel")) s_appEmail=trim(requesta("appEmail")) dllstr="settouch:" & s_appName & "|" & s_appAdd & "|" &s_appTel & "|" & s_appEmail & vbcrlf end if call needregSession() if not ischeckhost(ftpaccount,productid,vyears,paytype,errstr,p_name,p_maxmen,p_size,cdntype) then url_return errstr,-1 itemPrice=GetNeedPrice(session("user_name"),productid,1,"new") if paytype=2 then if isfree then url_return "赠品不能够下订单",-1 Sql="Select MAX(id) as OrderID from PreHost" Rs.open Sql,conn,1,1 if not isNumeric(Rs("OrderID")) then OrderID=1 else OrderID=Rs("OrderID")+1 end if Rs.close Sql="Insert into PreHost (OrderNo,U_name,ftpAccount,ftpPassword,domains,years,proid,price,opened,sDate,s_appName,s_appAdd,s_appTel,s_appEmail,pmver,room) values ('" & OrderID &"','"& Session("user_name") & "','"& ftpaccount & "','" & ftppassword &"','" & domainall &"'," & vyears & ",'" & productid & "'," & itemPrice & ",0,now,'" & s_appName & "','" & s_appAdd & "','" & s_appTel & "','" & s_appEmail & "','" & pmver & "','"& room &"')" conn.Execute Sql conn.close Response.redirect "/bagshow/orderlist.asp?orderid="& server.urlEncode(OrderID) & "&productType=host" response.end else if paytype="1" then domainall="" if isInbagshow(ftpaccount,"vhost") then url_return "此ftp名已在购物车中存在,请在购物车中删除",-1 strContents = strContents & "vhost" & vbCrLf strContents = strContents & "add" & vbCrLf strContents = strContents & "entityname:vhost" & vbCrLf strContents = strContents & "producttype:" & productid & vbCrLf strContents = strContents & "years:" & vyears & vbCrLf strContents = strContents & "ftpuser:" & ftpaccount & vbCrLf strContents = strContents & "ftppassword:" & ftppassword & vbCrLf strContents = strContents & "cdntype:" & cdntype & vbCrLf strContents = strContents & "paytype:" & paytype & vbCrLf strContents = strContents & "domain:" & domainall & vbCrLf strContents = strContents & "room:" & room & vbCrLf''''''''''机房 strContents = strContents & "pmver:" & pmver & vbCrLf''''''''''机房 strContents = strContents & dllstr''''''''''''''代理的最终用户联系方式 strContents = strContents & "userip:" & GetuserIp() & vbcrlf '用户客户端IP strContents = strContents & "productnametemp:" & p_name & vbCrLf strContents = strContents & f_content strContents = strContents & "." & vbCrLf session("order") = strContents & session("order") Response.redirect "/bagshow/" end if end sub function ischeckhost(byval webname,byval productid,byval vyear,byval buytest,byref errstr,byref p_name,byref p_maxmen,byref p_size,byval cdntype) errstr="" ischeckhost=false if trim(productid)&""="" or len(productid)>10 or trim(productid)="b000" then errstr="产品型号错误":exit function if not isnumeric(vyear) then errstr="年限错误":exit function if vyear>10 or vyear<1 then errstr="年限应是1-10年之间":exit function if not checkhostnameIn(webname,hosterrstr) then errstr=hosterrstr:exit function if lcase(productid)="auto000" then if vyears<>1 then errstr="体验主机只能购买一年":exit function if session("u_levelid")=1 then errstr="您的身份是直接客户,不能购买体验主机!":exit function set ed_rs=conn.execute("select * from vhhostlist where s_ProductId='Auto000' and S_ownerid="&session("u_sysid")) if not ed_rs.eof then errstr = "您已经购买了一个体验主机!":set ed_rs=nothing:exit function end if if buytest=1 and trim(session("u_sysid"))&""<>"" then Audsql="select top 1 u_Auditing from userDetail where u_id="& session("u_sysid") set Audrs=conn.execute(Audsql) if not Audrs.eof then if trim(AudRs(0))="1" then errstr="您需要通过管理员审核后才能开通试用主机!" Audrs.close exit function end if end if Audrs.close if session("u_levelid")=1 then setcountline=4 else setcountline=20 end if sql="select count(*) as fdsfs from vhhostlist where S_ownerid="& session("u_sysid") &" and s_buytest=1" set testCountRS=conn.execute(sql) if testCountRS(0)>=setcountline then errstr="对不起 ,您最多只能申请"& setcountline &"个试用主机!" testCountRS.close exit function end if testCountRS.close end if psql="select top 1 * from productlist where p_type=1 and P_proId='"& productid &"'" set prs=conn.execute(psql) if not prs.eof then p_name=prs("p_name") p_maxmen=prs("p_maxmen") p_size=prs("p_size") p_test=prs("p_test")'是否试用 0试用 if p_test<>0 and buytest=1 then errstr="此类型主机不允许试用" elseif (cdntype=2 or cdntype=3) and instr(p_name,"集群")>0 then errstr="集群主机仅限企业网站购买,请购买我司其他产品" else ischeckhost=true end if else errStr="没有此主机类型" end if prs.close set prs=nothing end function function checkhostnameIn(ftpname,byref errstr) checkhostnameIn=false errstr="" hostcheckstr="mysql,root,mssql,sqlserver,sa,domainname,dnsresolve,system,administrator,pcj,fancy,TsInternetUser,service,network,replicator,client,guests,batch,dialup,interactive,everyone" if not checkRegExp(ftpname,"^(([a-zA-Z\-\_\.]+\w*)|(\w*[a-zA-Z\-\_\.]+))$") then errstr="ftp名格式错误":exit function if len(ftpname)<5 then errstr="ftp名不能小于5位":exit function if instr(","& lcase(hostcheckstr) &",",","& lcase(ftpname) &",")>0 then errstr="ftp名有禁用关键字":exit function Xcmd="other" & vbcrlf Xcmd=Xcmd & "get" & vbcrlf Xcmd=Xcmd & "entityname:vhostexists" & vbcrlf Xcmd=Xcmd & "sitename:" & ftpname & vbcrlf & "." & vbcrlf chk_userstr=Session("user_name") if len(Session("user_name"))<=0 then chk_userstr="AgentUserVCP" loadRet=Pcommand(Xcmd,chk_userstr) if success(loadRet) then Xstatus=getReturn(loadRet,"status") if Xstatus="yes" then errstr="此ftp名已经存在" exit function end if end if sqls="select s_sysid from vhhostlist where s_comment='"& ftpname &"'" set rszxw=conn.execute(sqls) if not rszxw.eof then errstr="此ftp名已经存在" else checkhostnameIn=true end if rszxw.close set rszxw=nothing end function function GetuserIp() dim realip,proxy realip = Request.ServerVariables("HTTP_X_FORWARDED_FOR") proxy = Request.ServerVariables("REMOTE_ADDR") if realip = "" then GetuserIp = proxy else GetuserIp = realip end if end function function xltinxing() thisuserip=GetuserIp() ipaddresstype=getIpAddressType(thisuserip,getIpAddressMsg) titlestr="提示:您的IP("& thisuserip &")来自 "& getIpAddressMsg if instr(productName,"多线")>0 or instr(productName,"双线")>0 then if ipaddresstype="网通" or ipaddresstype="联通" then otherstr=",建议选择"&chgroomName("郑州机房") else otherstr=",建议选择"&chgroomName("西部数码数据中心机房") end if else if instr(productName,"港台")=0 and instr(productName,"集群")=0 and instr(productName,"美国")=0 then if ipaddresstype="网通" or ipaddresstype="联通" then otherstr=",建议选择"&chgroomName("中国网通机房") else otherstr=",建议选择"&chgroomName("中国电信机房") end if end if end if xltinxing=titlestr & otherstr end function %>