edit_article.aspx.cs
资源名称:论坛源码.rar [点击查看]
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:3k
源码类别:
.net编程
开发平台:
C#
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- using System.Data.OleDb;
- using System.Configuration;
- using System.Text;
- using System.Web.Security;
- using System.Security.Cryptography;
- namespace kuangren
- {
- /// <summary>
- /// edit_article 的摘要说明。
- /// </summary>
- public class edit_article : System.Web.UI.Page
- {
- public string usercookies;
- protected int intRunTime;
- protected DateTime dtStartTime = DateTime.Now;
- protected System.Data.OleDb.OleDbConnection conn;
- protected System.Data.OleDb.OleDbCommand cmd;
- public DataSet dsPending;
- public DataSet dsuser;
- public DataSet dsPending1;
- protected int powerjudge;
- protected int usergrade;
- protected string powername;
- protected int powergrade;
- public string sql;
- public string sql1;
- private void Page_Load(object sender, System.EventArgs e)
- {
- if (Request.Cookies["jusername"]!=null)
- {
- usercookies=Request.Cookies["jusername"].Value;
- }
- else
- {
- Response.Redirect("logine.aspx");
- }
- conn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);
- //搜索主题信息
- sql="SELECT f3_id,f3_motif,f3_content,f3_name,f3_sy FROM forum_3 WHERE f3_id ="+Request.QueryString["f3_id"]+"";
- dsPending=new DataSet();
- OleDbDataAdapter adWord=new OleDbDataAdapter(sql,conn);
- adWord.Fill(dsPending,"forum_3");
- Page.DataBind();
- //判断是否为该主题所属论坛斑竹
- powerjudge=Convert.ToInt32(dsPending.Tables[0].Rows[0]["f3_sy"]);
- powername=Convert.ToString(dsPending.Tables[0].Rows[0]["f3_name"]);
- dsuser=new DataSet();
- cmd=new OleDbCommand("select umf2_id from user_f2 where umf2_id="+powerjudge+" and um_name='"+Request.Cookies["jusername"].Value+"'",conn);
- OleDbDataReader objDataReader ;
- cmd.Connection.Open();
- //搜索该主题发帖人信息,判断斑竹或管理员是否有权限修改[剑气潇潇为超级用户]
- sql1="SELECT u_grade,u_user from userinfo WHERE u_user ='"+powername+"'";
- dsPending1=new DataSet();
- OleDbDataAdapter adWord1=new OleDbDataAdapter(sql1,conn);
- adWord1.Fill(dsPending1,"userinfo");
- Page.DataBind();
- string usergrade=Convert.ToString(dsPending1.Tables[0].Rows[0]["u_grade"]);
- powergrade=Convert.ToInt32(usergrade);
- objDataReader = cmd.ExecuteReader();
- //judgepower
- if (powername!=Request.Cookies["jusername"].Value)
- {
- if ((objDataReader.Read() != true) &&Convert.ToString(Request.Cookies["jpower"].Value)!="1")
- {
- Response.Redirect("power_error.aspx");
- }
- if(powergrade<=Convert.ToInt32(Request.Cookies["jpower"].Value)&&Convert.ToString(Request.Cookies["jusername"].Value)!="剑气潇潇")
- {
- Response.Redirect("power_error.aspx");
- }
- }
- cmd.Connection.Close();
- //end
- }
- #region Web 窗体设计器生成的代码
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- }
- }