<!--#include file="../conn.asp" -->
<%
if session("admin")="" then
Response.Write("<script language=JavaScript>alert('对不起,您没有权限使用该功能!!');history.back();</script>")
response.end
end if%>

<%
if request.QueryString("a")="edit" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from setting"
rs.open sql,conn,1,3
if not rs.eof or rs.bof then
rs("sitename")=request.form("sitename")
rs("isopen")=request.form("isopen")
rs("sitebg")=request.form("sitebg")
rs("sitemusic")=request.form("sitemusic")
rs("xinyan1")=request.form("xinyan1")
rs("xinyan2")=request.form("xinyan2")
rs("xinyan3")=request.form("xinyan3")
rs("xinyany")=request.form("xinyany")
rs("xinyandy")=request.form("xinyandy")
rs("isxinyan")=request.form("isxinyan")
rs("tongji")=request.form("tongji")
rs("sitegjc")=request.form("sitegjc")
rs("sitems")=request.form("sitems")
rs("siteurl")=request.form("siteurl")
rs("sitehtmldir")=request.form("sitehtmldir")
rs("siteishtml")=request.form("ishtml")
rs("diarydir")=request.form("diarydir")
rs("isset")=request.form("isset")
rs.update
If request.form("ishtml")="yes" Then
Call LjfMoveFile (diarydir&"Newbook.asp",diarydir&"/a/ab/Newbook.asp")
Call LjfMoveFile (diarydir&"BookOrder.asp",diarydir&"/a/ab/BookOrder.asp")
Call LjfMoveFile (diarydir&"goodList.asp",diarydir&"/a/ab/goodList.asp")
Call LjfMoveFile (diarydir&"NewList.asp",diarydir&"/a/ab/NewList.asp")
Else
Call LjfMoveFile (diarydir&"/a/ab/Newbook.asp",diarydir&"Newbook.asp")
Call LjfMoveFile (diarydir&"/a/ab/BookOrder.asp",diarydir&"BookOrder.asp")
Call LjfMoveFile (diarydir&"/a/ab/goodList.asp",diarydir&"goodList.asp")
Call LjfMoveFile (diarydir&"/a/ab/NewList.asp",diarydir&"NewList.asp")
End if
response.write("<script>alert('成功更新！');location.href='admin_index.asp';</script>")
end if
rs.close
set rs=nothing
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from setting"
rs.open sql,conn,1,1
%>
<html>
<script language="JavaScript">
function CheckForm()
{
    if (document.form1.sitename.value.length <2 || document.form1.sitename.value.length >30) {
    		alert("站点名称为二到二十位.");
		document.form1.sitename.focus();
		return false;
	}
	    if (document.form1.xinyan1.value.length <0 || document.form1.xinyan1.value.length >16) {
    		alert("页头宣言一为零到十六位.");
		document.form1.xinyan1.focus();
		return false;
	}
	
	    if (document.form1.xinyan2.value.length <0 || document.form1.xinyan2.value.length >16) {
    		alert("页头宣言二为零到十六位.");
		document.form1.xinyan2.focus();
		return false;
	}	
	    if (document.form1.xinyan3.value.length <0 || document.form1.xinyan3.value.length >16) {
    		alert("页尾宣言为零到十六位.");
		document.form1.xinyan3.focus();
		return false;
	}
	    if (document.form1.xinyany.value.length <4 || document.form1.xinyany.value.length >400) {
    		alert("站点右侧广告为四到四百位.");
		document.form1.xinyany.focus();
		return false;
	}
		    if (document.form1.xinyandy.value.length <20 || document.form1.xinyandy.value.length >100) {
    		alert("首页导语为二十到六十位.");
		document.form1.xinyandy.focus();
		return false;
	}
if(!isNaN(document.form1.sitemusic.value)){ 
    //alert("是数字和数点"); 
}else{ 
alert("调用音乐的用户ID必须为数字类型"); 
return false;
} 
	
return true;
}
</script>
<script language="JavaScript">
	function SwitchCoverbg(nCover,nBookID,sImageType)
	{
		if(nCover==-1)
		   //var bg="img/"+nBookID+"."+sImageType
		   //preview.src="img/"+nBookID+"."+sImageType
		   preview.src="diary/"+bg+""
		   //document.write("<BODY BACKGROUND="+"img/"+nBookID+"."+sImageType+">");
			   //document.body.style.backgroundImage=="url("+"img/"+nBookID+"."+sImageType+")" 
		else
			//preview.src=""+nCover+""
			document.body.style.backgroundImage="url(/"+nCover+")" 
	}
	</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 2</title>
<link href="images/style.css" rel="stylesheet" type="text/css">
</head>

