<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<title> 126 CMS - 系统安装</title>
</head>
<body>
<style type="text/css">
* { margin:0; padding:0;}
body{font-size: 12px;font-family:"Lucida Grande",Tahoma,Verdana,Lucida,Arial,Helvetica,sans-serif,"宋体";color:#555;background-color:#fff;}
li{list-style-type: none;}
a:link,a:visited {color:#555;text-decoration: none;}
a:hover { text-decoration:underline; color:#333;}
#warp{ width:100%; display:table;}
#head{width:100%; display:table;margin-bottom:6px;}
#head .top{ width:900px; margin:0 auto; height:60px;}
#head .top .logo{ width:230px; height:60px; float:left;}
#head .top ul{ float:right; padding-top:35px;}
#head .top ul li{ float:left; padding:0 2px;}
#main{display:table; width:900px; margin:0 auto;}
.account{ width:900px; display:table; margin-bottom:10px;}
.account_title{border-top:1px solid #AECFE0; background-color:#F5FAFE; height:19px; color:#41729B; font-weight:bold; padding:5px 0 0 15px; margin-bottom:20px;}
.account ul{width:870px; height:auto; padding-left:15px;}
.account ul.yz li.tit{ padding-top:15px; height:25px;}
.account ul.yz li.red{ padding-top:15px;height:25px;}
.account li{ float:left; height:25px;}
.account li input{ float:left; width:298px; padding:4px 5px 0 5px; height:19px; font-family:Arial, Helvetica, sans-serif;}
.account ul.yz li.inp1{ height:25px;width:118px; padding:15px 5px 0 5px; overflow:hidden}
.account ul.yz li.inp1 input{float:left; width:108px; padding:4px 5px 0 5px; height:19px; font-size:12px;}
.account ul.yz li.img{ padding:0 5px; width:182px; height:40px;}
.account ul.yz li.img img{ display:block;}
.account li span{ color:red;width:13px;}
.account li.tit{ width:220px; text-align:right; line-height:25px; color:#42739B; }
.account li.inp{ padding:0 3px; width:314px;}
.account li.inpt{padding:0 3px;width:314px;line-height:25px;}
.account li.red{ color:red; line-height:25px;}
.account p{ line-height:21px; color:#999; padding:3px 0 3px 238px; margin-bottom:10px;}
.account p a,.account p a:visited{ font-weight:bold; color:#42739C; text-decoration:underline}
.blur {border:1px solid #A9CCDF;}
.focus {border:1px solid #FF9900; background-color: #FFEECA; color: #FF0000;}
div.bont_z{ height:36px;padding:0 0 0 350px; margin-bottom:15px;}
div.bont_z input{ height:35px; border:0;  width:107px; cursor:pointer; font-size:14px; font-weight:bold; color:#ff1122;}
</style>
<%
Response.Charset="GBK"
dim action
action = request.QueryString("action")
select case action
case "setup1" 
  call setup1
case "setup2"
  call setup2
case else
 call main
end select

sub setup2
	If IsObjInstalled("Scripting.FileSystemObject") = false Then
		Response.Write"<div id=""main"">"
		Response.Write"<p>你的服务器不支持 FSO(Scripting.FileSystemObject)! </p>"
		Response.Write"<meta http-equiv=""refresh"" content=""5;URL=admin/index.asp"">"
		Response.Write"</div>"
		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) & request.Form("app_sitename") & chr(34) & "      '网站名称" & vbcrlf
	hf.write "app_installdir=" & chr(34) & request.Form("app_installdir") & chr(34) & "        '网站路径" & vbcrlf
	
	hf.write "app_siteurl=" & chr(34) & request.Form("app_siteurl") & chr(34) & "        '网站域名地址" & vbcrlf
	
    hf.write "app_templatedir=" & chr(34) & "default" & chr(34) & "    '模板目录" & vbcrlf
	
	hf.write "app_htmldir=" & chr(34) & "html" & chr(34) & "       '模板html目录" & vbcrlf
	
    hf.write "app_viewtype=" & "0"  & "        '网站浏览模式, 0=asp动态模式,1=Htm目录样式(/{指定目录}/{page}id ),2=Htm目录样式(/type/id/{page)" & vbcrlf
	
    hf.write "app_loginmemory=" &  "1"  & "          '登陆模式 0=cookie,1=session" & vbcrlf
	
	hf.write "app_cache="  & "1" &  "       '是否开启缓存" & vbcrlf
	
	hf.write "app_cachetime=" & "60"  & "       '缓存时间" & vbcrlf
	
	hf.write "app_cacheid=" & chr(34) & "09年04月27日23时n分56秒" & chr(34) &"      '缓存标示" & vbcrlf
	
    hf.write "app_picpath=" &  "1"  & "      '图片保存路径方式，0=默认,1=按月份,2=按日期" & vbcrlf
	
	hf.write "app_dbtype=" & chr(34) & "access" & chr(34) & "      '数据库类型: 值分别为 access ; mssql ; mysql" & vbcrlf
	
	hf.write "app_dbpath=" & chr(34) & "database/datas.mdb" & chr(34) & "      'access数据库路径" & vbcrlf
	
	hf.write "app_dbserver=" & chr(34) & "(local)" & chr(34) & "      'SQL数据库服务器地址" & vbcrlf
	
	hf.write "app_dbname=" & chr(34) & "126cms" & chr(34) & "      					  'SQL数据库名称" & vbcrlf
	hf.write "app_dbuser=" & chr(34) & "sa" & chr(34) & "      'SQL数据库用户名" & vbcrlf
	
	hf.write "app_dbpass=" & chr(34) & "sa" & chr(34) & "      					  'SQL数据库密码" & vbcrlf
	
	hf.write "app_gbuser=" & chr(34) & "admin" & chr(34) & "      					  '留言本账户" & vbcrlf
	
	hf.write "app_gbpass=" & chr(34) & "admin" & chr(34) & "      					  '留言本密码" & vbcrlf
	
	hf.write "app_articlename=" & chr(34) & "article" & chr(34) & "      '文章页面前缀" & vbcrlf
	
    hf.write "app_articlepath=" & chr(34) & "articlehtml" & chr(34) & "        '文章页面目录" & vbcrlf
	
	hf.write "app_listname=" & chr(34) & "list" & chr(34) & "      '分类页面前缀" & vbcrlf
	
    hf.write "app_listpath=" & chr(34) & "listhtml" & chr(34) & "        '分类页面目录" & vbcrlf

	hf.write "app_viewname=" & chr(34) & "view" & chr(34) & "        '内容页面前缀" & vbcrlf
	
	hf.write "app_viewpath=" & chr(34) & "viewhtml" & chr(34) & "          '内容页面目录" & vbcrlf
	
	hf.write "app_playname=" & chr(34) & "play" & chr(34) & "        '播放页面前缀" & vbcrlf
	
	hf.write "app_playpath=" & chr(34) & "playhtml" & chr(34) & "          '播放页面目录" & vbcrlf
	
	hf.write "app_makeplay="  & "0"  & "        '是否生成静态播放页，0不生成，1生成" & vbcrlf	
	
	hf.write "app_makeinterval="  & "5"  & "        '生成静态页面间隔" & vbcrlf	
	
	hf.write "app_comment="  & "1"  & "        '是否开启评论 0关闭，1开启" & vbcrlf	
	
	hf.write "app_htmlSuffix=" & chr(34) & "htm" & chr(34) & "          '生成静态文件后缀名" & vbcrlf
	
	hf.write "app_topicpath=" & chr(34) & "topichtml" & chr(34) & "          '专题页目录" & vbcrlf
	
	hf.write "app_icp=" & chr(34) & "正在备案..." & chr(34) & "      '网站备案号" & vbcrlf
	
	hf.write "app_email=" & chr(34) & "xxx@qq.com" & chr(34) & "      '站长邮箱" & vbcrlf
	
	hf.write "%" & ">"
	hf.close
	Set hf=Nothing
	
	On Error Resume Next
	If fso.FileExists(Server.mappath("install.asp")) Then
        fso.DeleteFile Server.mappath("install.asp")
    End If
	
	If Err.Number <> 0 Then
		Response.Write"<div id=""main"">"
		Response.Write"<p><span>恭喜！126o cms 系统安装完毕，祝贵站越办越好 ^_^\n\n删除此安装文件（Install.asp）失败，请手动删除此文件</span></p>"
		Response.Write"<meta http-equiv=""refresh"" content=""5;URL=admin/index.asp"">"
		Response.Write"</div>"
	else
		Response.Write"<div id=""main"">"
		Response.Write"<p><span>程序已经安装成功：</span><br /><span>5秒后自动跳转到后台登录页</span>&nbsp;&nbsp;<a href=""admin/index.asp"">立即转到登录页</a></p>"
		Response.Write"<meta http-equiv=""refresh"" content=""5;URL=admin/index.asp"">"
		Response.Write"</div>"
	end if
end sub

sub setup1
	
	strInstallDir = Trim(Request.ServerVariables("SCRIPT_NAME"))
	strInstallDir = Left(strInstallDir, InStrRev(LCase(strInstallDir), "/"))
	
	%>
<div id="main">
      <form action="?action=setup2" name="reg" method="post">
        <div class="account">
          <div class="account_title">网站设置</div>
          <ul>
            <li class="tit"><span>*</span>网站名称：</li>
            <li class="inp">
              <input name="app_sitename" value="126 cms 视频影视" onfocus="this.className = 'focus'" onblur="this.className = 'blur';" class="blur" type="text">
            </li>
            <li class="red" id="web_name_message"></li>
          </ul>
          <p>建立网站的名称</p>
          <ul>
            <li class="tit"><span>*</span>网站地址：</li>
            <li class="inp">
              <input name="app_siteurl" value="<%=Request.ServerVariables("SERVER_NAME")%>" onfocus="this.className = 'focus'" onblur="this.className = 'blur'; " class="blur" type="text">
            </li>
            <li class="red" id="web_url_message"></li>
          </ul>
          <p>以http开头</p>
          <ul>
            <li class="tit"><span>*</span>网站目录：</li>
            <li class="inp">
              <input name="app_installdir" value="<%=strInstallDir%>" onfocus="this.className = 'focus'" onblur="this.className = 'blur'; " class="blur" type="text">
            </li>
            <li class="red" id="web_dir_message"></li>
          </ul>
          <p>一般不必理会系统会自动检测 如检测结果和安装目录不符可以手动修改</p>
        </div>
        <div class="bont_z">
          <input id="submit_button" value="安装" type="submit">
        </div>
        </form>
      </div>
 <%
end sub

sub main
%>
<div id="main">
	   <div class="account">
          <div class="account_title">126 CMS 系统安装程序</div>
		  <p>请在安装完毕后,删除此文件 install.asp ，官方网站 126oo.com </p>
        </div>
      <form action="?action=setup1" name="reg" method="post">
		<div class="account">
          <div class="account_title">系统环境要求</div>
          <ul>
            <li class="tit">MSXML2.XMLHTTP：</li>
            <li class="inpt"><%ShowObjectInstalled("MSXML2.XMLHTTP")%></li>
          </ul>
		  <p>不符合要求将导致采集、远程资料本地化等功能无法应用</p>
		  <ul>
            <li class="tit">FSO读写：</li>
            <li class="inpt"><%ShowObjectInstalled("Scripting.FileSystemObject")%></li>
          </ul>
		  <p>不支持无法使用本系统</p>
		  <ul>
            <li class="tit">Adodb.Stream：</li>
            <li class="inpt"><%ShowObjectInstalled("Adodb.Stream")%></li>
          </ul>
		  <p>不支持无法使用本系统</p>
        </div>
        <div class="bont_z">
          <input id="submit_button" value="下一步" type="submit">
        </div>
        </form>
      </div>
<%
end sub


	Function IsObjInstalled(strObjName)
		On Error Resume Next
		IsObjInstalled = False
		Err = 0
		Dim xTestObj
		Set xTestObj = Server.CreateObject(strObjName)
		If 0 = Err Then IsObjInstalled = True
		Set xTestObj = Nothing
		Err = 0
	End Function
	
	Sub ShowObjectInstalled(strObjName)
		If IsObjInstalled(strObjName) Then
			Response.Write "<font color=green>[√]On</font>"
		Else
			Response.Write "<font color=red>[×]Off</font>"
		End If
	End Sub
	
%>
</BODY>
</html>
