admin/style.aspx.cs

(完整代码) 2KB

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class admin_style : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            check_login();
            inputdata();
        }
    }
    void check_login()
    {
        if (Session["admin"] == null || Session["admin"].ToString() == "")
        {
            Response.Write("<script language='javascript'>alert('请先登录!');</script>");
            Response.Redirect("login.aspx");
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        this.TextBox1.Text = "";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string strSql = "update board set msgcontext='" + this.Request.Form["TextBox1"].Trim().ToString() + "' where id=1";
        string strConn = ConfigurationManager.ConnectionStrings["sq_chaletshopConnectionString"].ToString();
        SqlConnection conn = new SqlConnection(strConn);
        SqlCommand sqlcom = new SqlCommand(strSql, conn);
        conn.Open();
        sqlcom.ExecuteNonQuery();
        conn.Close();
        Response.Write("<script language='javascript'>alert('修改成功!');</script>");
    }
    void inputdata()
    {
        string strSql1 = "select top 1* from board where id=1";
        string strConn1 = ConfigurationManager.ConnectionStrings["sq_chaletshopConnectionString"].ToString();
        SqlConnection conn1= new SqlConnection(strConn1);
        SqlCommand sqlcom1 = new SqlCommand(strSql1, conn1);
        conn1.Open();
        SqlDataReader reader = sqlcom1.ExecuteReader();
        if (reader.Read())
        {
            this.TextBox1.Text = reader["msgcontext"].ToString();
        }
        conn1.Close();
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。