private static void LoadConfig() { string strXmlFile = HttpContext.Current.Server.MapPath("~/xmlconfig/sendcloud_sms.config"); XmlControl XmlTool = new XmlControl(strXmlFile); SMS_api_user = XmlTool.GetText("Root/api_user"); SMS_api_key = XmlTool.GetText("Root/api_key"); XmlTool.Dispose(); }
static DiscuzSessionHelper() { String strXmlFile = System.Web.HttpContext.Current.Server.MapPath("~/_data/config/site.config"); XmlControl XmlTool = new XmlControl(strXmlFile); apikey = XmlTool.GetText("Root/ForumAPIKey"); //API Key secret = XmlTool.GetText("Root/ForumSecret"); //密钥 url = XmlTool.GetText("Root/ForumUrl"); //论坛地址 XmlTool.Dispose(); ds = new DiscuzSession(apikey, secret, url); }
public static void GetConfig() { string strXmlFile = HttpContext.Current.Server.MapPath("/Site.Config"); XmlControl xmlTool = new XmlControl(strXmlFile); siteName = xmlTool.GetText("Root/SiteName"); siteAuthor = xmlTool.GetText("Root/SiteAuthor"); siteKeywords = xmlTool.GetText("Root/SiteKeywords"); siteDescription = xmlTool.GetText("Root/SiteDescription"); pagePerNumber = xmlTool.GetText("Root/PagePerNumber"); siteTips = xmlTool.GetText("Root/SiteTips"); messageCode = xmlTool.GetText("Root/MessageCode"); siteMessage = xmlTool.GetText("Root/SiteMessage"); phoneMessage = xmlTool.GetText("Root/PhoneMessage"); xmlTool.Dispose(); }
//添加项目事件 protected void Button1_Click(object sender, EventArgs e) { XmlControl Config = new XmlControl(Server.MapPath(ConfigPath)); string times = DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss_"); HttpFileCollection files = HttpContext.Current.Request.Files; try { for (int iFile = 0; iFile < files.Count; iFile++) { HttpPostedFile postedFile = files[iFile]; string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); if (fileName != null) { string dataName = times + iFile; fileExtension = System.IO.Path.GetExtension(fileName); postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath(Config.GetText("//TP_upfile")) + dataName + fileExtension); String IMG_URL = dataName + fileExtension; //生成缩略图 System.Drawing.Image.GetThumbnailImageAbort callb = null; System.Drawing.Image image = System.Drawing.Image.FromFile(System.Web.HttpContext.Current.Request.MapPath(Config.GetText("//TP_upfile")) + dataName + fileExtension); string[] w_h = Config.GetText("//TP_upfile_w_h").Split(','); System.Drawing.Image newimage = image.GetThumbnailImage(Convert.ToInt32(w_h[0]), Convert.ToInt32(w_h[1]), callb, new System.IntPtr()); newimage.Save(System.Web.HttpContext.Current.Request.MapPath(Config.GetText("//TP_upfile") + "small_") + dataName + fileExtension); adddate(IMG_URL); BIND(); MessageBox.ResponseScript(this, "TabbedPanels1.showPanel(1);alert('项目添加成功!');"); } else { MessageBox.ResponseScript(this, "alert('你选的文件类型不符!');"); } } } catch { MessageBox.ResponseScript(this, "alert('出现错误!');"); } }
static Config() { String strXmlFile = HttpContext.Current.Server.MapPath("/App_Data/Alipay.config"); XmlControl XmlTool = new XmlControl(strXmlFile); Seller_email = XmlTool.GetText("Root/seller_email"); //商家签约时的支付宝帐号,即收款的支付宝帐号 Partner = XmlTool.GetText("Root/partner"); //partner合作伙伴id(必须填写) Key = XmlTool.GetText("Root/key"); //partner 的对应交易安全校验码(必须填写) XmlTool.Dispose(); Return_url = "http://localhost/api/alipay/return_url.aspx"; Notify_url = "http://localhost/api/alipay/notify_url.aspx"; //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ //字符编码格式 目前支持 gbk 或 utf-8 Input_charset = "utf-8"; //签名方式 不需修改 Sign_type = "MD5"; //访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http Transport = "https"; }
protected void LinkButton_password_Click(object sender, EventArgs e) { XmlControl Config = new XmlControl(Server.MapPath(ConfigPath)); if (password.Text.Trim() == Config.GetText("//TP_password")) { Page.Session["TP_admin"] = password.Text.Trim(); //new ROYcms.Common.cooks().SaveCookie("TP_admin", password.Text.Trim(), 100000); ROYcms.Common.cooks.SaveCookie("TP_admin", password.Text.Trim(), 100000); Response.Redirect("ROYcms_TP.aspx"); } else { Page.Session["TP_admin"] = null; MessageBox.Show(this, "密码错误!"); } }
public void BIND() { //管理列表 string SQL = "select * from [ROYcms_TP_date] order by id DESC "; if (Session["group"] != null) { SQL = "select * from [ROYcms_TP_date] where z_id='" + Session["group"] + "' and y='1' order by id DESC "; } string SQL2 = "select * from [ROYcms_TP_group] order by id DESC "; Repeater_xmlist.DataSource = SqlHelper.ExecuteReader(SqlHelper.Conn, CommandType.Text, SQL, null); Repeater_xmlist.DataBind(); //示意图数据绑定 Repeater_tu.DataSource = SqlHelper.ExecuteReader(SqlHelper.Conn, CommandType.Text, SQL, null); Repeater_tu.DataBind(); //Repeater_tu_s.DataSource = SqlHelper.ExecuteReader(SqlHelper.Conn, CommandType.Text, SQL, null); //Repeater_tu_s.DataBind(); Repeater_group.DataSource = SqlHelper.ExecuteReader(SqlHelper.Conn, CommandType.Text, SQL2, null); Repeater_group.DataBind(); DropDownList_group.DataSource = SqlHelper.ExecuteReader(SqlHelper.Conn, CommandType.Text, SQL2, null); DropDownList_group.DataTextField = "group_name"; DropDownList_group.DataValueField = "id"; try { DropDownList_group.DataBind(); } catch { } DropDownList_group.Items.Insert(0, new ListItem("◆请选择要管理初始化的投票组◆", ""));//插入空项,此举必须放到数据绑定之后 if (Session["group"] != null) { try { DropDownList_group.SelectedValue = Session["group"].ToString(); } catch { } } else { DropDownList_group.SelectedValue = ""; } XmlControl Config = new XmlControl(Server.MapPath(ConfigPath)); config_time.Text = Config.GetText("//TP_time"); TP_upfile.Text = Config.GetText("//TP_upfile"); TP_upfile_w_h.Text = Config.GetText("//TP_upfile_w_h"); admin_password.Text = Config.GetText("//TP_password"); TP_Redirect.Text = Config.GetText("//TP_Redirect"); if (Config.GetText("TP_IP_Y") == "true") { CheckBox_IP_Y.Checked = true; } //前台示意图绑定 string SQL3 = "select * from [ROYcms_TP_date] where z_id='" + Request["group"] + "' order by id DESC "; if (Request["group"] != null) { Repeater_user_tu.DataSource = SqlHelper.ExecuteReader(SqlHelper.Conn, CommandType.Text, SQL3, null); Repeater_user_tu.DataBind(); } //根据ID返回组数据 string SQL4 = "select * from [ROYcms_TP_group] where id= '" + Request["group"] + "'"; Repeater_user_z.DataSource = SqlHelper.ExecuteReader(SqlHelper.Conn, CommandType.Text, SQL4, null); Repeater_user_z.DataBind(); if (Session["group_type"] != null && Convert.ToInt32(Session["group_type"]) == 1) { Panel_small.Visible = true; Panel_big.Visible = false; } }
public string ConfigPath = "~/Administrator/App_Config/ROYcms_TP.config"; // protected void Page_Load(object sender, EventArgs e) { XmlControl Config = new XmlControl(Server.MapPath(ConfigPath)); this.TIME = Convert.ToInt32(Config.GetText("//TP_time")); //同一IP 限定时间; this.Redirect = Config.GetText("//TP_Redirect"); //投票成功之后返回的页面; if (!IsPostBack) { // Page.Session["TP_admin"] = "ADMIN"; if (Request["tp_id"] == null && Request["tp_id[]"] == null) { BIND(); if (Session["TP_admin"] != null) { Panel_index.Visible = true; Panel_tu.Visible = false; switch (Request["t"]) { case "del": del(); BIND(); MessageBox.ResponseScript(this, "TabbedPanels1.showPanel(2)"); break; case "y": update(); BIND(); MessageBox.ResponseScript(this, "TabbedPanels1.showPanel(2)"); break; case "group_del": group_del(); BIND(); MessageBox.ResponseScript(this, "TabbedPanels1.showPanel(5)"); break; case "group_edit": Panel_edit_group.Visible = true; group_edit_bind(); MessageBox.ResponseScript(this, "TabbedPanels1.showPanel(5)"); break; case "date_edit": Panel_edit_date.Visible = true; date_edit_bind(); MessageBox.ResponseScript(this, "TabbedPanels1.showPanel(2)"); break; case "remark_del": remark_del(); BIND(); MessageBox.ResponseScript(this, "TabbedPanels1.showPanel(7)"); break; case "baoming_del": baoming_del(); BIND(); MessageBox.ResponseScript(this, "TabbedPanels1.showPanel(7)"); break; case "logout": Session["group"] = null; Session["group_name"] = null; BIND(); break; case "out": Session["TP_admin"] = null; Response.Redirect("ROYcms_TP.aspx"); break; } } else { Panel_index.Visible = false; Panel_tu.Visible = true; } } else { Panel_index.Visible = false; Panel_tu.Visible = false; if (Request["tp_id[]"] != null) { tp_id_z = Request["tp_id[]"].Trim().Split(','); } if (Request["tp_id"] != null) { tp_id_z = Request["tp_id"].Trim().Split(','); } for (int i = 0; i < tp_id_z.Length; ++i) { tp_id = tp_id_z[i]; //投票 userip = Request.UserHostAddress.ToString(); //如果配置文件设置关闭了限制同一IP投票 则在这里直接投票 if (Config.GetText("//TP_IP_Y") == "false") { addIP(); //添加IP tt(); //投票 } else { //ip存在 if (checkVoterIP() == true) { //接下来要做的事情是检测该用户上次投票时间间隔 if (checkTime() == true) { if (tp_id_z.Length == 1) { Response.Write("对不起,为了公平,请不要反复投票!"); MessageBox.ShowAndRedirect(this, "对不起,为了公平,请不要反复投票!", Redirect); } } else { update_date(); //修改IP时间 tt(); //投票 } } //IP不存在时 else { addIP(); //添加IP tt(); //投票 } } } if (tp_id_z.Length > 1) { Response.Write("批量投" + tp_id_z.Length + "票成功!"); MessageBox.ShowAndRedirect(this, "批量投" + tp_id_z.Length + "票成功!", Redirect); } else { MessageBox.ShowAndRedirect(this, "你没有选择!", Redirect); } } //评论 if (Request["remark_title"] != null) { Panel_index.Visible = false; Panel_tu.Visible = false; add_remark(); } // if (Request["administrator"] != null) { Panel_administrator.Visible = true; } } }