PHP and. NET client information auto-generation _php Tutorials

Source: Internet
Author: User
Tags servervariables
I'm using a full-width, we're changing to half-width.
Not my original
Some of the learning tutorials are mostly simple introduction

. 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

http://www.bkjia.com/PHPjc/631977.html www.bkjia.com true http://www.bkjia.com/PHPjc/631977.html techarticle I use the full-width, we modify the half-angle is not my original and some of the learning tutorials are mostly simple introduction. NET version% @Page language=c# debug=true%% @Import namespace=system% ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.