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 class huifu : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label name;
		protected System.Web.UI.HtmlControls.HtmlImage face;
		protected System.Web.UI.HtmlControls.HtmlImage touxiang;
		protected System.Web.UI.WebControls.Label touxian;
		protected System.Web.UI.WebControls.Label dengji;
		protected System.Web.UI.WebControls.Image jinqian1;
		protected System.Web.UI.WebControls.Image meili1;
		protected System.Web.UI.WebControls.Label tishi;
		protected System.Web.UI.WebControls.Label wenzhang;
		protected System.Web.UI.WebControls.Label jifen;
		protected System.Web.UI.WebControls.Label chengshi;
		protected System.Web.UI.WebControls.Label shijian;
		protected System.Data.SqlClient.SqlConnection myconn;
		protected System.Data.SqlClient.SqlCommand mycomm;
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.Label Label12;
		protected System.Web.UI.WebControls.Label Label11;
		protected System.Web.UI.WebControls.Label post;
		protected System.Web.UI.HtmlControls.HtmlImage IMG3;
		protected System.Web.UI.HtmlControls.HtmlImage IMG1;
		protected System.Web.UI.HtmlControls.HtmlInputButton Submit1;
		protected System.Web.UI.HtmlControls.HtmlInputButton Submit2;
		protected System.Web.UI.HtmlControls.HtmlInputButton Submit3;
		//protected System.Web.UI.HtmlControls.HtmlTable huifu;
		protected System.Web.UI.HtmlControls.HtmlTable table;
		protected System.Web.UI.HtmlControls.HtmlInputCheckBox qianming_2;
		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.WebControls.ImageButton xiazai;
		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.HtmlTextArea Info;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing1;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing2;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing3;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing4;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing5;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing6;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing12;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing11;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing10;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing9;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing8;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing7;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing14;
		protected System.Web.UI.HtmlControls.HtmlInputRadioButton biaoqing13;
		protected System.Web.UI.HtmlControls.HtmlInputCheckBox qianming;
		protected System.Web.UI.HtmlControls.HtmlInputCheckBox email;
		protected System.Web.UI.HtmlControls.HtmlTable Table1;
		protected System.Web.UI.HtmlControls.HtmlTable huifu1;
        protected System.Web.UI.WebControls.Literal Literal1;
		

	
		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;
		}
		private 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>";

					}		
					
					//签名
					string qianming_pic;
					if(ds.Tables[0].Rows[i]["showqianming"].ToString()=="1")
					{
						qianming_pic="<b>我的签名：</b><br><FONT color=#66cc99>"+htmldecode(ds.Tables[0].Rows[i]["qianming"].ToString())+"</font><br><IMG src="+ds.Tables[0].Rows[i]["qianming_pic"].ToString()+"border=0>";
					}
					else
					{
						qianming_pic="";
					
					}

					Session["huifu"]+="<font face='宋体'><hr color=Gray  size=1  ><LI>"+qianming_pic+"</font></td></tr>";
					Session["huifu"]+="<tr><td "+css+"' ><font face='宋体'><IMG src='./images/ip.gif' border=0>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp"+ds.Tables["huifu"].Rows[i]["shijian"].ToString()+"</font></td>";
					Session["huifu"]+="<td "+css+"'><A href='bianji_huitie.aspx?huifu_id="+ds.Tables[0].Rows[i]["huifu_id"].ToString()+"'target=_blank title=编辑这个贴子><FONT size=2><IMG  src='./images/edit.gif' align=absMiddle border=0></FONT></A></td></tr></table>";
				}
				Session["npage"]="";
				Session["nPageCount"]="";
				Session["Record_Per_Page"]="";
				Session["nRecCount"]="";
				Session["fenye"]="";


				Session["npage"]=nPage;
				Session["nPageCount"]=nPageCount;
				Session["Record_Per_Page"]=Record_Per_Page;
				Session["nRecCount"]=nRecCount;
				Session["fenye"]=Set_daohang();
			}

			SqlCommand cmd=new SqlCommand("select neirong from ancestor where ancestor_id='"+Request.Params["ancestor_id"].ToString()+"'",myconn);
			SqlDataReader r;
			r=cmd.ExecuteReader();
			if(r.Read())
			{
				Session["title"]=r["neirong"].ToString().Trim()+"  "+Session["title"];
				Session["leibie"]=r["neirong"].ToString().Trim();
			}
			r.Close();
			myconn.Close();


		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.xiazai.Click += new System.Web.UI.ImageClickEventHandler(this.xiazai_Click);
			this.Submit1.ServerClick += new System.EventHandler(this.Submit1_ServerClick);
			
			this.Submit3.ServerClick += new System.EventHandler(this.Submit3_ServerClick);
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion



		private void xiazai_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			myconn.Open();
			SqlCommand comm=new SqlCommand("select lujing,attachfileext,attachfile from posts where postid='"+Request.Params["post_id"]+"'",myconn);
			SqlDataReader r;
			r=comm.ExecuteReader();
			r.Read();
			string houzhui=r["attachfileext"].ToString().Trim();   
			string FileName=r["attachfile"].ToString().Trim();
			string filePath =r["lujing"].ToString()+FileName; 
			if(File.Exists(filePath) == false)
			{ 				
				Response.Redirect ("download_wrong.aspx");
				return;

			}
			else
			{
				Page.Response.Clear();
				Page.Response.AddHeader( "Content-Type", houzhui);
				Page.Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
				Page.Response.WriteFile(filePath);
				Page.Response.End();
				r.Close();
			}
			myconn.Close();


		}

		private void Submit3_ServerClick(object sender, System.EventArgs e)
		{
			Info.Value="";
		}

		

		private void Submit1_ServerClick(object sender, System.EventArgs e)
		{
			string huiyuan1;
			try 
			{
				huiyuan1=Request.Cookies["free_huiyuan"].Value.ToString();
				
			}
			catch 
			{
				Response.Redirect("error.aspx");
			}

			myconn.Open();
			mycomm=new SqlCommand("select islock from ancestor where ancestor_id="+Request.Params["ancestor_id"]+"",myconn);
			SqlDataReader myread=mycomm.ExecuteReader();
			try
			{
				myread.Read();
				if(myread["islock"].ToString()=="1")
				{
					Response.Write("<script>alert('对不起，该论坛模块已经被锁定，不能回复>')</script>");
					myread.Close();
					myconn.Close();
				}
				else
				{
					myread.Close();
					mycomm=new SqlCommand("select islock from posts where postid="+Request.Params["post_id"]+"",myconn);
					SqlDataReader myread1=mycomm.ExecuteReader();
					try
					{
						myread1.Read();
						if(myread1["islock"].ToString()=="1")
						{
							Response.Write("<script>alert('对不起，该主题已经被锁定，不能回复>')</script>");
							myread1.Close();
							myconn.Close();
							
						}
						else
						{
							myread1.Close();
							
							string lujing="";
							if(biaoqing1.Checked==true)
							{
			
								lujing=@"./emotion/emotion-1.gif";

							}   
							else if(biaoqing2.Checked==true)
							{
			
								lujing=@"./emotion/emotion-2.gif";
							}
							else if(biaoqing3.Checked==true)
							{
			
								lujing=@"./emotion/emotion-3.gif";
							}
							else if(biaoqing4.Checked==true)
							{
		
								lujing=@"./emotion/emotion-4.gif";
							}
							else if(biaoqing5.Checked==true)
							{
								lujing=@"./emotion/emotion-5.gif";
							}
							else if(biaoqing6.Checked==true)
							{
								lujing=@"./emotion/emotion-6.gif";
							}
							else if(biaoqing7.Checked==true)
							{
								lujing=@"./emotion/emotion-7.gif";
							}
							else if(biaoqing8.Checked==true)
							{
								lujing=@"./emotion/emotion-8.gif";
							}
							else if(biaoqing9.Checked==true)
							{				
								lujing=@"./emotion/emotion-9.gif";
							}
							else if(biaoqing10.Checked==true)
							{				
								lujing=@"./emotion/emotion-10.gif";
							}
							else if(biaoqing11.Checked==true)
							{				
								lujing=@"./emotion/emotion-11.gif";
							}
							else if(biaoqing12.Checked==true)
							{
								lujing=@"./emotion/emotion-12.gif";
							}
							else if(biaoqing13.Checked==true)
							{				
								lujing=@"./emotion/emotion-13.gif";
							}
							else if(biaoqing14.Checked==true)
							{				
								lujing=@"./emotion/emotion-14.gif";
							}
							string isqianming;
							if(qianming_2.Checked==true)
								isqianming="1";
							else
								isqianming="0";
							

							string ss="insert into huifu(post_id,neirong,yonghuming,lujing_pic,shijian,showqianming) values('"+int.Parse(Request.Params["post_id"].ToString())+"',@neirong,'"+Request.Cookies["free_huiyuan"].Value.ToString()+"','"+lujing+"','"+DateTime.Now.ToString()+"','"+isqianming+"')";
			        
							mycomm= new SqlCommand(ss,myconn);
							mycomm.Parameters.Add(new SqlParameter("@neirong", SqlDbType.NText));
							mycomm.Parameters["@neirong"].Value =Info.Value.ToString();
//
							try
							{
								mycomm.ExecuteNonQuery();
							}
							catch
							{}

							mycomm=new SqlCommand("update huiyuan set fatieshu=fatieshu+1,jifen=jifen+5,jinqian=jinqian+5 where yonghuming='"+Request.Cookies["free_huiyuan"].Value.ToString()+"'",myconn);
							try
							{
								mycomm.ExecuteNonQuery();
							}
							catch
							{}

							mycomm=new SqlCommand("update huiyuan set meili=meili+10 ,jifen=jifen+5,jinqian=jinqian+5 where yonghuming='"+name.Text.ToString().Trim()+"'",myconn);
							try
							{
								mycomm.ExecuteNonQuery();
							}
							catch
							{}

							Info.Value="";				
							Response.Redirect("huifu.aspx?ancestor_id="+Request.Params["ancestor_id"]+"&post_id="+int.Parse(Request.Params["post_id"].ToString())+"&Page="+nPageCount+"");
							myconn.Close();
						}
					}
					catch
					{
						myconn.Close();
					}
				}
			}
			catch
			{
				myconn.Close();
			}
		}
		private string htmlencode(string str)
		{
			str=Server.HtmlEncode(str);
			str=str.Replace("\r\n","<br>");
			char ch;
			ch=(char)32;
			str=str.Replace(ch.ToString(),"");
			return str;
		}
		private string htmldecode(string str)
		{
			
			str=Server.HtmlDecode(str);
			str=str.Replace("\r\n","<br>");
//			str=str.Replace("[img","<img  ");
//			str=str.Replace("]",">");
			
//			char ch;
//			ch=(char)32;
//			str=str.Replace(ch.ToString(),"");
			return str;
		}
	}
}
