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

📄 tj_soft.aspx.cs

📁 阿江酷站统计系统ASP.Net版,可以直接使用。和现有的网站合并就可以了。提供详细的IP分析。
💻 CS
字号:
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;

namespace counter
{
	/// <summary>
	/// tj_soft 的摘要说明。
	/// </summary>
	public class tj_soft : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label lbhigh1;
		protected System.Web.UI.WebControls.Label lbhigh2;
		protected System.Web.UI.WebControls.Label lbhigh3;
		protected System.Web.UI.WebControls.Label lbhigh4;
		protected System.Web.UI.WebControls.Label lbhigh5;
		protected System.Web.UI.WebControls.Label lbhigh6;
		protected System.Web.UI.WebControls.Label lbhigh7;
		protected System.Web.UI.WebControls.Label lbhigh8;
		public static DataView dv;

		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			DataSet myds = new DataSet();
			myds = counter.SQLConn.ExecuteSqlForDataSet("select * from CounterInfo");
			dv=myds.Tables[0].DefaultView;
			if(Session["master"]==null) Session["master"]="";
			if(Session["whatcan"]==null) Session["whatcan"]=dv[0].Row["whatcan"].ToString();
			if(Session["master"].ToString() != "master" && int.Parse(Session["whatcan"].ToString()) < 2) Response.Redirect("help.aspx?id=004&error=您没有查看客户端软件统计的权限。");
		}

		public string show_soft_data(int show_flag)
		{
			string strshow_soft_data_msg1="";
			string strshow_soft_data_msg2="";
			int lsbf;

			DataSet myds1 = new DataSet();
			DataView dv1=new DataView();

			//浏览器使用情况
			string[,] arvsoft=new string[,]{{"NetCaptor",""},{"MSIE 6.x",""},{"MSIE 5.x",""},{"MSIE 4.x",""},{"Netscape",""},{"Opera",""},{"Other",""}};
			for(int i=0;i<=6;i++) arvsoft[i,1]=howsoft(arvsoft[i,0]);

			int intmaxsoft=0;
			int intsumsoft=0;
			for(int i=0;i<=6;i++)
			{
				if(int.Parse(arvsoft[i,1].ToString())>intmaxsoft) intmaxsoft=int.Parse(arvsoft[i,1].ToString());
				intsumsoft+=int.Parse(arvsoft[i,1].ToString());
			}

			//防止除数为0出错
			if (intmaxsoft==0) intmaxsoft=1;
			if (intsumsoft==0) intsumsoft=1;
			
			for (int i=0;i<=6;i++)
			{
				strshow_soft_data_msg1+="<td width=45 valign=bottom background='images/tu_back.gif' align=center><img style='BORDER-BOTTOM: #000000 1px solid' src='images/tu.gif' height='"+(int)(float.Parse(arvsoft[i,1].ToString())/intmaxsoft*100)+"' width='9' alt='"+arvsoft[i,0]+",访问"+arvsoft[i,1]+"次,";
				strshow_soft_data_msg2+="<td width=45 align=center><a title='"+arvsoft[i,0]+",访问"+arvsoft[i,1]+"次,";

				//计算访问量的百分数,精确到小数后1位,小于零的在前面加字母0
				lsbf=(int)(int.Parse(arvsoft[i,1].ToString())*1000/intsumsoft)/10;

				strshow_soft_data_msg1+=lsbf+"%'>"+"</td>";
				strshow_soft_data_msg2+=lsbf+"%'>";
				if(arvsoft[i,0].Length>6)
				{
					strshow_soft_data_msg2+=arvsoft[i,0].Substring(0,6);
				}
				else
				{
					strshow_soft_data_msg2+=arvsoft[i,0];
				}
				strshow_soft_data_msg2+="</font></a></td>";
			}

			switch(show_flag)
			{
				case 0:
					lbhigh1.Text=((int)((float)(intmaxsoft)*10+0.5)/10).ToString();
					lbhigh2.Text=((float)(int)((3*(float)(intmaxsoft)*10/4)+0.5)/10).ToString();
					lbhigh3.Text=((float)(int)(((float)(intmaxsoft)*10/2)+0.5)/10).ToString();
					lbhigh4.Text=((float)(int)(((float)(intmaxsoft)*10/4)+0.5)/10).ToString();
					return "";

				case 1:
					return strshow_soft_data_msg1;

				case 2:
					return strshow_soft_data_msg2;

				default:
					return "";

			}

		}

		public string show_os_data(int show_flag)
		{
			string strshow_os_data_msg1="";
			string strshow_os_data_msg2="";
			int lsbf;

			DataSet myds1 = new DataSet();
			DataView dv1=new DataView();

			//操作系统使用情况
			string[,] arvos=new string[,]{{"Win2k",""},{"WinXP",""},{"Win2k3",""},{"WinNT",""},{"Win9x",""},{"类Unix",""},{"Mac",""},{"Other",""}};
			for(int i=0;i<=7;i++) arvos[i,1]=howOS(arvos[i,0]);

			int intmaxos=0;
			int intsumos=0;
			for(int i=0;i<=7;i++)
			{
				if(int.Parse(arvos[i,1].ToString())>intmaxos) intmaxos=int.Parse(arvos[i,1].ToString());
				intsumos+=int.Parse(arvos[i,1].ToString());
			}

			//防止除数为0出错
			if (intmaxos==0) intmaxos=1;
			if (intsumos==0) intsumos=1;

			for (int i=0;i<=7;i++)
			{				
				strshow_os_data_msg1+="<td width=45 valign=bottom background='images/tu_back.gif' align=center><img style='BORDER-BOTTOM: #000000 1px solid' src='images/tu.gif' height='"+(int)(float.Parse(arvos[i,1].ToString())/intmaxos*100)+"' width='9' alt='"+arvos[i,0]+",访问"+arvos[i,1]+"次,";
				strshow_os_data_msg2+="<td width=45 align=center><a title='"+arvos[i,1]+",访问"+arvos[i,1]+"次,";

				//计算访问量的百分数,精确到小数后1位,小于零的在前面加字母0
				lsbf=(int)(int.Parse(arvos[i,1].ToString())*1000/intsumos)/10;

				strshow_os_data_msg1+=lsbf+"%'>"+"</td>";
				strshow_os_data_msg2+=lsbf+"%'>"+arvos[i,0]+"</font></a></td>";
			}

			switch(show_flag)
			{
				case 0:
					lbhigh5.Text=((int)((float)(intmaxos)*10+0.5)/10).ToString();
					lbhigh6.Text=((float)(int)((3*(float)(intmaxos)*10/4)+0.5)/10).ToString();
					lbhigh7.Text=((float)(int)(((float)(intmaxos)*10/2)+0.5)/10).ToString();
					lbhigh8.Text=((float)(int)(((float)(intmaxos)*10/4)+0.5)/10).ToString();
					return "";

				case 1:
					return strshow_os_data_msg1;

				case 2:
					return strshow_os_data_msg2;

				default:
					return "";

			}

		}

		public string show_width_data()
		{
			string strshow_width_data_msg="";
			string strthewidth;
			string strvallwidth;
			int lsbf;

			DataSet myds1 = new DataSet();
			DataView dv1=new DataView();

			myds1=counter.SQLConn.ExecuteSqlForDataSet("select vwidth,count(id) as allwidth from CounterView where vwidth<>0 group by vwidth order by vwidth DESC");
			dv1=myds1.Tables[0].DefaultView;
			dv1.Table.AcceptChanges();

			int intmaxallwidth=0;
			int intsumallwidth=0;
			for(int i=0;i<dv1.Count;i++)
			{
				if(int.Parse(dv1[i].Row["allwidth"].ToString())>intmaxallwidth) intmaxallwidth=int.Parse(dv1[i].Row["allwidth"].ToString());
				intsumallwidth+=int.Parse(dv1[i].Row["allwidth"].ToString());
			}

			//防止除数为0出错
			if (intmaxallwidth==0) intmaxallwidth=1;
			if (intsumallwidth==0) intsumallwidth=1;

			int j=0;			
			for (int i=0;i<dv1.Count;i++)
			{
				strthewidth=dv1[i].Row["vwidth"].ToString();
				strvallwidth=dv1[i].Row["allwidth"].ToString();

				strshow_width_data_msg+="<tr><td width='40' align=right><a title='"+strthewidth+",访问"+strvallwidth+"次,";

				//计算访问量的百分数,精确到小数后1位,小于零的在前面加字母0
				lsbf=(int)(int.Parse(strvallwidth.ToString())*1000/intsumallwidth)/10;

				strshow_width_data_msg+=lsbf+"%'>"+strthewidth+"</a>&nbsp;</td>";
				strshow_width_data_msg+="<td width='230' background='images/tu_back_2.gif' align=left>";
				strshow_width_data_msg+="<img style='BORDER-left: #000000 1px solid;' src='images/tu.gif'";
				strshow_width_data_msg+=" width='"+(int)(float.Parse(strvallwidth.ToString())/intmaxallwidth*183)+"' height='9' alt='"+strthewidth+",访问"+strvallwidth+"次,";
				strshow_width_data_msg+=lsbf+"%'> "+strvallwidth+"</td></tr>";

				j++;
				if(j>=40) break;

			}

			dv1.Dispose();

			return strshow_width_data_msg;

		}

		public string howsoft(string vsoft)
		{
			DataSet myds2 = new DataSet();
			DataView dv2=new DataView();
			myds2=counter.SQLConn.ExecuteSqlForDataSet("Select count(id) as howsoft from CounterView where vsoft='"+vsoft+"'");
			dv2=myds2.Tables[0].DefaultView;
			dv2.Table.AcceptChanges();
			if(dv2.Count>0)
			{	
				return dv2[0].Row["howsoft"].ToString();
			}
			else
			{
				dv2.Dispose();
				return "0";
			}
			
		}

		public string howOS(string vOS)
		{
			DataSet myds2 = new DataSet();
			DataView dv2=new DataView();
			myds2=counter.SQLConn.ExecuteSqlForDataSet("Select count(id) as howOS from CounterView where vOS='"+vOS+"'");
			dv2=myds2.Tables[0].DefaultView;
			dv2.Table.AcceptChanges();
			if(dv2.Count>0)
			{	
				return dv2[0].Row["howOS"].ToString();
			}
			else
			{
				dv2.Dispose();
				return "0";
			}
			
		}



		#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
	}
}

⌨️ 快捷键说明

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