<!--#include file="conn.asp"-->
<%
'如果用户网站目录不存在，则要创建
strUserName=Session("UserName")
Set fs = Server.CreateObject( Const_ScriptFileSystem )
UserFolderName = "home/" & strUserName

if not fs.FolderExists(Server.MapPath(UserFolderName)) then
	strPageLoad="onload=""window.open('AppSetting.asp?f=1&c=1&js=1&cp=1');window.focus();"""		
end if
%>

<%
	if GetVariable("action")="save" then
		'从数据库读取用户网站的脚注
		strSQL="Select w_FootNote,w_Title From website Where m_id=" & Trim(Session("UserID"))
		rSub.open strSQL,conn,1,1
		OldFootNote=trim(rSub("w_FootNote"))
		OldTitle="<title>" & trim(rSub("w_Title")) & "</title>"
		rSub.close
																
		strFootNote="公司地址：" & GetFormVariable("ComAdrr") & "<br>" & "电话：" & GetFormVariable("ComPhote") & " E-Mail:" & GetFormVariable("ComMail") & "<br>" & "Copyright&copy;" & year(date) & "-" & (year(date)+1) & " " & GetFormVariable("ComName") & " All Rights Reserved."
		strTitle="<title>" & GetFormVariable("SiteTitle") & "</title>"
		Session("WebTitle")=GetFormVariable("SiteTitle")
		
		'应用新的设置到文件
		Set UserFolder=fs.GetFolder(Server.MapPath( "home/" & strUserName))
		For Each objTextFile In UserFolder.Files
			if Right(objTextFile.Name,4)=".htm" Or Right(objTextFile.Name,4)=".asp" then
				strTextFileSrc=objTextFile.Path
				'执行替换
				set objTextOldFile=fs.OpenTextFile(strTextFileSrc,1)
				strHTMLText=objTextOldFile.ReadAll
				objTextOldFile.close
				
				'替换网站脚注
				strHTMLText= Replace(strHTMLText, OldFootNote, strFootNote)
				'替换网站标题
				strHTMLText= Replace(strHTMLText, OldTitle, strTitle)

				set objTextNewFile=fs.OpenTextFile(strTextFileSrc,2)
				objTextNewFile.WriteLine strHTMLText
				objTextNewFile.close
																				
			end if
		next
		Set fs=nothing
		
		strSQL="Update website Set "
		strSQL=strSQL & "w_ComName='" & GetFormVariable("ComName") & "', "
		strSQL=strSQL & "w_Title='" & GetFormVariable("SiteTitle") & "', "
		strSQL=strSQL & "w_Mail='" & GetFormVariable("ComMail") & "', "
		strSQL=strSQL & "w_Address='" & GetFormVariable("ComAdrr") & "', "
		strSQL=strSQL & "w_zip='" & GetFormVariable("ComPCode") & "', "
		strSQL=strSQL & "w_tel='" & GetFormVariable("ComPhote") & "', "
		strSQL=strSQL & "w_fax='" & GetFormVariable("ComFax") & "', "
		strSQL=strSQL & "w_ComType='" & GetFormVariable("hangye") & "', "
		strSQL=strSQL & "w_province=" & GetFormVariable("province") & ", "
		strSQL=strSQL & "w_FootNote='" & strFootNote & "'  Where m_id=" & trim(Session("UserID"))
		'response.Write(strSQL)
		conn.execute strSQL,0,1
	end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>电子商务自助建站--您理想的助手</title>
<link href="common/styleMain.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="common/JS_CheckForm.js"></script>
<script language="JavaScript">
//检查数据有效性
function checkform(theform){
	if(!CheckEmpty(theform.ComName, "单位名称")) return false;
	if(!CheckEmpty(theform.SiteTitle, "网站标题")) return false;
	if(!CheckEmpty(theform.ComAdrr, "联系地址")) return false;
	if(!CheckEmail(theform.ComMail)) return false;
	if(!CheckEmpty(theform.ComPhote, "联系电话")) return false;
	if(!CheckEmpty(theform.hangye, "网站所属行业")) return false;

	//不能大于指定长度
	if(!CheckMaxLength(theform.ComName, 50, "单位名称")) return false;
	if(!CheckMaxLength(theform.SiteTitle, 100, "网站标题")) return false;
	if(!CheckMaxLength(theform.ComAdrr, 200, "联系地址")) return false;
	if(!CheckMaxLength(theform.ComPhote, 50, "联系电话")) return false;
	if(!CheckMustLength(theform.ComPCode, 6, "邮编")) return false;

}
</script>
</head>
<body leftmargin="0" topmargin="0" <%=strPageLoad%>>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="0" align="center">
		  <!--#include file="common/top.asp"-->
          </td>
        </tr>
        <tr> 
          <td height="100%" align="center" valign="top">
<TABLE class=table002 cellSpacing=0 cellPadding=0 border=0>
              <TBODY>
                <TR> 
                  <!--左边开始-->
                  <TD vAlign=top align=right width="20%">
					  <!--#include file="common/left.asp"-->
				  </TD>
                  <!--左边结束-->
                  <TD width="2%" background="images/rowline.gif">&nbsp;</TD>
                  <!--右边开始-->
                  <TD vAlign=top align=middle width="78%">
<%
	strSQL="Select * From v_website Where m_id=" & trim(Session("UserID"))
	set rs=Server.CreateObject("ADODB.RecordSet")
	rs.open strSQL,conn,1,1
%>
				  <form name="form1" method="post" action="?action=save" onSubmit="return checkform(this)">
                      <TABLE width="100%" height="100%" border=0 cellPadding=6 cellSpacing=0>
                        <TBODY>
                          <TR> 
                            <TD vAlign=top align=left bgColor=#ffffff><B>网站基本信息设置</B><BR> 
                              <HR SIZE=1> 
                              <table width="100%" border="1" cellpadding="1" cellspacing="1" bgcolor="#bad2f0">
                                <tr> 
                                  <td bgcolor="#5f8ac5"><font color="#FFFFFF">□ 
                                    网站基本信息</font></td>
                                </tr>
                                <tr> 
                                  <td valign="top" bgcolor="#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="2">
                                      <tr> 
                                        <td bgcolor="#f1f1f1">单位名称：</td>
                                      </tr>
                                      <tr> 
                                        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr> 
                                              <td width="13%" align="right">&nbsp;</td>
                                              <td width="90%" height="30"> <INPUT name=ComName value="<%=trim(rs("w_ComName"))%>" size=35 maxLength=50> <font color="#FF0000">＊</font> 
                                                <SPAN 
                              class=gray>≤ 50个字符</SPAN> </td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                      <tr> 
                                        <td bgcolor="#f1f1f1">网站标题：</td>
                                      </tr>
                                      <tr> 
                                        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr> 
                                              <td width="13%" align="right">&nbsp;</td>
                                              <td width="90%" height="30"> <INPUT name=SiteTitle id="SiteTitle" value="<%=trim(rs("w_Title"))%>" 
                              size=35 maxLength=50> <SPAN 
                              class=gray><font color="#FF0000">＊</font>≤ 100个字符</SPAN> 
                                              </td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                      <tr> 
                                        <td bgcolor="#f1f1f1">联系方式：</td>
                                      </tr>
                                      <tr> 
                                        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr> 
                                              <td align="right">邮件：</td>
                                              <td height="30"> <INPUT name=ComMail id="ComMail" value="<%=trim(rs("w_Mail"))%>" size=35 maxLength=50> 
                                                <font color="#FF0000">＊</font> 
                                                <span 
                              class=gray>≤ 50个字符</span> </td>
                                            </tr>
                                            <tr> 
                                              <td width="13%" align="right">地址：</td>
                                              <td width="90%" height="30"> <INPUT name=ComAdrr id="ComAdrr" value="<%=trim(rs("w_Address"))%>" 
                              size=35 maxLength=100> <font color="#FF0000">＊</font> 
                                                <SPAN 
                              class=gray>≤ 200个字符</SPAN> </td>
                                            </tr>
                                            <tr> 
                                              <td align="right">邮编： </td>
                                              <td height="30"> <INPUT name=ComPCode id="ComPCode" value="<%=trim(rs("w_zip"))%>" 
                              size=35 maxLength=6> <font color="#FF0000">＊</font> 
                                              </td>
                                            </tr>
                                            <tr> 
                                              <td width="13%" align="right">电话：</td>
                                              <td height="30"> <INPUT name=ComPhote id="ComPhote" value="<%=trim(rs("w_tel"))%>" 
                              size=35 maxLength=50> <font color="#FF0000">＊</font> 
                                                <SPAN 
                              class=gray>≤ 50个字符，多个电话可以写用空格隔开</SPAN></td>
                                            </tr>
                                            <tr> 
                                              <td width="13%" align="right">传真：</td>
                                              <td height="30"> <INPUT name=ComFax id="ComFax" value="<%=trim(rs("w_fax"))%>" 
                              size=35 maxLength=50> <SPAN 
                              class=gray>≤ 50个字符，多个传真可以写用空格隔开</SPAN></td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                      <tr> 
                                        <td bgcolor="#f1f1f1">所属地区：</td>
                                      </tr>
                                      <tr> 
                                        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr> 
                                              <td width="13%" align="right">&nbsp;</td>
                                              <td width="90%" height="30"> <SPAN 
                              class=gray> 
                                                <select name="province" Style="width:148">
                                                  <option value="<%=trim(rs("w_province"))%>"><%=trim(rs("province"))%></option> 
												  <%
												  set Subrs=server.CreateObject("ADODB.RecordSet")
												  Subrs.open "Select * From province",conn,1,1
												  for i=1 to Subrs.recordcount
												  	response.Write("<option value=" & trim(Subrs("id")) + ">" & trim(Subrs("province")) & "</option>" )
													Subrs.movenext
												  next
												  Subrs.close
												  %>
												</select>
                                                <font color="#FF0000">＊</font> 
                                                </SPAN></td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                      <tr> 
                                        <td bgcolor="#f1f1f1">网站所属行业：</td>
                                      </tr>
                                      <tr> 
                                        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr> 
                                              <td width="13%" align="right">&nbsp;</td>
                                              <td width="90%" height="30"> <SPAN  class=gray> 
                                                <SELECT name=hangye>
                                                  <OPTION value="" selected>请选择</OPTION>
                                                  <OPTION 
                                value="工业设备">工业设备</OPTION>
                                                  <OPTION 
                                value="化工及日用化学品">化工及日用化学品</OPTION>
                                                  <OPTION 
                                value="广告、策划">广告、策划</OPTION>
                                                  <OPTION 
                                value="公用服务事业">公用服务事业</OPTION>
                                                  <OPTION 
                                value="党政机关行业">党政机关行业</OPTION>
                                                  <OPTION 
                                value="通讯产品">通讯产品</OPTION>
                                                  <OPTION 
                                value="中介、人才交流">中介、人才交流</OPTION>
                                                  <OPTION 
                                value="化妆与养护">化妆与养护</OPTION>
                                                  <OPTION 
                                value="家具、木材">家具、木材</OPTION>
                                                  <OPTION 
                                value="环保行业">环保行业</OPTION>
                                                  <OPTION 
                                value="保险、福利">保险、福利</OPTION>
                                                  <OPTION 
                                value="摄影摄像用品">摄影摄像用品</OPTION>
                                                  <OPTION 
                                value="律师事务所、信息咨询">律师事务所、信息咨询</OPTION>
                                                  <OPTION 
                                value="贸易与代理">贸易与代理</OPTION>
                                                  <OPTION 
                                value="医药保健">医药保健</OPTION>
                                                  <OPTION 
                                value="建筑与装饰">建筑与装饰</OPTION>
                                                  <OPTION 
                                value="房地产">房地产</OPTION>
                                                  <OPTION 
                                value="电脑、软件、网络">电脑、软件、网络</OPTION>
                                                  <OPTION 
                                value="食品与饮料">食品与饮料</OPTION>
                                                  <OPTION 
                                value="农、林、牧、副、渔">农、林、牧、副、渔</OPTION>
                                                  <OPTION 
                                value="能源行业">能源行业</OPTION>
                                                  <OPTION 
                                value="艺术、工艺、收藏品">艺术、工艺、收藏品</OPTION>
                                                  <OPTION 
                                value="玩具和宠物">玩具和宠物</OPTION>
                                                  <OPTION 
                                value="办公用品">办公用品</OPTION>
                                                  <OPTION 
                                value="包装、印刷">包装、印刷</OPTION>
                                                  <OPTION 
                                value="教育、就业、移民">教育、就业、移民</OPTION>
                                                  <OPTION 
                                value="商展、会议">商展、会议</OPTION>
                                                  <OPTION 
                                value="安全、保安设备">安全、保安设备</OPTION>
                                                  <OPTION 
                                value="冶金矿产">冶金矿产</OPTION>
                                                  <OPTION 
                                value="体育用品与运动服饰">体育用品与运动服饰</OPTION>
                                                  <OPTION 
                                value="儿童、妇女用品">儿童、妇女用品</OPTION>
                                                  <OPTION 
                                value="家用电器">家用电器</OPTION>
                                                  <OPTION 
                                value="模具、模料">模具、模料</OPTION>
                                                  <OPTION 
                                value="家居用品、日常用品">家居用品、日常用品</OPTION>
                                                  <OPTION 
                                value="玻璃陶瓷">玻璃陶瓷</OPTION>
                                                  <OPTION 
                                value="电子产品">电子产品</OPTION>
                                                  <OPTION 
                                value="邮政、电信">邮政、电信</OPTION>
                                                  <OPTION 
                                value="服装、纺织、皮革">服装、纺织、皮革</OPTION>
                                                  <OPTION 
                                value="城市建设事业">城市建设事业</OPTION>
                                                  <OPTION 
                                value="科技开发">科技开发</OPTION>
                                                  <OPTION 
                                value="其他行业">其他行业</OPTION>
                                                </SELECT>
                                                <font color="#FF0000">＊</font> 
                                                </SPAN></td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                      <tr> 
                                        <td height="40" align="center"> 
                                          <INPUT type=submit value=" 保存设置 " name=Submit>
                                          <INPUT type=reset value=" 取消 " name=Submit>
                                          <INPUT type=button value=" 上一步 " name=Submit2 onClick="location='Admin_Language.asp'"> 
                                          <INPUT type=button value=" 下一步 " name=Submit22 onClick="location='Admin_Templet.asp'"> 
                                        </td>
                                      </tr>
                                    </table></td>
                                </tr>
                              </table></TD>
                          </TR>
                        </TBODY>
                      </TABLE>
                    </form></TD>
                </TR>
              </TBODY>
            </TABLE></td>
        </tr>
        <tr> 
          <td height="0" align="center">
		  <!--#include file="common/bottom.asp"-->
		  </td>
        </tr>
      </table></td>
  </tr>
</table>
<script language="JavaScript">
	SelectValue(document.form1.province,"<%=trim(rs("w_province"))%>");
	SelectValue(document.form1.hangye,"<%=trim(rs("w_ComType"))%>");
</script>
<%
'如果是选择了新模板，则重新生成网站
if GetQueryString("action")="createsite" then
	response.Write("<iframe src='update.asp' width='0' height='0' frameborder='0'></iframe>")
end if
%>
</body>
</html>
