用ServerVariables显示用户来访信息

servervariables集合,论坛里流行的显示自己IP和浏览器类型的签名就来自于这个强大的集合了。
代码如下:

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  6. <title>练习ServerVariables</title>
  7. <style type="text/css">
  8. <!--
  9. .css {
  10.     font-family: "宋体";
  11.     font-size: 12px;
  12.     line-height: 18px;
  13.     font-weight: bold;
  14.     color: #000066;
  15.     text-decoration: none;
  16.     padding-left: 10px;
  17.     border-top-width: 1px;
  18.     border-right-width: 1px;
  19.     border-left-width: 1px;
  20.     border-top-style: solid;
  21.     border-right-style: solid;
  22.     border-left-style: solid;
  23.     border-top-color: #3399FF;
  24.     border-right-color: #3399FF;
  25.     border-left-color: #3399FF;
  26. }
  27. .css1 {
  28.     font-family: "宋体";
  29.     font-size: 12px;
  30.     line-height: 18px;
  31.     color: #000000;
  32.     text-decoration: none;
  33.     padding-left: 10px;
  34.     border-right-width: 1px;
  35.     border-bottom-width: 1px;
  36.     border-left-width: 1px;
  37.     border-right-style: solid;
  38.     border-bottom-style: solid;
  39.     border-left-style: solid;
  40.     border-right-color: #3399FF;
  41.     border-bottom-color: #3399FF;
  42.     border-left-color: #3399FF;
  43. }
  44. -->
  45. </style>
  46. </head>
  47.  
  48. <body>
  49. <table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  50.   <tr>
  51.     <td height="25" background="images/1.gif" class="css">※用户来访信息※</td>
  52.   </tr>
  53.   <tr>
  54.     <td class="css1"><b>您的真实IP是:</b><%=request.ServerVariables("REMOTE_ADDR")%>,<b>浏览器:</b><%=request.ServerVariables("HTTP_USER_AGENT")%></td>
  55.   </tr>
  56. </table>
  57. </body>
  58. </html>

你可能会喜欢:

发表评论