<body style="background-image:url(<%=diarydir%><%=sitebg%>);OVERFLOW:hidden;OVERFLOW-X:HIDDEN;OVERFLOW-y:auto;background-color=transparent" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<div align="center">
<form name="form1" method="post" action="?a=edit"  onSubmit="return CheckForm()">
        
    <table width="100%" border="1" cellpadding="0" cellspacing="0"  bordercolor="#d7f5ff" bordercolordark="#FFFFFF" id="table1" bordercolorlight="#dddddd" bgcolor="#FFFFFF">
      <tr bgcolor="ecfbff"> 
        <td colspan="4" align="center" background="images/center_title_bg.jpg" height="34"> 
          <p align="center">系统设置·<%
		  if request("t")="1" Then response.write "网站主要设置"
		  if request("t")="2" Then response.write "网站辅助设置"
		  if request("t")="3" Then response.write "网站浏览设置"		  
		  %>
        </td>
      </tr>
	  <%
	  Select Case request("t")
	  Case "1"
	  div1="style='display:block'"
	  div2="style='display:none'"
	  div3="style='display:none'"
	  Case "2"
	  div1="style='display:none'"
	  div2="style='display:block'"
	  div3="style='display:none'"
	  Case "3"
	  div1="style='display:none'"
	  div2="style='display:none'"
	  div3="style='display:block'"
	  Case Else
	  div1="style='display:block'"
	  div2="style='display:block'"
	  div3="style='display:block'"	  
	  End select
	  %>
      <tr bgcolor="#FFFFFF" <%=div1%>> 
        <td align="center" nowrap width="100" height="80">站点名称:<br>
          (2-16个字符) </td>
        <td nowrap align="center" width="50%"> 
          <input type="text" name="sitename" style="width:99%;margin:5px;" value="<%=rs("sitename")%>">
        </td>
        <td align="center" nowrap width="100" height="50">站点目录:<br>
          (必须以/结尾) </td>
        <td nowrap align="center" width="50%"> 
          <input type="text" name="diarydir" style="width:99%;margin:5px;" disabled value="<%=rs("diarydir")%>">
        </td>
      </tr>
      <tr bgcolor="#FFFFFF" <%=div1%>> 
        <td align="center" nowrap width="100" height="80">站点域名:<br>
          (用户地址显示)<br>
          (最后不加/) </td>
        <td nowrap align="center" width="*"> 
          <input type="text" name="siteurl" style="width:99%;margin:5px;" value="<%=rs("siteurl")%>">
        </td>
        <td align="center" width="100">是否安装</td>
        <td align="left"> 
          <select name="isset" size="1" style="width:80px;margin-left:5px;" disabled>
            <option value="yes" <%if rs("isset")="yes" then response.write "selected"%>>已成功安装</option>
            <option value="no" <%if rs("isset")="no" then response.write "selected"%>>未成功安装</option>
          </select>
        </td>
      </tr>
      <tr bgcolor="#FFFFFF" <%=div1%>> 
        <td align="center" nowrap height="80">站点关键词:<br>
          (10-80个字符)</td>
        <td nowrap align="left"> 
          <textarea name="sitegjc" style="width:99%;margin:5px;" rows="3"><%=rs("sitegjc")%></textarea>
        </td>
        <td align="center">站点描述:<br>
          (10-160个字符)</td>
        <td align="left"> 
          <textarea name="sitems" style="width:99%;margin:5px;" rows="3"><%=rs("sitems")%></textarea>
        </td>
      </tr>
      <tr bgcolor="#FFFFFF" <%=div2%>> 
        <td align="center" width="100" height="50">开放注册</td>
        <td align="left"> 
          <select name="isopen" size="1" style="width:80px;margin-left:5px;">
            <option value="Open" <%if rs("isopen")="Open" then response.write "selected"%>>开放注册</option>
            <option value="False" <%if rs("isopen")="False" then response.write "selected"%>>关闭注册</option>
          </select>
          禁止注册新用户 </td>
        <td align="center">统计代码</td>
        <td align="center"> 
          <textarea name="tongji" style="width:99%;margin:5px;" rows="3"><%=rs("tongji")%></textarea>
        </td>
      </tr>
      <tr bgcolor="#FFFFFF" <%=div2%>> 
        <td align="center" nowrap height="50">站点背景:</td>
        <td nowrap align="left"> 
          <select name="sitebg" class="input" id="sitebg" style="width:60px" onChange="SwitchCoverbg(this.value,6913,'jpg')">
            <%				  
