<!-- #include file="conn.asp" --> 
<!--#include file="check.asp"-->

<% 
 '===========================================================================================
	'软件名称：126 cms 视频影视管理系统
	'程序版权：126电影               '咨询QQ：479025
	'开发作者：magicblack(479025)    '官方网站：http://www.126oo.com/
	'Copyright (C) 2009 - ... 126oo.com  All Rights Reserved.
	'郑重声明:
	'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
	'    2、任何个人或组织不得以盈利为目的发布,修改,本软件及其他副本上一切关于版权的信息；
	'    3、126电影保留此软件的法律追究权利；
'==========================================================================================
%>

<%
response.Charset="GBK"
dim action : action = SafeData("RQ","action",0)
dim ObjInstalled : ObjInstalled = FSOOBJ.IsObjInstalled("Scripting.FileSystemObject")

Select case action
	case "SaveConfig" : SaveConfig
	case else : ShowConfig
End Select

%>

<%
sub ShowConfig()
dim i
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<title>网站配置 - 后台管理中心 - 126电影程序CMS</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="images/css_body.css" type=text/css rel=stylesheet>
<body> 
<DIV class=bodytitle>
<DIV class=bodytitleleft></DIV>
<DIV class=bodytitletxt>网 站 初 始 配 置</DIV>
</DIV>
  <TABLE width="96%" border=0 align=center cellpadding="5" cellSpacing=1 class=tbtitle style="BACKGROUND: #cad9ea;">
  <form method="POST" action="?action=SaveConfig" id="form" name="form">
    <TBODY>
	<tr>
      <TD vAlign=center width="20%" bgColor=#f5fafe>网站名称：</td>
      <TD bgColor=#ffffff><input name="app_sitename" type="text" id="app_sitename" value="<%=app_sitename%>" size="40" maxlength="500"> 
        * </td>
    </tr>
    
    <tr>
      <TD vAlign=center bgColor=#f5fafe>网站域名：</td>
      <TD bgColor=#ffffff><input name="app_siteurl" type="text" id="app_siteurl" value="<%=app_siteurl%>" size="40" maxlength="500">
        *&nbsp;如：WwW.126oo.Com,不要加http://</td>
    </tr>
    
    <tr>
      <TD vAlign=center bgColor=#f5fafe>安装目录：</td>
      <TD bgColor=#ffffff><input name="app_installdir" type="text" id="app_installdir" value="<%=app_installdir%>" size="40" maxlength="500"> *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br> 
根目录 ＂/＂，二级目录 ＂/126/＂ 三，四级目录以此类推 </td>
    </tr>
	
        <tr>
          <TD vAlign=center bgColor=#f5fafe>当前使用模板：</td>
          <TD bgColor=#ffffff><select name="app_templatedir" style="width:100 "><%for i=0 to ubound(split(FSOOBJ.getfolders("../template/"),","))-1%><option value="<%=split(FSOOBJ.getfolders("../template"),",")(i)%>"<%if trim(app_templatedir)=trim(split(FSOOBJ.getfolders("../template"),",")(i))  then%> selected<%end if%>><%=split(FSOOBJ.getfolders("../template"),",")(i)%></option><%next%></select></td>
        </tr>
		
        <tr>
          <TD vAlign=center bgColor=#f5fafe>模板html目录：</td>
          <TD bgColor=#ffffff>
            <input name="app_htmldir" type="text" id="app_htmldir" value="<%=app_htmldir%>" size="40" />
          不怕模板被人盗就不用改</td>
        </tr>
     <tr>
      <TD vAlign=center bgColor=#f5fafe>是否生成播放页：</td>
      <TD bgColor=#ffffff><select name="app_makeplay" id="app_makeplay">
        <option value="0" <%if app_makeplay=0 then Response.write "selected"%>>不生成</option>
        <option value="1" <%if app_makeplay=1 then Response.write "selected"%>>要生成</option></select>     * 不生成会采用动态播放页. </td>
    </tr>
	
	<tr>
      <TD vAlign=center bgColor=#f5fafe>文章页名称：</td>
      <TD bgColor=#ffffff>        
        <input name="app_articlename" type="text" id="app_articlename" value="<%=app_articlename%>" size="10" />
      *&nbsp;&nbsp; 文章页目录：
	  <input name="app_articlepath" type="text" id="app_articlepath" value="<%=app_articlepath%>" size="10" />
      *&nbsp;</td>
    </tr>
	
    <tr>
      <TD vAlign=center bgColor=#f5fafe>分类页名称：</td>
      <TD bgColor=#ffffff>        
        <input name="app_listname" type="text" id="app_listname" value="<%=app_listname%>" size="10" />
      *&nbsp;&nbsp; 分类页目录：
	  <input name="app_listpath" type="text" id="app_listpath" value="<%=app_listpath%>" size="10" />
      *&nbsp;</td>
    </tr>
    
    <tr>
      <TD vAlign=center bgColor=#f5fafe>内容页名称：</td>
      <TD bgColor=#ffffff>
      <input name="app_viewname" type="text" id="app_viewname" value="<%=app_viewname%>" size="10" />
      *&nbsp;&nbsp;
内容页目录：
      <input name="app_viewpath" type="text" id="app_viewpath" value="<%=app_viewpath%>" size="10" />
*</td>
    </tr>
    <tr>
      <TD vAlign=center bgColor=#f5fafe>播放页名称：</td>
      <TD bgColor=#ffffff>
      <input name="app_playname" type="text" id="app_playname" value="<%=app_playname%>" size="10" />
      *&nbsp;&nbsp;
内容页目录：
      <input name="app_playpath" type="text" id="app_playpath" value="<%=app_playpath%>" size="10" />
*</td>
    </tr>
    
        <tr>
          <TD vAlign=center bgColor=#f5fafe>专题页目录：</td>
          <TD bgColor=#ffffff>
            <input name="app_topicpath" type="text" id="app_topicpath" value="<%=app_topicpath%>" size="40" />
         * </td>
        </tr>
        
    <tr>
    <tr>
      <TD vAlign=center bgColor=#f5fafe>网站数据类型：</td>
      <TD bgColor=#ffffff><select name="app_dbtype" id="SiteData">
        <option value="access" <%if app_dbtype="access" then Response.write "selected"%>>ACCESS数据库</option>
        <option value="mssql" <%if app_dbtype="mssql" then Response.write "selected"%>>MSSQL数据库</option></select>        *&nbsp;出错请手动修改 InCode 目录下的 Config.ASP文件</td>
    </tr>
    <tr>
      <TD vAlign=center bgColor=#f5fafe>ACCESS数库名称：</td>
      <TD bgColor=#ffffff>
          <input name="app_dbpath" type="text" id="app_dbpath" value="<%=app_dbpath%>" size="40" maxlength="500">
           *</td>
    </tr>
    <tr>
      <TD vAlign=center bgColor=#f5fafe>SQL服务器IP：</td>
      <TD bgColor=#ffffff>
        <input name="app_dbserver" type="text" id="app_dbserver" value="<%=app_dbserver%>" size="40" />&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
    </tr>
    <tr>
      <TD vAlign=center bgColor=#f5fafe>SQL数据库名称：</td>
      <TD bgColor=#ffffff>
        <input name="app_dbname" type="text" id="app_dbname" value="<%=app_dbname%>" size="40" />
      </td>
    </tr>
    <tr>
      <TD vAlign=center bgColor=#f5fafe>SQL数据库帐号：</td>
      <TD bgColor=#ffffff>
        <input name="app_dbuser" type="text" id="app_dbuser" value="<%=app_dbuser%>" size="40" />
      </td>
    </tr>
    <tr>
      <TD vAlign=center bgColor=#f5fafe>SQL数据库密码：</td>
      <TD bgColor=#ffffff><input name="app_dbpass" type="text" id="app_dbpass" value="<%=app_dbpass%>" size="40" />
</td>
    </tr>
<tr>
      <TD vAlign=center bgColor=#f5fafe>留言本账户：</td>
      <TD bgColor=#ffffff><input name="app_gbuser" type="text" id="app_gbuser" value="<%=app_gbuser%>" size="40" />
</td>
    </tr>
<tr>
      <TD vAlign=center bgColor=#f5fafe>留言本密码：</td>
      <TD bgColor=#ffffff><input name="app_gbpass" type="text" id="app_gbpass" value="<%=app_gbpass%>" size="40" />
</td>
    </tr>
    <tr>
      <TD vAlign=center bgColor=#f5fafe>程序运行模式：</td>
      <TD bgColor=#ffffff>
<select name="app_viewtype" id="app_viewtype">
		<option value="2" <%if app_viewtype="2" then Response.write "selected"%>>Htm目录样式(/type/id/{page)</option>
        <option value="1" <%if app_viewtype="1" then Response.write "selected"%>>Htm目录样式(/{指定目录}/{page}id )</option>
        <option value="0" <%if app_viewtype="0" then Response.write "selected"%>>ASP动态模式</option>
        </select> 
*&nbsp;&nbsp; 静态后缀名
<select name="app_htmlSuffix" id="app_htmlSuffix">
  <option value="htm" <%if app_htmlSuffix="htm" then Response.write "selected"%>>Htm</option>
  <option value="asp" <%if app_htmlSuffix="asp" then Response.write "selected"%>>ASP</option>
  <option value="html" <%if app_htmlSuffix="html" then Response.write "selected"%>>Html</option>
</select>&nbsp;* </td>    
    </tr>
	    <tr>
      <TD vAlign=center bgColor=#f5fafe>图片保存方式：</td>
      <TD bgColor=#ffffff>
<select name="app_picpath" id="app_picpath">
        <option value="0" <%if app_picpath="0" then Response.write "selected"%>>默认</option>
        <option value="1" <%if app_picpath="1" then Response.write "selected"%>>按月份</option>
		<option value="2" <%if app_picpath="2" then Response.write "selected"%>>按日期</option>
        </select> 
	  </td>    
    </tr>
	
	    <tr>
      <TD vAlign=center bgColor=#f5fafe>用户登陆模式：</td>
      <TD bgColor=#ffffff>
<select name="app_loginmemory" id="app_loginmemory">
        <option value="0" <%if app_loginmemory="0" then Response.write "selected"%>>cookie</option>
        <option value="1" <%if app_loginmemory="1" then Response.write "selected"%>>session</option>
        </select> 
	  </td>    
    </tr>
	
	    <tr>
      <TD vAlign=center bgColor=#f5fafe>开启系统缓存：</td>
      <TD bgColor=#ffffff>
<select name="app_cache" id="app_cache">
        <option value="1" <%if app_cache="1" then Response.write "selected"%>>是</option>
        <option value="0" <%if app_cache="0" then Response.write "selected"%>>否</option>
        </select> 
	  </td>    
    </tr>
	    <tr>
      <TD vAlign=center bgColor=#f5fafe>开启评论：</td>
      <TD bgColor=#ffffff>
<select name="app_comment" id="app_comment">
        <option value="1" <%if app_comment="1" then Response.write "selected"%>>是</option>
        <option value="0" <%if app_comment="0" then Response.write "selected"%>>否</option>
        </select> 
	  </td>    
    </tr>
    <tr>
      <TD vAlign=center bgColor=#f5fafe>缓存时间：</td>
      <TD bgColor=#ffffff><input name="app_cachetime" type="text" id="app_cachetime" value="<%=app_cachetime%>" size="50">
        </td>
    </tr>
	
    <tr>
      <TD vAlign=center bgColor=#f5fafe>缓存标示：</td>
      <TD bgColor=#ffffff><input name="app_cacheid" type="text" id="app_cacheid" value="<%=app_cacheid%>" size="50">
        </td>
    </tr>
	
    <tr>
      <TD vAlign=center bgColor=#f5fafe>生成静态页面间隔：：</td>
      <TD bgColor=#ffffff><input name="app_makeinterval" type="text" id="app_makeinterval" value="<%=app_makeinterval%>" size="50">
        </td>
    </tr>
	
    <tr>
      <TD vAlign=center bgColor=#f5fafe>网站备案号：</td>
      <TD bgColor=#ffffff><input name="app_icp" type="text" id="app_icp" value="<%=app_icp%>" size="50">
        *</td>
    </tr>
    <tr>
      <TD vAlign=center bgColor=#f5fafe>站长Email邮箱：</div></td>
      <TD bgColor=#ffffff><input name="app_email" type="text" id="app_email" value="<%=app_email%>" size="50"> 
        * </td>
    </tr>
    
    <TR align="center" bgcolor="#f8fbfb">
      <TD colspan="2"><input name="Action" type="hidden" id="Action" value="SaveConfig">
          <input name="cmdSave" type="submit" id="cmdSave" class="input" value="更 新 网 站 参 数" <% If ObjInstalled=false Then response.write "disabled" %>>
          <span class="STYLE2">　</span>如出错请手动修改网站 inc 目录下的 Config.ASP文件</td>
    </tr>
    <%
If ObjInstalled=false Then
	Response.Write "<tr class='tdbg'><td height='40' colspan='3'><b><font color=red>你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能。<br>请直接修改网站 InCode 目录下的 Config.ASP文件中的内容。</font></b></td></tr>"
End If
%></TBODY>
</form>
  </table>
</body>
</html>
  <%
end sub
%>

<%
 Function InPutStr(Input)'向数据库中保存字符串时用 
     IF IsEmpty(Input) Then Input="" 
     IF IsNull(Input) Then Input="" 
     IF instr(input,"""")>0 Then input=replace(input,"""","'")'将"替换成',以便在向数据库里存放 
     InPutStr=input 
End function 

sub SaveConfig()
	If ObjInstalled=false Then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>你的服务器不支持 FSO(Scripting.FileSystemObject)! </li>"
		exit sub
	end if  
	
	Dim Fso,hf
	Set Fso=Server.CreateObject("Scripting.FileSystemObject")
	Set hf= Fso.CreateTextFile(Server.mappath("../inc/config.asp"),true)
		
	hf.write "<" & "%@" &" LANGUAGE=""VBSCRIPT"" CODEPAGE=""936"" %" & ">" & vbcrlf
	hf.write "<" & "%" & vbcrlf
	hf.write "option explicit" & vbcrlf
	hf.write "dim app_sitename,app_installdir,app_templatedir,app_htmldir,app_siteurl,app_viewtype,app_loginmemory,app_cache,app_cachetime,app_cacheid,app_picpath,app_dbtype,app_dbprefix,app_dbpath,app_dbserver,app_dbname,app_dbuser,app_dbpass,app_gbuser,app_gbpass,app_listname,app_listpath,app_viewname,app_viewpath,app_playname,app_playpath,app_topicpath,app_makeinterval,app_makeplay,app_comment,app_htmlSuffix,app_icp,app_email,runstart,app_articlename,app_articlepath" & vbcrlf
	
	hf.write "app_sitename=" & chr(34) & trim(request("app_sitename")) & chr(34) & "      '网站名称" & vbcrlf
	hf.write "app_installdir=" & chr(34) & trim(request("app_installdir")) & chr(34) & "        '网站路径" & vbcrlf
	
	hf.write "app_siteurl=" & chr(34) & trim(request("app_siteurl")) & chr(34) & "        '网站域名地址" & vbcrlf
	
    hf.write "app_templatedir=" & chr(34) & trim(request("app_templatedir")) & chr(34) & "    '模板目录" & vbcrlf
	
	hf.write "app_htmldir=" & chr(34) & trim(request("app_htmldir")) & chr(34) & "       '模板html目录" & vbcrlf
	
    hf.write "app_viewtype=" & trim(request("app_viewtype"))  & "        '网站浏览模式, 0=asp动态模式,1=Htm目录样式(/{指定目录}/{page}id ),2=Htm目录样式(/type/id/{page)" & vbcrlf
	
    hf.write "app_loginmemory=" &  trim(request("app_loginmemory"))  & "          '登陆模式 0=cookie,1=session" & vbcrlf
	
	hf.write "app_cache="  & trim(request("app_cache")) &  "       '是否开启缓存" & vbcrlf
	
	hf.write "app_cachetime=" & trim(request("app_cachetime"))  & "       '缓存时间" & vbcrlf
	
	hf.write "app_cacheid=" & chr(34) & trim(request("app_cacheid")) & chr(34) & "      '缓存标示" & vbcrlf
	
    hf.write "app_picpath=" &  trim(request("app_picpath"))  & "      '图片保存路径方式，0=默认,1=按月份,2=按日期" & vbcrlf
	
	hf.write "app_dbtype=" & chr(34) & trim(request("app_dbtype")) & chr(34) & "      '数据库类型: 值分别为 access ; mssql ; mysql" & vbcrlf
	
	hf.write "app_dbpath=" & chr(34) & trim(request("app_dbpath")) & chr(34) & "      'access数据库路径" & vbcrlf
	
	hf.write "app_dbserver=" & chr(34) & trim(request("app_dbserver")) & chr(34) & "      'SQL数据库服务器地址" & vbcrlf
	
	hf.write "app_dbname=" & chr(34) & trim(request("app_dbname")) & chr(34) & "      					  'SQL数据库名称" & vbcrlf
	hf.write "app_dbuser=" & chr(34) & trim(request("app_dbuser")) & chr(34) & "      'SQL数据库用户名" & vbcrlf
	
	hf.write "app_dbpass=" & chr(34) & trim(request("app_dbpass")) & chr(34) & "      					  'SQL数据库密码" & vbcrlf
	
	hf.write "app_gbuser=" & chr(34) & trim(request("app_gbuser")) & chr(34) & "      					  '留言本账户" & vbcrlf
	
	hf.write "app_gbpass=" & chr(34) & trim(request("app_gbpass")) & chr(34) & "      					  '留言本密码" & vbcrlf
	
	hf.write "app_articlename=" & chr(34) & trim(request("app_articlename")) & chr(34) & "      '文章页面前缀" & vbcrlf
	
    hf.write "app_articlepath=" & chr(34) & trim(request("app_articlepath")) & chr(34) & "        '文章页面目录" & vbcrlf
	
	hf.write "app_listname=" & chr(34) & trim(request("app_listname")) & chr(34) & "      '分类页面前缀" & vbcrlf
	
    hf.write "app_listpath=" & chr(34) & trim(request("app_listpath")) & chr(34) & "        '分类页面目录" & vbcrlf

	hf.write "app_viewname=" & chr(34) & trim(request("app_viewname")) & chr(34) & "        '内容页面前缀" & vbcrlf
	
	hf.write "app_viewpath=" & chr(34) & trim(request("app_viewpath")) & chr(34) & "          '内容页面目录" & vbcrlf
	
	hf.write "app_playname=" & chr(34) & trim(request("app_playname")) & chr(34) & "        '播放页面前缀" & vbcrlf
	
	hf.write "app_playpath=" & chr(34) & trim(request("app_playpath")) & chr(34) & "          '播放页面目录" & vbcrlf
	
	hf.write "app_makeplay="  & trim(request("app_makeplay"))  & "        '是否生成静态播放页，0不生成，1生成" & vbcrlf	
	
	hf.write "app_makeinterval="  & trim(request("app_makeinterval"))  & "        '生成静态页面间隔" & vbcrlf	
	
	hf.write "app_comment="  & trim(request("app_comment"))  & "        '是否开启评论 0关闭，1开启" & vbcrlf	
	
	hf.write "app_htmlSuffix=" & chr(34) & trim(request("app_htmlSuffix")) & chr(34) & "          '生成静态文件后缀名" & vbcrlf
	
	hf.write "app_topicpath=" & chr(34) & trim(request("app_topicpath")) & chr(34) & "          '专题页目录" & vbcrlf
	
	hf.write "app_icp=" & chr(34) & trim(request("app_icp")) & chr(34) & "      '网站备案号" & vbcrlf
	
	hf.write "app_email=" & chr(34) & trim(request("app_email")) & chr(34) & "      '站长邮箱" & vbcrlf
	
	hf.write "%" & ">"
	hf.close
	Set hf=Nothing

    alerturl "配置修改成功!","admin_config.asp"
End Sub

%>