新闻发布系统1

2026/4/29 23:47:53

}

else Session[\] = 0; i = popedom.Length; j = df.Length; if (i != j) {

Session[\] = 1; }

else Session[\] = 0; i = popedom.Length; j = df.Length; if (i != j) {

Session[\] = 1; }

else Session[\] = 0; i = popedom.Length; j = df.Length; if (i != j) {

Session[\] = 1; }

else Session[\] = 0;

selreader.Close(); myConnection.Close();

Response.Redirect(\); } else {

selreader.Close(); myConnection.Close();

Label1.Text = \用户名或密码错误\; } }

catch (SqlException e) {

Console.WriteLine(\ + e.Message); //出错处理 } }

//关闭连接

//转向admin_main.htm

//关闭连接

//验证是否有管理评论的权限

df = popedom.Replace(\, \);

//验证是否有审核新闻的权限

df = popedom.Replace(\, \);

//验证是否有修改新闻的权限

df = popedom.Replace(\, \);

protected void Submit_Click(object sender, EventArgs e) {

if (Page.IsValid) {

string username = Request[\]; //用户名 string password = Request[\]; //密码 Session[\] = username; conn(username, password); } } }

//验证用户密码

4.2 新闻添加、修改功能

在本系统中,新闻的添加和修改功能的界面大同小异,这里就只具体介绍新闻的添加功能。

新闻添加功能界面如图4-3-1所示:

图4-2-1 添加新闻界面图

新闻添加功能部分代码如下:

public partial class admin_admin_articleAdd : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) {

if (!Page.IsPostBack)

{

string us = (string)Session[\];

if (us.Trim() == \系统管理员\ || (int)Session[\] == 1 || (int)Session[\] == 1) {

getClass(); } else {

Page.Visible = false; } } }

protected void getClass() {

string da = (string)Session[\]; string classname = (string)Session[\]; if (da.Trim() == \系统管理员\) {

string con = ConfigurationManager.ConnectionStrings[\].ConnectionString;

//取得DSN字符

SqlConnection myConnection = new SqlConnection(con);//连接字符串 myConnection.Open();

SqlDataAdapter selClassAll = new SqlDataAdapter(); //创建SqlDataAdapter 类 selClassAll.SelectCommand = new SqlCommand(\, myConnection);

//调用存储过程

selClassAll.SelectCommand.CommandType = CommandType.StoredProcedure; DataSet ds = new DataSet(); selClassAll.Fill(ds, \); ClassName.DataSource = ds;

ClassName.DataTextField = \; ClassName.DataValueField = \; ClassName.DataBind(); myConnection.Close(); } else {

ListItem d = new ListItem(classname, classname); ClassName.Items.Add(d); } }

protected void addhints() {

string username = (string)Session[\];

//增加发表文章数

//根据权限设置分类

string conn = ConfigurationManager.ConnectionStrings[\].ConnectionString;

//取得DSN字符

SqlConnection con = new SqlConnection(conn);//连接字符串 con.Open();

SqlCommand cmd = new SqlCommand(\, con); cmd.CommandType = CommandType.StoredProcedure;

SqlParameter name = cmd.Parameters.Add(\, SqlDbType.Char, 200); //调用并设置存储过程参数

name.Value = username.Trim(); int r = cmd.ExecuteNonQuery(); }

protected void addClassNum() {

string username = (string)Session[\];

string conn = ConfigurationManager.ConnectionStrings[\].ConnectionString;

//取得DSN字符

SqlConnection con = new SqlConnection(conn);//连接字符串 con.Open();

SqlCommand cmd = new SqlCommand(\, con); cmd.CommandType = CommandType.StoredProcedure;

SqlParameter name = cmd.Parameters.Add(\, SqlDbType.Char, 200); //调用并设置存储过程参数

name.Value = ClassName.SelectedItem.Text.Trim(); int r = cmd.ExecuteNonQuery(); }

protected void addArticle() {

int hl = 0; int HL = 0;

string classname = ClassName.SelectedItem.Text.Trim(); if (Headline.Checked) {

hl = 1; }

else hl = 0;

if (HighLight.Checked) {

HL = 1; }

else HL = 0;

string title = Title.Text;

//获得新闻标题

string content = Body.Text;//获得新闻内容 content = Server.HtmlDecode(content); string at = Author.Text;

//获得作者名

//获得是否新闻醒目

//获得分类名

//获得是否是头条新闻

//发表文章

//建立命令

//执行命令

//建立命令


新闻发布系统1.doc 将本文的Word文档下载到电脑
搜索更多关于: 新闻发布系统1 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219