<!--#include file="include.asp"-->
<%Action=Request.QueryString("act")
SelectedTheme=Request.QueryString("theme")
Dim PassWord,Domain,UserName
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>申请帐号</title>
<link href="../../Images/style.css" rel="stylesheet" type="text/css">
<link href="Images/new.css" rel="stylesheet" type="text/css">
 </head>

<body> 

<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  <tr>
    <td class="bg_tr">您现在的位置：在线插件样式 &gt;&gt; 申请帐号</td>
  </tr>
  <tr>
    <td>
	
	
	 
 <div class="md-head" >
<div class="zsj"></div>
<a href="fy.Theme.ACTList.asp" class="a10 wrap"  >在线安装主题</a>
<a href="fy.Theme.Reg.asp" class="a10 wrap cur wid"  >我的帐号</a>
<a href="Index.asp" class="a10 wrap"  >主题管理</a>
<a href="fy.Theme.Check.asp" class="a10 wrap">查看插件的可用更新</a>
 <div>
 
</td>
  </tr>
</table>
  <%


If Action="save" Then
 	 echo "<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""table""> <tr><td class=""bg_tr"">注册</td></tr><tr><td   colspan=""2"" >"
	Dim Pack_Error,PageContent,apply
	Pack_Error=0
	UserName=fycms.s("UserName")
	PassWord=fycms.s("PassWord")
	Domain=fycms.s("Domain")
	apply=fycms.s("apply")
 	If UserName=""  Or PassWord="" Or Domain="" Then
		Pack_Error= "<font color=""red"">  请填写内容.</font>"
  	Else
 		Dim ZipPathFile
		If apply="1" Then 
			PageContent=getHTTPPage(Theme_URL&"reg.asp?RegU="&UserName&"&RegP="&PassWord)
 		If InStr(PageContent,"@") > 0 Then
				Dim ThemeArr
				ThemeArr = Split(PageContent, "@")
				UserName=ThemeArr(0)
				PassWord=ThemeArr(1)
 			Else 
				echo "<script>alert('申请帐号失败!错误代码：" &PageContent &"');history.back();</script>"
				response.end
			End If 
 		End If 
 	ZipPathFile = Tpath & fycms.admindir() & "\Sys_fy\Config\" & "plustheme.xml"
	Call 	CreateXml(Domain,UserName,PassWord,ZipPathFile)
	End If

	If Pack_Error = "0" Then
 		Call fycms.ActErr("帐号保存完成","Sys_fy/plugin/fy.Theme.reg.asp?theme="& Server.URLEncode(SelectedTheme) &"","")
 	Else
  		Call fycms.ActErr("帐号保存失败"&Pack_Error,"","1")
 	End If
End If
If Action="" Then
	Call EditXMLPackInfo()
End If

%>
 </td>
  </tr>
   </table>
</body>
</html>
<%
 Sub EditXMLPackInfo()
'On Error Resume Next
 	Dim fso,strXmlFile
	Set fso = CreateObject(fycms.FsoName)
 		strXmlFile =Tpath & fycms.admindir() & "\Sys_fy\Config\" & "plustheme.xml"
		If fso.FileExists(strXmlFile) Then
    		Set XML=fycms.NoAppGetXMLFromFile(strXmlFile)
			If IsObject(XML) And XML.readyState=4 And XML.parseError.errorCode = 0 Then
 					UserName=GetNode("UserName"):Domain=GetNode("Domain"):PassWord=GetNode("PassWord")
 					Set XML=Nothing
			End If
		Else 
			Domain=fycms.acturl
 		End If
	Set fso = nothing
	Err.Clear
 %>
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  <form method="post" action="fy.Theme.Reg.asp?act=save&theme=<%=SelectedTheme%>">
 

 
    
    <tr>
      <td height="25" align="right">域名&nbsp;&nbsp;</td>
      <td height="25"><input  class="Ainput"   name="Domain" type="text" size="50" value="<%=Domain%>" />
 </td>
    </tr>

	<tr>
      <td height="25" align="right">用户名&nbsp;&nbsp;</td>
      <td height="25"><input  class="Ainput"   name="UserName" type="text" size="50" value="<%=UserName%>" />
       </td>
    </tr>
     
    <tr>
      <td height="25" align="right">密码&nbsp;&nbsp;</td>
      <td height="25"><input  class="Ainput"   name="PassWord" type="text" size="50" value="<%=PassWord%>" />密码是MD5加密
     </td>
    </tr>
     
     
 
    <tr>
      <td height="25" align="right">申请帐号&nbsp;&nbsp;</td>
      <td height="25"><label for="regs"><input type="checkbox" id="regs" name="apply" value="1"/> 
		<font color="red">* 如果你是第一次申请请选择</font></label>
     </td>
    </tr>
     

   
  
 
 <tr>
      <td   colspan="2"  align="center">
      <input type="submit" class="btn btn_primary"  name=Submit1 value="  完成编辑并保存信息  " />
    </td>
    </tr>
 
 
  </table>	
</form>	
<%	 

End Sub


'创建一个空的XML文件，为写入文件作准备
Sub CreateXml(ThemeDomain,ThemeUserName,ThemePassWord,FilePath)
'On Error Resume Next
 	Dim XmlDoc,Root,xRoot
	Set XmlDoc = Server.CreateObject("Microsoft.XMLDOM")
		XmlDoc.async = False
		XmlDoc.ValidateOnParse=False
		Set Root = XmlDoc.createProcessingInstruction("xml","version='1.0' encoding='utf-8' standalone='yes'")
		XmlDoc.appendChild(Root)
		Set xRoot = XmlDoc.appendChild(XmlDoc.CreateElement("theme"))
		Set xRoot = Nothing
 		Dim Domains,UserNames,PassWords
 		Set Domains = XmlDoc.SelectSingleNode("//theme").AppendChild(XmlDoc.CreateElement("Domain"))
			Domains.Text = ThemeDomain
		Set Domains=Nothing

		Set UserNames = XmlDoc.SelectSingleNode("//theme").AppendChild(XmlDoc.CreateElement("UserName"))
			UserNames.Text = ThemeUserName
		Set UserNames=Nothing
 
		Set PassWords = XmlDoc.SelectSingleNode("//theme").AppendChild(XmlDoc.CreateElement("PassWord"))
			PassWords.Text = ThemePassWord
		Set PassWords=Nothing
   		XmlDoc.Save(FilePath)
		Set Root = Nothing
	Set XmlDoc = Nothing

 End Sub

 
%>