📄 browers.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
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 doughty_BBS.inputcon;
using System.IO;
namespace doughty_BBS
{
/// <summary>
/// FileBrowers 的摘要说明。
/// </summary>
public class FileBrowers : System.Web.UI.Page
{
protected System.Web.UI.WebControls.RangeValidator RangeValidator1;
protected System.Web.UI.WebControls.HyperLink HyperLink1;
protected System.Web.UI.WebControls.Panel Panel1;
protected System.Web.UI.WebControls.Label LblUserName;
protected System.Web.UI.WebControls.TextBox TB_Content;
protected System.Web.UI.WebControls.Button BtnPut;
protected System.Web.UI.WebControls.Label Span1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.HtmlControls.HtmlInputFile Files1;
protected System.Web.UI.WebControls.Panel Panel2;
protected System.Web.UI.WebControls.DataList DataList_Q;
protected System.Web.UI.WebControls.DataList Datalist_A;
protected System.Web.UI.WebControls.HyperLink lnkPrev;
protected System.Web.UI.WebControls.HyperLink lnkNext;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button5;
protected System.Web.UI.WebControls.Panel Panel3;
protected System.Web.UI.WebControls.Label lblRecordCount;
protected System.Web.UI.WebControls.Label lblCurrentPage;
protected System.Web.UI.WebControls.Label lblPageCount;
protected System.Web.UI.WebControls.Label lblRecordCount2;
protected System.Web.UI.WebControls.Label lblCurrentPage2;
protected System.Web.UI.WebControls.Label lblPageCount2;
protected System.Web.UI.WebControls.HyperLink lnkPrev2;
protected System.Web.UI.WebControls.HyperLink lnkNext2;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.DataList DList1;
int PageSize,CurrentPage,PageCount;
public string navigation,Question;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.DataList DList2;
protected System.Web.UI.WebControls.TextBox TextBox2;
private void Page_Load(object sender, System.EventArgs e)
{
// 来访情况记录
//Handles MyBase.Load;
//System.Web.UI.WebControls.Button Button1 = new System.Web.UI.WebControls.Button();
/*if (!IsPostBack)
{
/*System.Web.UI.HtmlControls.HtmlInputHidden btnW = new System.Web.UI.HtmlControls.HtmlInputHidden();
System.Web.UI.HtmlControls.HtmlInputHidden btnH = new System.Web.UI.HtmlControls.HtmlInputHidden();
Button1.ID = "Button1";
btnW.Name = "WidthPixel";
btnW.ID = "WidthPixel";
btnH.Name = "HeightPixel";
btnH.ID = "HeightPixel";
Me.FindControl("browserpeek").Controls.Add(btnW);
Me.FindControl("browserpeek").Controls.Add(btnH);
Me.FindControl("browserpeek").Controls.Add(Button1);
string scriptString = "";
scriptString += "document.browserpeek.WidthPixel.value=window.screen.width;";
scriptString += "document.browserpeek.HeightPixel.value=window.screen.height;";
this.RegisterOnSubmitStatement("Meng", scriptString);
this.Page.Attributes.Add("onload", "document.browserpeek.Button1.click();");
}
else
{
this.MyBody.Attributes.Remove("onload");
if (this.FindControl("browserpeek").Controls.Contains(Button1))
{
this.FindControl("browserpeek").Controls.Remove(Button1);
Button1.Dispose();
}
System.Text.StringBuilder strLabel = new System.Text.StringBuilder();
HttpBrowserCapabilities bc;
bc = Request.Browser;
strLabel.Append("您的浏览器的分辨率为:");
strLabel.Append(Request.Form["WidthPixel"]);
strLabel.Append("×");
strLabel.Append(Request.Form["HeightPixel"]);
strLabel.Append("<hr color='#000099'>");
strLabel.Append("浏览器基本信息:<br>");
strLabel.Append("Type = " + bc.Type + "<br>");
strLabel.Append("Name = " + bc.Browser + "<br>");
strLabel.Append("Version = " + bc.Version + "<br>");
strLabel.Append("Major Version = " + bc.MajorVersion + "<br>");
strLabel.Append("Minor Version = " + bc.MinorVersion + "<br>");
strLabel.Append("Platform = " + bc.Platform + "<br>");
strLabel.Append("Is Beta = " + bc.Beta + "<br>");
strLabel.Append("Is Crawler = " + bc.Crawler + "<br>");
strLabel.Append("Is AOL = " + bc.AOL + "<br>");
strLabel.Append("Is Win16 = " + bc.Win16 + "<br>");
strLabel.Append("Is Win32 = " + bc.Win32 + "<br>");
strLabel.Append("支持 Frames = " + bc.Frames + "<br>");
strLabel.Append("支持 Tables = " + bc.Tables + "<br>");
strLabel.Append("支持 Cookies = " + bc.Cookies + "<br>");
strLabel.Append("支持 VB Script = " + bc.VBScript + "<br>");
strLabel.Append("支持 JavaScript = " + bc.JavaScript + "<br>");
strLabel.Append("支持 Java Applets = " + bc.JavaApplets + "<br>");
strLabel.Append("支持 ActiveX Controls = " + bc.ActiveXControls + "<br>");
strLabel.Append("CDF = " + bc.CDF + "<br>");
strLabel.Append("W3CDomVersion = " + bc.W3CDomVersion.ToString() + "<br>");
strLabel.Append("UserAgent = " + Request.UserAgent + "<br>");
strLabel.Append("UserLanguages = " + Request.UserLanguages[0].ToString() + "<br>");
strLabel.Append("<hr color='#000099'>");
strLabel.Append("客户端计算机基本配置:<br>");
strLabel.Append("UserHostName = " + Request.UserHostName + "<br>");
strLabel.Append("UserHostAddress = " + Request.UserHostAddress + "<br>");
Label1.Text = strLabel.ToString();
}*/
//过客的浏览权限
if (System.Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["BorowsArea"])>1)
{
if (User.Identity.Name.ToString()=="")
{
this.Response.Redirect("Logon.aspx?url="+this.Request.Url.ToString());
}
}
//如果用户未登录则显示登录框
if (User.Identity.Name=="")
{
Panel2.Visible=false;
}
else
{
Panel1.Visible=false;
LblUserName.Text="当前用户:"+User.Identity.Name;
if (Session["UserGrade"]==null)
Session["UserGrade"]=DBOperateSite.GetUserGrade(User.Identity.Name);
if (Session["UserGrade"].ToString()=="黑名单")
BtnPut.Enabled=false;
}
//弹出页面
if (Request.QueryString["GG"]==null)
{
if (Session["havepop"]==null)
{
string pop=System.Configuration.ConfigurationSettings.AppSettings["browerspopup"].ToString();
if (pop!="")
{
//this.Response.Write("<script>window.open('"+pop+"','_blank')</script>");
this.Response.Write("<script language='javascript'>function ExitWin() {javascript:window.open('"+pop+"', 'content', '');}window.onbeforeunload =ExitWin;</script>");
Session["havepop"]=1;
}
}
}
//初始化数据
if(!IsPostBack)
{
BindGrid();
}
}
public void BindGrid()
{
try
{
int QS;
if (Request.QueryString["QID"]==null)
if (Request.QueryString["FID"]==null)
QS=1;
else
QS=System.Convert.ToInt32(Request.QueryString["FID"].ToString());
else
QS=System.Convert.ToInt32(Request.QueryString["QID"].ToString());
//点击次数加1
DBOperate.ExcSQL("UPDATE Questions SET HiteCounter = HiteCounter + 1 WHERE (Q_ID = "+QS+")");
DataTable Questions=DBOperate.SelectFormForum("SELECT Q_ID, author, Q_Note, Q_Content, ImageName, HiteCounter, ReleaseTime,ReferTime, BigClass_ID, SmallClass_ID, AnsCounter FROM Questions WHERE (Q_ID = "+QS+")");
this.DataList_Q.DataSource=Questions;
//写导航条
DataRow Q = Questions.Rows[0];
int BID,SID;
BID=System.Convert.ToInt32(Q["BigClass_ID"]);
SID=System.Convert.ToInt32(Q["SmallClass_ID"]);
navigation="当前位置:<a href='default2.aspx'>"+doughty_BBS.inputcon.ConvertString.TitleName(this.Request.Url.ToString())+"</a> → "
+"<a href='BigcalssList.aspx?BID="+BID+"'>"+Navigation.GetBigClassName(BID)+"</a> → "
+"<a href='MainList.aspx?BID="+BID+"&SID="+SID+"'>"+Navigation.GetSmallClassName(SID)+"</a> → 帖子内容";
//主题
Question=Q["Q_Note"].ToString();
//写标题拦
this.Response.Write("<title>"+doughty_BBS.inputcon.ConvertString.TitleName(this.Request.Url.ToString())+"-"+Question+"</title>");
PageSize=System.Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["BrowerList"]);
CurrentPage = 0;
//计算总共有多少记录
int RecordCount = DBOperate.CalculateARecord(QS);
lblRecordCount.Text = RecordCount.ToString();
lblRecordCount2.Text = RecordCount.ToString();
//计算总共有多少页
PageCount = (RecordCount+PageSize-1)/PageSize;
if (PageCount<=0)
PageCount=1;
lblPageCount.Text = PageCount.ToString();
lblPageCount2.Text = PageCount.ToString();
//获取页面参数
CurrentPage=1;
if (Request.QueryString["Page"] != null)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -