doarticle_reply.aspx.cs
资源名称:论坛源码.rar [点击查看]
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:7k
源码类别:
.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>
- /// doarticle_reply 的摘要说明。
- /// </summary>
- public class doarticle_reply : 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;
- protected System.Data.OleDb.OleDbCommand cmd5;
- protected System.Data.OleDb.OleDbCommand cmd6;
- protected System.Data.OleDb.OleDbCommand cmd7;
- protected System.Data.OleDb.OleDbCommand cmd8;
- 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;
- public string aboutype;
- protected int aboutvalue;
- protected int f4_id;
- protected int f2_id;
- protected string OleDbSqlforum;
- protected string OleDbsql;
- protected string OleDbsqladd;
- protected string OleDbsqluser;
- protected string OleDbsqlmessage;
- protected string userscore;
- protected string usermoney;
- private void Page_Load(object sender, System.EventArgs e)
- {
- if (Request.Cookies["jusername"]!=null)
- {
- usercookies=Request.Cookies["jusername"].Value;
- }
- else
- {
- Response.Redirect("logine.aspx");
- }
- if (Request.QueryString["type"]=="12")
- {aboutype="回复删除";}
- conn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);
- //搜索回复信息
- sql="SELECT f4_id,f4_motif,f4_content,f4_name,f4_sy1,f4_sy2 FROM forum_4 WHERE f4_id ="+Request.QueryString["f4_id"]+"";
- dsPending=new DataSet();
- OleDbDataAdapter adWord=new OleDbDataAdapter(sql,conn);
- adWord.Fill(dsPending,"forum_4");
- Page.DataBind();
- //判断是否为该主题所属论坛斑竹
- powerjudge=Convert.ToInt32(dsPending.Tables[0].Rows[0]["f4_sy1"]);
- powername=Convert.ToString(dsPending.Tables[0].Rows[0]["f4_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
- //以下为执行操作代码
- if (Convert.ToString(Request.QueryString["action"])=="action")
- {
- string str=""+Request.QueryString["content"]+"";
- string str1=""+Request.QueryString["title"]+"";
- if (System.Text.Encoding.Default.GetByteCount(str)==0&&System.Text.Encoding.Default.GetByteCount(str1)==0)
- {
- Response.Redirect("power_error.aspx");
- }
- {
- f4_id=Convert.ToInt32(Request.QueryString["f4_id"]);
- f2_id=Convert.ToInt32(Request.QueryString["f2_id"]);
- StringBuilder sb=new StringBuilder();
- ArrayList values=new ArrayList();
- sb.Append("delete from [forum_4] where f4_id="+f4_id+"");
- OleDbsql=String.Format(sb.ToString(),values.ToArray());
- cmd5=new OleDbCommand(OleDbsql,conn);
- //执行对用户金钱积分操作
- if (Convert.ToString(Request.QueryString["checkbox"])!="checkbox")
- {
- OleDbsqluser="update userinfo set u_fenshu=u_fenshu+("+Request.QueryString["dofenshu"]+"),u_money=u_money+("+Request.QueryString["domoney"]+") where u_user='"+powername+"' ";
- cmd7=new OleDbCommand(OleDbsqluser,conn);
- userscore=Convert.ToString(Request.QueryString["dofenshu"]);
- usermoney=Convert.ToString(Request.QueryString["domoney"]);
- }
- else
- {
- userscore="0";
- usermoney="0";
- }
- if (Convert.ToString(Request.QueryString["ismsg"])=="1")
- {
- OleDbsqlmessage="INSERT INTO [forum_5](p_take,p_send,p_title,p_content) values('"+powername+"','"+usercookies+"','系统通知','您的帖子因"+Request.QueryString["title"]+""+Request.QueryString["content"]+"而"+aboutype+"r积分操作:"+userscore+" 金钱操作:"+usermoney+"r"+usercookies+"留言:"+Request.QueryString["msg"]+"')";
- cmd8=new OleDbCommand(OleDbsqlmessage,conn);
- }
- conn.Open();
- //插入数据到论坛事件记录表中
- OleDbsqladd="insert into [log](l_announceid,l_boardid,l_touser,l_username,l_content,l_ip) values("+f4_id+","+f2_id+",'"+powername+"','"+usercookies+"','[回复操作]删除回复,帖子编号"+f4_id+",原因:"+Request.QueryString["title"]+" "+Request.QueryString["content"]+",积分操作:"+userscore+" 金钱操作:"+usermoney+"','"+Request.UserHostAddress+"')";
- cmd6=new OleDbCommand(OleDbsqladd,conn);
- bool doredirect=true;
- try
- {
- cmd5.ExecuteNonQuery();
- cmd6.ExecuteNonQuery();
- if (Convert.ToString(Request.QueryString["checkbox"])!="checkbox")
- {
- cmd7.ExecuteNonQuery();
- }
- if (Convert.ToString(Request.QueryString["ismsg"])=="1")
- {
- cmd8.ExecuteNonQuery();
- }
- }
- catch
- {
- doredirect=false;
- }
- finally
- {
- conn.Close();
- }
- if(doredirect)
- {
- Response.Redirect("doarticle_closeto.aspx?f2_id="+f2_id+"");
- }
- else
- {
- Response.Redirect("index.aspx");
- }
- }
- }
- }
- #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
- }
- }