<%@ Language=VBScript %>
<%
Function CLen(HzStr)
L = len(HzStr)
For n=1 to L
If Asc(mid( HzStr,n,1))<0 Then HzNum = HzNum + 1
Next
Clen = L + HzNum
End Function

If session("HOSTAUBAIID")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf Request.form("id")="" Then
	ef=True
	ec="请输入产品ID！"
ElseIf request.form("subtype")="" And (request.form("zbdwzjtype"&request.form("unit_code"))="" Or request.form("zbdwzjtype"&request.form("unit_code"))="0") Then
	ef=True
	ec="主办单位证件类型必须选择！"
ElseIf Request.form("mobile")="" And Request.form("mobileuni")="" And request.form("subtype")=""  Then
	ef=True
	ec="移动或联通的手机号必须输入一个！"
ElseIf Instr(1, Request.form("id"), "'", 1)>0 then
	ef=True
	ec="非法产品ID！"
ElseIf not IsNumeric(Request.form("id"))  Then
	ef=True
	ec="产品ID应该是数字！"
elseif clen(request.form("principal"))>49 then
	ef=True
	ec="内容超长了:"&request.form("principal")
elseif clen(request.form("work_phone"))>49 then
	ef=True
	ec="内容超长了:"&request.form("work_phone")
ElseIf Request.form("subtype")<>"保   存" And Request.form("work_phone")<>"" And InStr(Request.form("work_phone"),"86-0")<1 then
	ef=True
	ec="办公电话格式不正确！"
ElseIf Request.form("mobileton")<>"" And InStr(Request.form("mobileton"),"86-0")<1 Then
	ef=True
	ec="小灵通格式不正确！"
end if

'response.write InStr(Request.form("mobileton"),"86-0")<1
'response.End

if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where id='"&Request.form("id")&"'"
			if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsph.Open Sql,conn,1,3
if dsph.Eof then
	ef=True
	ec="不存在的虚拟主机ID！"
end if
end if

if not ef then
if dsph("allowsubbyid")<> session("HOSTAUBAIID") and dsph("id")<> session("HOSTAUBAIID") then
	ef=True
	ec="这个虚拟主机不是您名下的！"
end if
end if

if not ef then
if dsph("beianstatus")="已提交工信部" then
	ef=True
	ec="处于已提交工信部状态不能修改！"
elseif dsph("beianstatus")="管理员已审核" then
	ef=True
	ec="处于管理员已审核状态不能修改！"
elseif dsph("beianstatus")="备案成功" then
	ef=True
	ec="处于备案成功状态不能修改！"
end if
end if

if not ef then
dsph("unit")=request.form("unit")
dsph("unit_code")=request.form("unit_code")
dsph("unit_id")=request.form("unit_id")
dsph("investor")=request.form("investor")
dsph("province_code")=request.form("province_code")
dsph("city_code")=request.form("city_code")
dsph("county_code")=request.form("county_code")
dsph("address")=request.form("address")
dsph("principal")=request.form("principal")
dsph("principal_id_type")=request.form("principal_id_type")
dsph("principal_id_num")=request.form("principal_id_num")
dsph("work_phone")=request.form("work_phone")
dsph("mobile")=request.form("mobile")
dsph("email")=request.form("email")
dsph("web_name")=request.form("web_name")
dsph("web_index")=request.form("web_index")
dsph("web_domain")=request.form("web_domain")
dsph("web_ip")=request.form("web_ip")
dsph("working_type")=request.form("working_type")

dsph("zbdwzjtype")=request.form("zbdwzjtype"&request.form("unit_code"))
dsph("mobileuni")=request.form("mobileuni")
dsph("mobileton")=request.form("mobileton")

'dsph("beianstatus")=request.form("beianstatus")
if isnull(dsph("beianstatus")) Or dsph("beianstatus")="用户需补充数据" then
dsph("beianstatus")="用户已录入数据"
'else
'dsph("beianstatus")="用户已修改数据"
end If


dsph("ICP_SN")=request.form("ICP_SN")

if request.form("ICP_logname")<>"" then dsph("ICP_logname")=request.form("ICP_logname")
if request.form("ICP_logpass")<>"" then dsph("ICP_logpass")=request.form("ICP_logpass")

if request.form("subtype")<>"" then
dsph("subtype")=1
else
dsph("subtype")=0
end if

dsph.update
dsph.close
set dsph=nothing
%>
<!--#include virtual="/inc-freehost-function/template-hostadm-top.asp"-->
　网站备案

<br><br>
保存成功。
<br><br>
<!--#include virtual="/inc-freehost-function/template-hostadm-end.asp"-->
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