set rsbg=server.CreateObject("adodb.Recordset")
sql2="select * from diarymb order by diarymbid"
rsbg.Open Sql2,conn,1,1
				do while not rsbg.eof
				%>
            <option value="<%=rsbg("diarymbjpg")%>" <%if rs("sitebg")=rsbg("diarymbjpg") then response.Write("selected")%>><%=rsbg("diarymbname")%></option>
            <%
				rsbg.movenext
				loop
				set rsbg=nothing
				%>
          </select>
          应用于全站(用户设置除外) </td>
        <td align="center">站点音乐:</td>
        <td align="left"> 
          <input type="text" name="sitemusic" style="width:80px;margin-left:5px;" value="<%=rs("sitemusic")%>">
          调用用户ID</td>
      </tr>
      <tr bgcolor="#FFFFFF" <%=div2%>> 
        <td align="center" nowrap height="50">首页导语<br>
          (20-60个字符) </td>
        <td nowrap align="center"> 
          <textarea name="xinyandy" style="width:99%;margin:5px;" rows="3"><%=rs("xinyandy")%></textarea>
        </td>
        <td align="center">站点右侧公告<br>
          (4-400个字符) <br>
          (可做友链) </td>
        <td align="center"> 
          <textarea name="xinyany" style="width:99%;margin:5px;" rows="3"><%=rs("xinyany")%></textarea>
        </td>
      </tr>
      <tr bgcolor="#FFFFFF" <%=div2%>> 
        <td align="center" nowrap height="50">页头宣言一<br>
          (0-16个字符) </td>
        <td nowrap align="center"> 
          <textarea name="xinyan1" style="width:99%;margin:5px;" rows="3"><%=rs("xinyan1")%></textarea>
        </td>
        <td align="center">页头宣言二<br>
          (0-16个字符) </td>
        <td align="center"> 
          <textarea name="xinyan2" style="width:99%;margin:5px;" rows="3"><%=rs("xinyan2")%></textarea>
        </td>
      </tr>
      <tr bgcolor="#FFFFFF" <%=div2%>> 
        <td align="center" nowrap height="50">页尾宣言<br>
          (0-16个字符) </td>
        <td nowrap align="center"> 
          <textarea name="xinyan3" style="width:99%;margin:5px;" rows="3"><%=rs("xinyan3")%></textarea>
        </td>
        <td align="center">宣言显示</td>
        <td align="left"> 
          <select name="isxinyan" size="1" style="width:120px;margin-left:5px;">
            <option value="False" <%if rs("isxinyan")="False" then response.write "selected"%>>只在站点页显示</option>
            <option value="True" <%if rs("isxinyan")="True" then response.write "selected"%>>在用户页也显示</option>
          </select>
          页头宣言一、二以及页尾宣言 </td>
      </tr>
      <tr bgcolor="#FFFFFF" <%=div3%>> 
        <td align="center" width="100" height="80">是否静态</td>
        <td align="left" width="*"> 
          <select name="ishtml" size="1" style="width:80px;margin-left:5px;">
            <option value="yes"  <%if rs("siteishtml")="yes" then response.write "selected"%>>静态日记</option>
            <option value="no"  <%if rs("siteishtml")="no" then response.write "selected"%>>动态日记</option>
          </select>
          此处选静态,下面所设的目录才生效，以下3目录可同目录名<br>如选择了静态日记，请刷新后台方可在左边看到操作菜单。</td>
        <td align="center" nowrap width="100" height="50">日记目录:<br>
          (日记页生成目录) </td>
        <td nowrap align="left"> 
          <input type="text" name="sitehtmldir" style="width:80px;margin:5px;" value="<%=rs("sitehtmldir")%>">
          一经设定请勿再改 </td>
      </tr>
      <tr bgcolor="#FFFFFF" <%=div3%>> 
        <td align="center" nowrap width="100" height="80">列表目录:<br>
          (日记本、日记等) </td>
        <td nowrap align="left" width="*"> 
          <input type="text" name="sitelistdir" style="width:80px;margin:5px;" value="<%=rs("sitelistdir")%>">
          一经设定请勿再改 </td>
        <td align="center" nowrap width="100" height="50">用户目录:<br>
          (用户首页等目录) </td>
        <td nowrap align="left"> 
          <input type="text" name="sitebookdir" style="width:80px;margin:5px;" disabled value="<%=rs("sitebookdir")%>">
          暂未启用 </td>
      </tr>
      <tr> 
        <td colspan="4" align="center" height="34" background="images/center_title_bg.jpg" alt="日记人 www.rijiren.com"> <input type="image" src="images/03.gif" name="Submit" value="提交" onclick="javascript:document.form1.Submit;">
        </td>
      </tr>
    </table>     
</form>      	
</div>
</body>

</html>
