doarticle_close.aspx.cs
资源名称:论坛源码.rar [点击查看]
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:9k
源码类别:
.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_close 的摘要说明。
- /// </summary>
- public class doarticle_close : 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 f3_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;
- public string f3title;
- 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"]=="1")
- {aboutype="锁定";aboutvalue=1;}
- if (Request.QueryString["type"]=="2")
- {aboutype="解锁";aboutvalue=0;}
- if (Request.QueryString["type"]=="3")
- {aboutype="提升";}
- if (Request.QueryString["type"]=="4")
- {aboutype="删除";aboutvalue=2;}
- if (Request.QueryString["type"]=="5")
- {aboutype="移动";}
- if (Request.QueryString["type"]=="6")
- {aboutype="固顶";aboutvalue=3;}
- if (Request.QueryString["type"]=="7")
- {aboutype="总固顶";aboutvalue=4;}
- if (Request.QueryString["type"]=="8")
- {aboutype="解除固顶";aboutvalue=0;}
- if (Request.QueryString["type"]=="9")
- {aboutype="惩罚或奖励";}
- if (Request.QueryString["type"]=="10")
- {aboutype="加为精华";aboutvalue=1;}
- if (Request.QueryString["type"]=="11")
- {aboutype="精华取消";aboutvalue=0;}
- 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"]);
- f3title=Convert.ToString(dsPending.Tables[0].Rows[0]["f3_motif"]);
- 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 ((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");
- }
- {
- f3_id=Convert.ToInt32(Request.QueryString["f3_id"]);
- f2_id=Convert.ToInt32(Request.QueryString["f2_id"]);
- StringBuilder sb=new StringBuilder();
- ArrayList values=new ArrayList();
- if ((Convert.ToString(Request.QueryString["type"])=="1" || Convert.ToString(Request.QueryString["type"])=="2" || Convert.ToString(Request.QueryString["type"])=="4")&&Convert.ToString(Request.QueryString["action"])=="action")
- {
- sb.Append("update [forum_3] set f3_state="+aboutvalue+" where f3_id="+f3_id+"");
- }
- if ((Convert.ToString(Request.QueryString["type"])=="6" || Convert.ToString(Request.QueryString["type"])=="7" || Convert.ToString(Request.QueryString["type"])=="8")&&Convert.ToString(Request.QueryString["action"])=="action")
- {
- sb.Append("update [forum_3] set f3_top="+aboutvalue+" where f3_id="+f3_id+"");
- }
- if (Convert.ToString(Request.QueryString["type"])=="3"&&Convert.ToString(Request.QueryString["action"])=="action")
- {
- sb.Append("update [forum_3] set f3_now='"+DateTime.Now+"' where f3_id="+f3_id+"");
- }
- if ((Convert.ToString(Request.QueryString["type"])=="10"||Convert.ToString(Request.QueryString["type"])=="11")&&Convert.ToString(Request.QueryString["action"])=="action")
- {
- sb.Append("update [forum_3] set f3_distillate="+aboutvalue+" where f3_id="+f3_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);
- }
- //插入数据到论坛事件记录表中
- OleDbsqladd="insert into [log](l_announceid,l_boardid,l_touser,l_username,l_content,l_ip) values("+f3_id+","+f2_id+",'"+powername+"','"+usercookies+"','[主题操作]"+aboutype+"《"+f3title+"》,原因:"+Request.QueryString["title"]+" "+Request.QueryString["content"]+",积分操作:"+userscore+" 金钱操作:"+usermoney+"','"+Request.UserHostAddress+"')";
- cmd6=new OleDbCommand(OleDbsqladd,conn);
- conn.Open();
- 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
- }
- }