《2022年php版客户端信息自动生成源代码源码精华教程.docx》由会员分享,可在线阅读,更多相关《2022年php版客户端信息自动生成源代码源码精华教程.docx(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、2022年php版客户端信息自动生成源代码源码精华教程效果javascript:if(this.widthscreen.width-300)this.width=screen.width-300 border=0 alt=Click to Open in New Window调用:img代码:<%Page Language=C# Debug=true%><%Import namespace=System%><%Import namespace=System.Drawing%><%Import namespace=System.IO%><%s
2、tring sReferer=Request.ServerVariablesHTTP_REFERER;string sLanguage,sBrowser,sSys;if(Request.ServerVariablesHTTP_ACCEPT_LANGUAGE.IndexOf(zh-cn)>=0){ sLanguage=Chinese; }else{ sLanguage=Request.ServerVariablesHTTP_ACCEPT_LANGUAGE; }string aUserAgent=Request.ServerVariablesHTTP_
3、USER_AGENT.Split('');if(aUserAgent.Length>2){ sBrowser=aUserAgent1.Replace(MSIE,Internet Explorer).Trim(); if(sBrowser=U){ sBrowser=Mozilla; } sSys=aUserAgent2.Replace(),); sSys=sSys.Replace(NT 5.2,2022); sSys=sSys.Replace(NT 5.1,XP); sSys=sSys.Replace(NT 5.0,2000); sSys=sS
4、ys.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.DrawStri
5、ng(Your IP : + Request.ServerVariablesREMOTE_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(Co
6、urier 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.Image
7、Format.Gif);%><?php/处理要显示的相关信息if(!(strpos($_SERVERHTTP_ACCEPT_LANGUAGE,zh-cn)=false){ $sLanguage=Chinese; }else{ $sLanguage=$_SERVERHTTP_ACCEPT_LANGUAGE; }$aUserAgent=explode(;,$_SERVERHTTP_USER_AGENT);if(count($aUserAgent)>2){ $sBrow
8、ser=trim(str_replace(MSIE,Internet Explorer,$aUserAgent1); if(trim($sBrowser)=U){ $sBrowser=Mozilla; } $sSys=str_replace(),$aUserAgent2); $sSys=str_replace(NT 5.2,2022,$sSys); $sSys=str_replace(NT 5.1,XP,$sSys); $sSys=str_replace(NT 5.0,2000,$sSy
9、s); $sSys=trim(str_replace(9x,Me,$sSys); }else{ $sBrowser=Unknown; $sSys=Unknown; }header (Content-type: image/png);/定义图片宽高$nWidth=250;$nHeight=90;$im = imagecreate ($nWidth,$nHeight) or die (Cannot Initialize new GD image stream);/图片色调设置$backgr
10、ound_color = imagecolorallocate ($im, 235, 235, 240);$sColorRed = imagecolorallocate ($im, 200, 14, 91);$sColorBlack = imagecolorallocate ($im, 0, 0, 0);$sColorBlue = imagecolorallocate ($im, 0, 0, 255);$sColorGreen = imagecolorallocate ($im, 0, 160, 0);/绘制图片边框ima
11、gefilledrectangle($im, 0, 0, $nWidth - 1, $nHeight - 1, $background_color);imagerectangle($im, 0, 0, $nWidth - 1, $nHeight - 1, $sColorBlack);/生成图片文字imagestring ($im, 3, 6, 6, Your IP : . $_SERVERREMOTE_ADDR, $sColorRed);imagestring ($im, 3, 6, 26, Language : . $sLanguage, $sColorBlack);imagestring ($im, 3, 6, 46, Your OS : . $sSys, $sColorBlue);imagestring ($im, 3, 6, 66, Browser : . $sBrowser, $sColorGreen);/产生图片imagepng ($im);imagedestroy ($im);?>(出处: