⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 huifu.aspx.cs

📁 简易BBS源码,包括系统管理、论坛管理、用户可以看懂源码
💻 CS
📖 第 1 页 / 共 2 页
字号:
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.SqlClient;
using System.IO;
using System.Drawing.Imaging;
using System.Text.RegularExpressions;

namespace free.bbs
{
	/// <summary>
	/// Summary description for huifu.
	/// </summary>
	public partial class huifu : System.Web.UI.Page
	{
		protected System.Data.SqlClient.SqlConnection myconn;
		protected System.Data.SqlClient.SqlCommand mycomm;
		protected System.Web.UI.HtmlControls.HtmlInputButton Submit2;
		//protected System.Web.UI.HtmlControls.HtmlTable huifu;
		protected System.Web.UI.HtmlControls.HtmlTable table;
		string sqlstr="";
		protected  const int  Record_Per_Page=20; //'定义每一页显示的记录数
		protected int nRecCount ; //保存记录总数
		//		protected int nRecrt;   //存放当前页面的起始记录序号
		//		protected int nEndCount;        //保存记录总数
		protected int nPageCount;  //保存总共的数据页面数目
		protected int nPage=1;     //存放要浏览当前数据页面号
		protected int nStart ; // 存放当前页面的起始记录序号
		protected int nEnd;     //存放当前页面的终止记录序号
		protected int  nPageEnd;
		protected System.Web.UI.HtmlControls.HtmlTableCell c6;
		protected System.Web.UI.HtmlControls.HtmlButton o;
		protected System.Web.UI.WebControls.TextBox textbox;
		protected System.Web.UI.HtmlControls.HtmlInputButton go;
		int jinqian,meili;
		//		string contenttype="";
		protected System.Web.UI.HtmlControls.HtmlInputCheckBox qianming;
		

	
		protected  void Get_zhuti()
		{
			sqlstr="select shijian,lujing_pic,neirong,post_id,huifu_id,huifu.yonghuming,jifen,dengji,wenzhangshu,fatieshu,qianming,qianming_pic,shi from huiyuan,huifu where (huifu.yonghuming=huiyuan.yonghuming) and (post_id='"+Request.Params["post_id"]+"') Order by huifu_id desc";
			SqlDataAdapter aa=new SqlDataAdapter(sqlstr,myconn);
			DataSet ds=new DataSet();
			aa.Fill(ds,"hui");
			int n=ds.Tables[0].Rows.Count;
			nPage = Convert.ToInt32 ( Request.Params[ "Page"] );//得到当前页号
			nRecCount=n;//得到数据记录总数
	
			if (nRecCount > 0)
				// 确定数据记录要显示的页面数
				nPageCount = nRecCount/Record_Per_Page;
			if (nRecCount%Record_Per_Page> 0 )
				nPageCount += 1;
			//确认浏览命令中的页面参数是否越界,如果越界则重置页面序号
			if( nPage<1 )nPage = 1 ;
			if ( nPage > nPageCount) nPage = nPageCount ;
			//确认当前页面的开始记录和终止记录
			nStart = Record_Per_Page *  ( nPage - 1 );
			nEnd = nStart + Record_Per_Page - 1;
			if (nEnd > nRecCount - 1 )    nEnd = nRecCount - 1;
			
		}
		protected  string  Set_daohang()
		{
			string daohang;
			string daohang1;
			string daohang2;
			string daohang3;
			string daohang4;
			string daohang5=null;
			daohang1="<A title='首页'  href='huifu.aspx?ancestor_id="+Request.Params["ancestor_id"]+"&post_id="+int.Parse(Request.Params["post_id"].ToString())+"&Page=1'><FONT  color='#0000ff'>首页</FONT></A>";
			daohang2="&nbsp;<A title='上一页'  href='huifu.aspx?ancestor_id="+Request.Params["ancestor_id"]+"&post_id="+int.Parse(Request.Params["post_id"].ToString())+"&Page="+(nPage-1)+"'><FONT color='#0000ff'>上一页</FONT></A>";
			int l=(nPage-1)/10;
			string fenye;
			for(int i=l*10+1;i<=(l+1)*10&&i<=nPageCount;i++)
			{
				if(i==nPage)	
					fenye="<FONT color='red'>"+i+"</FONT>";
				else
					fenye="<FONT color='#0000ff'>"+i+"</FONT>";
				daohang5+="&nbsp;<A href='huifu.aspx?ancestor_id="+Request.Params["ancestor_id"]+"&post_id="+int.Parse(Request.Params["post_id"].ToString())+"&Page="+i+"'><FONT color='#0000ff'>"+fenye+"</FONT></A>";
			
			} 
			daohang3="&nbsp;<A title='下一页'  href='huifu.aspx?ancestor_id="+Request.Params["ancestor_id"]+"&post_id="+int.Parse(Request.Params["post_id"].ToString())+"&Page="+(nPage+1)+"'><FONT color='#0000ff'>下一页</FONT></A> ";
			daohang4="&nbsp;<A title='尾页'  href='huifu.aspx?ancestor_id="+Request.Params["ancestor_id"]+"&post_id="+int.Parse(Request.Params["post_id"].ToString())+"&Page="+nPageCount+"'><FONT  color='#0000ff'>尾页</FONT></A> "; 
			if( nPage==1)
			{
				daohang1="首页";
				daohang2="&nbsp;上一页";
			}
			if(nPage==nPageCount)
			{
				daohang3="&nbsp;下一页";
				daohang4="&nbsp;尾页";
			}

			daohang=daohang1+daohang2+daohang5+daohang3+daohang4;
			return daohang;
		}
		protected void Page_Load(object sender, System.EventArgs e)
		{   

			if(Request.Params["Page"].ToString()=="1" || Request.Params["Page"].ToString()=="0")
				huifu1.Visible=true;
			else
				huifu1.Visible=false;

			Session["huifu"]="";
			try
			{
				Label2.Text=Request.Cookies["free_huiyuan"].Value;
			}
			catch
			{
				Label2.Text="没登录";
			}
			myconn=new SqlConnection(Session["str_connection"].ToString());
			myconn.Open();
			/////
			mycomm=new SqlCommand("update posts set renqi=renqi+1 where  postid='"+Request.Params["post_id"]+"'",myconn);
			try
			{
				mycomm.ExecuteNonQuery();
			}
			catch
			{}
			//////
			sqlstr="select sheng,fatieshu,jinqian,meili,touxian,neirong,wenzhangshu,qianming,huiyuan.yonghuming,huiyuan.shi,huiyuan.face,email,jifen,dengji,zhuti,lujing_pic,lujing,shijian ,showqianming ,qianming,qianming_pic,uptime,isup from posts,huiyuan where huiyuan.yonghuming=posts.yonghuming and postid='"+Request.Params["post_id"]+"'";
			
			mycomm=new SqlCommand(sqlstr,myconn);
			SqlDataReader rr=mycomm.ExecuteReader();
			if(rr.Read())
			{
				if(rr["showqianming"].ToString()=="1")
				{
					Session["qianming"]="<b>我的签名:</b><br><FONT color=#66cc99>"+htmldecode(rr["qianming"].ToString())+"</font><IMG src="+rr["qianming_pic"].ToString()+" align=left border=0>";
				}
				else
				{
					Session["qianming"]="";
					
				}
				if(rr["lujing"].ToString()=="")
				{
					xiazai.Visible=false;
					tishi.Visible=false;
				}
				else
				{
					xiazai.Visible=true;
					tishi.Visible=true;
				}
				int jinqian=int.Parse(rr["jinqian"].ToString())/200;
				int meili=int.Parse(rr["meili"].ToString())/200;
				if(jinqian>100)
					jinqian=100;
				if(meili>100)
					meili=100;
				jinqian1.Width=jinqian+1;
				meili1.Width=meili+1;
				Session["title"]="";
				touxian.Text=rr["touxian"].ToString();
				name.Text=rr["yonghuming"].ToString();
				Session["xingming"]=rr["yonghuming"].ToString();
				Session["email"]=rr["email"].ToString();
				Session["zhuti"]=htmldecode(rr["zhuti"].ToString());
				Session["title"]=htmldecode(rr["zhuti"].ToString());
                Session["neirong"]=htmldecode(rr["neirong"].ToString());
				/////////////////////
//				HtmlTableRow myrow;
//				HtmlTableCell mycell;
//				myrow=new HtmlTableRow();
//				mycell=new HtmlTableCell();
//				string myneirong=rr["neirong"].ToString().Replace("\r\n",",<br>");
//				mycell.Controls.Add(new LiteralControl(rr["neirong"].ToString().Replace("\r\n",",<br>")));
//				myrow.Cells.Add(mycell);
//				Table1.Rows.Add(myrow);
				//Session["neirong"]=htmldecode(rr["neirong"].ToString());
				
				face.Visible=false;
				if (rr["lujing_pic"].ToString()!="")
				{
					face.Visible=true;
					face.Src=rr["lujing_pic"].ToString();

				}	
				if (rr["isup"].ToString()=="1")
				{
					Literal1.Visible=true;
					Literal1.Text="<FONT color=#0099ff>作者于"+rr["uptime"].ToString()+"编辑过此帖子</font>";

				}		
				touxiang.Src=rr["face"].ToString();
				dengji.Text=rr["dengji"].ToString();
				jifen.Text=rr["jifen"].ToString();
				chengshi.Text=rr["sheng"].ToString()+" "+rr["shi"].ToString();
				wenzhang.Text=rr["wenzhangshu"].ToString();
				Label11.Text=rr["jinqian"].ToString();
				Label12.Text=rr["meili"].ToString();
				post.Text=rr["fatieshu"].ToString();
				shijian.Text=rr["shijian"].ToString();
				rr.Close();
				mycomm=new SqlCommand("update huiyuan set meili=meili+1 where yonghuming='"+name.Text.Trim().ToString()+"'",myconn);
				mycomm.ExecuteNonQuery();
			}

			//主题
			Get_zhuti();
			nPage = Convert.ToInt32 ( Request.Params[ "Page"] );			
			sqlstr="select email,qianming,face,lujing_pic,neirong,post_id,huifu_id,huifu.yonghuming,jifen,dengji,wenzhangshu,fatieshu,qianming,qianming_pic,shi,touxian,jinqian,meili,shijian ,showqianming,uptime,isup,sheng  from huiyuan,huifu where (huifu.yonghuming=huiyuan.yonghuming) and (post_id='"+Request.Params["post_id"]+"') Order by huifu_id asc ";
			SqlDataAdapter aa=new SqlDataAdapter(sqlstr,myconn);
			DataSet ds=new DataSet();
			aa.Fill(ds,"huifu");
			Session["id"]=int.Parse(Request.Params["post_id"].ToString());
				
			if(ds.Tables[0].Rows.Count>0)
			{
				for (int i=nStart;i<=nEnd;i++)
				{			    
					//金钱和魅力的图象比例关系;
					
					jinqian=int.Parse(ds.Tables[0].Rows[i]["jinqian"].ToString())/100;
					meili=int.Parse(ds.Tables[0].Rows[i]["meili"].ToString())/100;
					if(jinqian>100)
						jinqian=100;
					if(meili>100)
						meili=100;
					if(jinqian==0)
						jinqian=1;
					if(meili==0)
						meili=1;
					//////////////////
					string css;
					if(i%2==0)
						css="class='tableBody1'";
					else
						css="class='tableBody2'";



					Session["huifu"]+="<table class='tableBorder1' cellPadding='0' cellspacing=1 width='760' align='center' border='0' ><tr><td  width='180'valign=top class='tableBody3'><font face='宋体'><B>"+ds.Tables[0].Rows[i]["yonghuming"].ToString()+"<br></B></A><IMG src='"+ds.Tables[0].Rows[i]["face"].ToString()+"'"+
						" border=0><BR><IMG src='./images/level10.gif'border=0><BR>头衔:"+ds.Tables[0].Rows[i]["touxian"].ToString()+""+
						"<BR>等级:"+ds.Tables[0].Rows[i]["dengji"].ToString()+" <BR>文章:"+ds.Tables["huifu"].Rows[i]["wenzhangshu"].ToString()+"<br>帖子:"+ds.Tables["huifu"].Rows[i]["fatieshu"].ToString()+"<br>积分:"+ds.Tables["huifu"].Rows[i]["jifen"].ToString()+"<br>金钱:"+ds.Tables["huifu"].Rows[i]["jinqian"].ToString()+" <br>&nbsp;<IMG id='IMG11' style='WIDTH: "+jinqian+"; HEIGHT: 10px' height='10' alt='' src='./tiezidengji/bar1.gif' width='7' runat='server'><br>魅力:"+ds.Tables["huifu"].Rows[i]["meili"].ToString()+" <br>&nbsp;<IMG id='IMG11' style='WIDTH:"+meili+"; HEIGHT: 10px' height='10' alt='' src='./tiezidengji/bar2.gif' width='7' runat='server'><br>来自:"+ds.Tables["huifu"].Rows[i]["sheng"].ToString()+"  "+ds.Tables["huifu"].Rows[i]["shi"].ToString()+"</font></td>";




					Session["huifu"]+="<td "+css+" width='560'valign=top><font face='宋体'><table width='560'><tr><td width='530'><A href='xinxifasong.aspx?jieshouren="+ds.Tables[0].Rows[i]["yonghuming"]+"' title='给"+ds.Tables[0].Rows[i]["yonghuming"]+"发送一个短消息'>"+
						"<FONT face='宋体'><IMG id=IMG1 style='WIDTH: 48px; HEIGHT: 18px' height=18  src='./images/message.gif' width=48 border=0 runat='server'></FONT></A><FONT >&nbsp;</FONT><A href='goodfriend.aspx?friend="+ds.Tables[0].Rows[i]["yonghuming"]+"'"+ 
						"target=_blank title='把"+ds.Tables[0].Rows[i]["yonghuming"]+"加入好友'><FONT "+ 
						"><IMG  src='./images/friend.gif' border=0"+ 
						"></FONT></A><FONT"+ 
						">&nbsp;</FONT>"+ 
						"<A href='hyziliaochakan.aspx?UserId="+ds.Tables[0].Rows[i]["yonghuming"]+"' target=_blank title='查看"+ds.Tables[0].Rows[i]["yonghuming"]+"的个人资料'><FONT ><IMG  src='./images/profile.gif' border=0"+ 
						"></FONT></A><FONT "+ 
						">&nbsp;</FONT>"+ 
 
						"<FONT >&nbsp;</FONT><A href='mailto:"+ds.Tables[0].Rows[i]["email"]+"'title=点击这里发送电邮给"+ds.Tables[0].Rows[i]["yonghuming"]+" >"+ 
						"<IMG src='./images/email.gif' border=0"+ 
						"></A></td><td width='30px'><b>"+(i+1)+"楼</b></td></tr><tr><td colSpan=10 height=1 bgcolor=#999999 height=1></td></tr></table></font>";

					string NR=htmldecode(ds.Tables["huifu"].Rows[i]["neirong"].ToString());

					
					if (ds.Tables[0].Rows[i]["lujing_pic"].ToString()!="")
					{
						Session["huifu"]+="<IMG src='"+ds.Tables[0].Rows[i]["lujing_pic"].ToString()+"'align=bottom border=0>&nbsp;&nbsp"+NR+"";
					}
					if (ds.Tables[0].Rows[i]["isup"].ToString()=="1")
					{
						
						Session["huifu"]+="<div align=right > <FONT color=#0099ff>作者于"+ds.Tables[0].Rows[i]["uptime"].ToString()+"编辑过此帖子</font></div>";

					}		
					
					//签名

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -