📄 book.aspx.cs
字号:
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Data;
using System.Runtime;
using System.Data.SqlClient;
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;
public partial class admin_book : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TextBox1.Text = "匿名";
TextBox3.Text = Request.QueryString["bh"];
Label1.Text = "";
}
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = db.CreateConnection();
con.Open();
string gbook;
gbook = TextBox2.Text;
gbook = Regex.Replace(gbook, "共产党", "xx");
gbook = Regex.Replace(gbook, "十七大", "xx");
gbook = Regex.Replace(gbook, "国民党", "xx");
gbook = Regex.Replace(gbook, "傻逼", "xx");
gbook = Regex.Replace(gbook, "团员", "xx");
gbook = Regex.Replace(gbook, "政府", "xx");
gbook = Regex.Replace(gbook, "警察", "xx");
gbook = Regex.Replace(gbook, "<iframe>", "");
gbook = Regex.Replace(gbook, "</iframe>", "");
gbook = Regex.Replace(gbook, "<script", "");
gbook = Regex.Replace(gbook, "<script>", "");
gbook = Regex.Replace(gbook, "</script>", "");
gbook = Regex.Replace(gbook, "js", "");
string strsql = "insert into gbook (name,content,id) values ('"+TextBox1.Text+"','"+gbook+"','"+TextBox3.Text+"')";
SqlCommand cmd = new SqlCommand(strsql, con);
cmd.ExecuteNonQuery();
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
Label1.Text = "你已经成功留言,请刷新此页后查看!";
con.Close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -