Home  >  Article  >  Backend Development  >  PHP and .NET version client information is automatically generated_PHP tutorial

PHP and .NET version client information is automatically generated_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:58:53703browse

I use full-width, please change it to half-width
Not original by me
Most of them have simple introductions in some learning tutorials

.NET version


<%@Page Language="C#" Debug="true"%>
<%@Import namespace="System"%>
<%@Import namespace="System.Drawing"%>
<%@Import namespace="System.IO"%>
<%
string sReferer=Request.ServerVariables["HTTP_REFERER"];
string sLanguage,sBrowser,sSys;
if(Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"].IndexOf("zh-cn")>=0){
sLanguage="Chinese";
}
else
{
sLanguage=Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"];
}
string[] aUserAgent=Request.ServerVariables["HTTP_USER_AGENT"].Split(’;’);
if(aUserAgent.Length>2){
sBrowser=aUserAgent[1].Replace("MSIE","Internet Explorer").Trim();
if(sBrowser=="U"){
sBrowser="Mozilla";
}
sSys=aUserAgent[2].Replace(")","");
sSys=sSys.Replace("NT 5.2","2003");
sSys=sSys.Replace("NT 5.1","XP");
sSys=sSys.Replace("NT 5.0","2000");
sSys=sSys.Replace("9x","Me").Trim();
}
else
{
sBrowser="Unknown";
sSys="Unknown";
}
int nWidth=260,nHeight=90;
Bitmap image=new Bitmap(nWidth,nHeight);
Graphics g=Graphics.FromImage(image);
Stream imgData=new MemoryStream();
g.Clear(Color.Snow);
g.DrawRectangle(Pens.Black,0,0,nWidth-1,nHeight-1) ;
g.DrawString("Your IP : " Request.ServerVariables["REMOTE_ADDR"],new Font("Courier New", 9,FontStyle.Bold),new SolidBrush(Color.FromArgb(200, 14, 91)),6, 6);
g.DrawString("Language : " sLanguage,new Font("Courier New", 9,FontStyle.Bold),new SolidBrush(Color.FromArgb(0, 0, 0)),6,26);
g.DrawString("Your OS : " sSys,new Font("Courier New", 9,FontStyle.Bold),new SolidBrush(Color.FromArgb(0,0,255)),6,46);
g.DrawString("Browser : " sBrowser,new Font("Courier New", 9,FontStyle.Bold),new SolidBrush(Color.FromArgb(0, 160, 0)),6,66);
g.Dispose();
Response.ContentType="image/gif";
image.Save(Response.OutputStream ,System.Drawing.Imaging.ImageFormat.Gif);
%>
PHP version

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631977.htmlTechArticleI am using full-width, everyone changed it to half-width. It is not my original creation. Most of the learning tutorials have a brief introduction to .NET. Version %@Page Language=C# Debug=true% %@Import namespace=System%...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn