Esempio n. 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string siteName   = this.TxtSiteName.Text;
            string siteUrl    = this.TxtSiteUrl.Text;
            string manageDir  = this.TxtManageDir.Text;
            string manageCode = this.TxtManageCode.Text;
            string siteKey    = this.TxtSiteKey.Text;
            string installDir = this.TxtInstallDir.Text;

            if (string.IsNullOrEmpty(siteName))
            {
                tips("请输入网站名称!");
            }
            if (string.IsNullOrEmpty(siteUrl))
            {
                tips("请输入网站网址!");
            }
            if (string.IsNullOrEmpty(installDir))
            {
                tips("请输入安装目录!");
            }
            if (this.RdbRZM.SelectedValue == "1")
            {
                if (string.IsNullOrEmpty(this.TxtManageCode.Text))
                {
                    tips("请输入后台管理认证码!");
                }
            }

            ConfigInfo __configinfo = ConfigManage.Deserialize(Server.MapPath(KSCMS.GetInstallDir() + "config/general.config"));

            __configinfo.SiteName             = siteName;
            __configinfo.Domain               = siteUrl;
            __configinfo.SiteKey              = siteKey;
            __configinfo.AdminDir             = manageDir;
            __configinfo.EnableSiteManageCode = Utils.StrToInt(this.RdbRZM.SelectedValue);
            __configinfo.SiteManageCode       = manageCode;
            __configinfo.InstallDir           = installDir;
            if (this.RdbYZM.SelectedValue == "1")
            {
                __configinfo.NeedVerifyCodePage = "login.aspx";
            }
            else
            {
                __configinfo.NeedVerifyCodePage = "";
            }
            ConfigManage.Serialiaze(__configinfo, Server.MapPath(KSCMS.GetInstallDir() + "config/general.config"));

            #region 更新缓存
            KSCache cache = KSCache.GetCacheService();
            cache.RemoveObject("/CMS/ConfigList");
            #endregion


            string sql = string.Empty;
            sql = "DELETE FROM KS_Admin";
            DataFactory.ExecuteNonQuery(sql);
            sql = "INSERT INTO KS_Admin(UserName,[password],[LoginTimes],[Locked],[SysAdmin],[UserType],[DocPower],[AddDate],[LastLoginTime],[LastLogoutTime]) values('" + this.TxtUserName.Text + "','" + Utils.MD5(this.TxtUserPass.Text, 16) + "',1,0,1,1,1,getdate(),getdate(),getdate())";
            DataFactory.ExecuteNonQuery(sql);


            this.Step4.Visible = false;
            this.Step5.Visible = true;
            Kesion.HtmlTags.Function.SaveFile(KSCMS.GetInstallDir() + "install/install.lock", "true");
        }