index.aspx.cs
资源名称:论坛源码.rar [点击查看]
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:6k
源码类别:
.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;
- namespace kuangren
- {
- /// <summary>
- /// index 的摘要说明。
- /// </summary>
- public class index : System.Web.UI.Page
- {
- protected System.Web.UI.WebControls.Label Label1;
- protected System.Web.UI.WebControls.HyperLink HyperLink1;
- protected System.Web.UI.HtmlControls.HtmlForm Form1;
- protected System.Web.UI.WebControls.Repeater parent;
- protected int intRunTime;
- protected System.Web.UI.HtmlControls.HtmlInputText password2;
- protected System.Web.UI.WebControls.DropDownList DropDownList1;
- protected System.Web.UI.WebControls.TextBox userpass;
- protected System.Web.UI.WebControls.TextBox username;
- protected DateTime dtStartTime = DateTime.Now;
- public DataSet dsPending;
- public string sql;
- protected string FilterBadWords(string msg)
- {
- string badwords="妈妈的|我靠|fuck|bitch|他妈的|性爱|法轮功|falundafa|falun|江泽民|共产党|操你妈|三级片|sex|腚|妓|娼|阴蒂|奸|尻|贱|婊|靠|叉|龟头|屄|赑|妣|肏|尻|屌";
- string[] tempstr=badwords.Split('|');
- string finalstr=msg;
- for(int i=0;i<tempstr.Length;i++)
- {
- finalstr=finalstr.Replace(tempstr[i],new String('*',tempstr[i].Length));
- }
- return finalstr;
- return msg;
- }
- protected string dotrim(string f2_lasttopic,int intlength)
- {
- if(f2_lasttopic=="")
- {
- return "null";//可以任意写
- }
- else
- {
- if(f2_lasttopic.Length>intlength)
- {
- return f2_lasttopic.Substring(0,intlength)+"..";
- }
- else
- {
- return f2_lasttopic;
- }
- }
- }
- public string GetPath(object o)
- {
- if (Convert.IsDBNull(o) || (string)o == "")
- return "";
- else
- return "<img src="+o+">";
- }
- public string GetPath1(object o)
- {
- if ((string)o == "1")
- return "skin/dvbbs/images/forum_lock.gif";
- else
- return "skin/dvbbs/images/forum_nonews.gif";
- }
- protected string getModerator(string strModerators)
- {
- StringBuilder strResult = new StringBuilder();
- if (strModerators != "")
- {
- string[] strModerator = strModerators.Split('|');
- foreach (string strInfos in strModerator)
- {
- strResult.Append("<a href="user_infor.aspx?u_user=");
- strResult.Append(strInfos);
- strResult.Append("" target="_blank">");
- strResult.Append(strInfos);
- strResult.Append("</a> ");
- }
- }
- else
- {
- strResult.Append("暂无版主");
- }
- return strResult.ToString();
- }
- private void Page_Load(object sender, System.EventArgs e)
- {
- if (Request.Cookies["iscookies"]==null)
- {
- Response.Cookies["iscookies"].Value="0";
- Response.Cookies["iscookies"].Expires=DateTime.Now.AddDays(3650);
- Response.Write ("<META http-equiv=Content-Type content=text/html; charset=gb2312><meta HTTP-EQUIV=REFRESH CONTENT=3>正在登陆论坛……<br><br>本系统要求使用COOKIES,假如您的浏览器禁用COOKIES,您将不能登录本系统……<br><img src=images/quickstart.gif><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");
- }
- DataSet ds = new DataSet();
- OleDbConnection cnn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);
- OleDbDataAdapter cmd1 = new OleDbDataAdapter("select * from forum_1 order by f1_order",cnn);
- //Create and fill the DataSet.
- cmd1.Fill(ds,"forum_1");
- //Create a second DataAdapter for the Titles table.
- OleDbDataAdapter cmd2 = new OleDbDataAdapter("select * from forum_2 order by f2_by",cnn);
- cmd2.Fill(ds,"forum_2");
- //Create the relation bewtween the Authors and Titles tables.
- ds.Relations.Add("myrelation",ds.Tables["forum_1"].Columns["f1_id"],ds.Tables["forum_2"].Columns["f2_sy"]);
- //Bind the Authors table to the parent Repeater control, and call DataBind.
- parent.DataSource = ds.Tables["forum_1"];
- Page.DataBind();
- //Close the connection.
- cnn.Close();
- }
- public class User
- {
- public static string Agent(int intNum)
- {
- string strResult = null;
- strResult = HttpContext.Current.Request.UserAgent.Split(';')[intNum].Trim().Replace("(", "").Replace(")", "");
- switch (intNum)
- {
- case 1:
- strResult = Browser(strResult);
- break;
- case 2:
- strResult = System(strResult);
- break;
- }
- return strResult;
- }
- public static string System(string strPara)
- {
- string strResult = null;
- switch (strPara)
- {
- case "Windows NT 5.0":
- strResult = "Windows 2000";
- break;
- case "Windows NT 5.1":
- strResult = "Windows XP";
- break;
- case "Windows NT 5.2":
- strResult = "Windows Server 2003";
- break;
- }
- return strResult;
- }
- public static string Browser(string strPara)
- {
- string strResult = null;
- strResult = strPara.Replace("MSIE", "Internet Explorer");
- return strResult;
- }
- }
- #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
- private void grdPending_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- }
- }
- }