|
Server : Microsoft-IIS/10.0 System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586 User : jxgj ( 0) PHP Version : 7.0.33 Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server Directory : D:/tmp_aspnet/root/cae6aa2e/15328683/ |
?#pragma checksum "D:\wwwroot\anlian2025\wwwroot\qzkeyadmin\report\Get_ip.aspx.cs" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1C7FDA4FF52A3916A112DA8FCF1160FC9A0DA3F8"
#line 1 "D:\wwwroot\anlian2025\wwwroot\qzkeyadmin\report\Get_ip.aspx.cs"
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using WebApp.Components;
using System.Net;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using basic;
using System.Security.Cryptography;
using System.Net.NetworkInformation;
using System.Management;
public partial class Get_ip : System.Web.UI.Page
{
basic.BasicPage bp = new basic.BasicPage();
public string url = "";
protected void Page_Load(object sender, EventArgs e)
{
string ip = Request.UserHostAddress;
string putdate = DateTime.Now.ToString("yyyy-MM-dd");
string mac = Request.UserAgent;
string type = "pc";
if (CheckAgent())
{
type = "mb";
}
update_ip(mac,ip, putdate, type);
update_num(putdate);
}
public void update_ip(string mac,string ip,string putdate,string type)
{
SqlDataReader myreader = bp.getRead("select id from Tbreport_ip where ip='"+ip+"' and putdate='"+putdate+"' and Mac='"+ mac + "' and type='"+ type + "'");
if (myreader.Read())
{
}
else
{
url = Request.Form["url"];
string urlbeizhu = GetUrlbeizhu(url);
bp.doExecute("insert into Tbreport_ip values('" + ip + "','" + putdate + "','"+ mac + "','"+ type + "','" + url + "','" + urlbeizhu + "')");
}
myreader.Close();
}
public void update_num(string putdate)
{
SqlDataReader myreader = bp.getRead("select id from Tbreport_num where putdate='" + putdate + "'");
if (myreader.Read())
{
bp.doExecute("update tbreport_num set num=num+1");
}
else
{
bp.doExecute("insert into Tbreport_num values('1','" + putdate + "')");
}
myreader.Close();
}
public bool CheckAgent()
{
bool flag = false;
string agent = HttpContext.Current.Request.UserAgent;
string[] keywords = { "Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser" };
//排除 Windows 桌面系统
if (!agent.Contains("Windows NT") || (agent.Contains("Windows NT") && agent.Contains("compatible; MSIE 9.0;")))
{
//排除 苹果桌面系统
if (!agent.Contains("Windows NT") && !agent.Contains("Macintosh"))
{
foreach (string item in keywords)
{
if (agent.Contains(item))
{
flag = true;
break;
}
}
}
}
return flag;
}
public string GetUrlbeizhu(string url)
{
string content;
if (string.IsNullOrEmpty(url))
{
content = "直接接见网址";
}
else
{
try
{
if (url.Split('/').Length >= 4)
{
content = url.Split('/')[0] + "//" + url.Split('/')[2];
}
else
{
content = url;
}
}
catch (Exception ex) {
content = url;
}
}
return content;
}
}
#line default
#line hidden