protected void Page_Load(object sender, EventArgs e) { WebConf conf = new WebConf(); if (conf.getVal("adminlogincode") == "0") p_adminlogincode = true; else p_adminlogincode = false; try { if (Session["joleAdmin"] != null) { Response.Redirect("webMain.aspx"); } String _do = Request.QueryString["err"]; if (_do != "") { error.Text = "<font color=red>"+_do+"</font>"; } } catch(Exception) { } }
/// <summary> /// Loads all necessary components and starts the server. /// </summary> public void Run() { if (_running) { throw new Exception("Server is already running."); } CliUtil.WriteHeader("Web Server", ConsoleColor.DarkRed); CliUtil.LoadingTitle(); this.NavigateToRoot(); // Conf this.LoadConf(this.Conf = new WebConf()); // Database this.InitDatabase(this.Database = new AuraDb(), this.Conf); // Server this.StartWebServer(); CliUtil.RunningTitle(); _running = true; // Commands var commands = new ConsoleCommands(); commands.Wait(); }
public Register() { WebConf conf = new WebConf(); if (conf.getVal("userreg") == "1") { showMessage("注册功能已经关闭"); } if (ISPOST) { MemberInfo info = new MemberInfo(); info.username = pform("username"); if (info.username == "") { showMessage("用户名不能为空","javascript:history.back();"); return; } info.password = pform("pwd"); if (info.password != pform("repwd")) { showMessage("两次输入的密码不同", "javascript:history.back();"); return; } if (pform("sex") == "1") info.sex = true; else info.sex = false; info.truename = pform("truename"); info.email = pform("email"); if (info.email == "") { showMessage("email不能为空", "javascript:history.back();"); return; } info.telphone = pform("telphone"); info.mobile = pform("mobile"); info.qq = pform("qq"); info.birth = pform("birth"); info.ip = "ip"; info.address = pform("address"); PassportBll pb = new PassportBll(); if (pb.register(info)) { string url = HttpContext.Current.Request.UrlReferrer.ToString(); die("<script type=\"text/javascript\">alert('注册成功');location.href='" + url + "'</script>"); } else die("<script type=\"text/javascript\">alert('注册失败');history.back();</script>"); } }
protected void save_btn_ServerClick(object sender, EventArgs e) { WebConf conf = new WebConf(); conf.setAttr("webstate","state",site_state.Value); conf.setVal("webstate", site_state_text.Value); conf.setVal("adminlogincode", adminlogincode.Value) ; conf.setVal("webhost",webhost.Value); string allowreg = "1"; if(allow_reg.Checked) allowreg = "0"; conf.setVal("userreg", allowreg); showMessage("设置成功"); }
protected void Page_Load(object sender, EventArgs e) { try { Database.DataClassesDataContext dataContext = new Database.DataClassesDataContext(); // System.Diagnostics.Debug.WriteLine(" AHIA" +dataContext.WebConfs.Where(id => id.Id == 1)); //We insertedEmployee = db.Employees.FirstOrDefault(e ⇒e.Name.Equals("Michael")); WebConf mywebconf = dataContext.WebConf.FirstOrDefault(id => id.Id == 1); LabelNombreComercial.Text = (mywebconf.NombreComercial); LabelDescripcion.Text = (mywebconf.Descripcion); LabelDomicilio.Text = (mywebconf.Domicilio); LabelHorarioAtencion.Text = (mywebconf.HorarioAtencion); LabelTelefonoContacto.Text = (mywebconf.TelefonoContacto); GridViewProductos.Visible = (mywebconf.PublicarCatalago); } catch { } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebConf conf = new WebConf(); string webstate = conf.getAttr("webstate", "state"); for (int i = 0; i < site_state.Items.Count; i++) { if (site_state.Items[i].Value == webstate) { site_state.Items[i].Selected = true; break; } } site_state_text.Value = conf.getVal("webstate"); webhost.Value = conf.getVal("webhost"); if (webstate == "0") site_state_text.Attributes.Add("style", "display:none;"); else site_state_text.Attributes.Add("style", "display:black;"); string allowreg = conf.getVal("userreg"); if (allowreg == "0") allow_reg.Checked = true; else notallow_reg.Checked = true; if (conf.getVal("adminlogincode") == "0") { adminlogincode.Items[0].Selected = true; } else { adminlogincode.Items[1].Selected = true; } } }
public Frontend() { if (!File.Exists(HttpContext.Current.Server.MapPath(WEBPATH + "/config/install.lock"))) { new InstallBll(); } //检查站点是否关闭 conf = new WebConf(); if (conf.getAttr("webstate", "state") == "1") { die("<div style=\"border:1px solid #ed6501; margin:10px;background:#ffffcc;padding:10px;\">" + conf.getVal("webstate") + "</div>"); } //检查是否需要编译 if (conf.getVal("autocompiled") == "1") { string url = HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"]; url = url.Substring(url.LastIndexOf("/") + 1); TemplateCompiled t = new TemplateCompiled(new FileUrl(url)); } pagename = get_pathinfo(); DataTable sitet = new DataTable("config_site") ; DataTable sitetitle = new DataTable("config_title"); DataSet ds = find("webSite", ""); DataTable dt = ds.Tables[0]; DataColumn dc; DataColumn dctitle; foreach (DataRow key in dt.Rows) { if (!string.IsNullOrEmpty(key["key"].ToString())) { dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.AllowDBNull = true; dc.ColumnName = key["key"].ToString().Trim(); dc.Caption = key["key"].ToString().Trim(); dc.DefaultValue = key["content"].ToString(); //print(key["key"].ToString()); //print("<!--"+key["content"].ToString()+"-->"); //print("<br/>"); sitet.Columns.Add(dc); dctitle = new DataColumn(); dctitle.DataType = Type.GetType("System.String"); dctitle.AllowDBNull = true; dctitle.ColumnName = key["key"].ToString().Trim(); dctitle.Caption = key["key"].ToString().Trim(); dctitle.DefaultValue = key["title"].ToString(); sitetitle.Columns.Add(dctitle); } } DataRow dr1 = sitet.NewRow(); sitet.Rows.Add(dr1); DataRow dr2 = sitetitle.NewRow(); sitetitle.Rows.Add(dr2); config_site = sitet.Rows[0]; config_title = sitetitle.Rows[0]; web_title = config_site["website"].ToString(); //flg_nav 默认文件名 string path = HttpContext.Current.Request.ServerVariables["Path_Info"]; string pathname = Regex.Match(path, @"(?!=\/)\w+(?=\.)").Value; flg_nav = pathname; try { PassportBll p = new PassportBll(); if (p.islogin()) { islogin = true; MemberInfo m = p.get(); if (m.nickname != "") user_name = m.nickname; else user_name = m.username; } else islogin = false; } catch { islogin = false; } }