zoukankan      html  css  js  c++  java
  • 实现获取客户端的MAC地址(2)

    第三种方案,把第二种做为一个文件让用户下载,再让用户打开(变为本地),这时安全性原则就变了。然后再提交。
    文件一:a.asp
    <%@ language="VBScript" %>
    <% Response.ContentType="application/download" %>
    <% Response.AddHeader "Content-Disposition", "attachment;filename=A.HTM" %>
    <html>
    <head>
     <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <form method="post" id="form1" action="http://192.168.21.75/Get/b.asp">
    <input type="text" name="XM" /><br />
    <textarea id="RR" name="RR" cols="80" rows="5"></textarea>
    <input type="button" id="ButUp" value="上传" onclick="ButUp_Click();" />
    <script language="javascript">
      WshShell = new ActiveXObject("Wscript.Shell")
      WshShell.Run ("cmd.exe /c ipconfig /all >c:\\1.txt")

      var ForReading = 1;
      fso = new ActiveXObject("Scripting.FileSystemObject");
      ts = fso.OpenTextFile("c:\\1.txt", ForReading);
      document.getElementById("RR").value = ts.ReadAll().replace(/\r\n/g, "");

      function ButUp_Click()
      {
        form1.submit();
      }
    </script>
    </form>
    </body>
    </html>
    前面三句的目的是让网页打开时,弹出的是下载HTM文件的对话框,如果使用<a href="A.htm">下载</a>的方式进行,则是会打开网页。
    提交时,把信息转给b.asp
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <html>
    <head>
        <title></title>
     <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <%
    dim Conn, ConnStr
    Set Conn=Server.CreateObject("ADODB.Connection")
    ConnStr = "Driver={SQL Server};Server=192.168.0.8\srv1;UID=sa;PWD=301-zxb;database=fpMis"
    Conn.Open ConnStr

    dim sql
    sql="insert into U01DNZL(XM, RQSJ, RR) " & _
        "values('" & Request("XM") & "', " & _
        "convert(char(19), getdate(), 25), " & _
        "'" & Request("RR") & "')"
    Conn.Execute(sql)
    Conn.close
     %>
     <font color="red">您的信息已提交成功!</font>
    </body>
    </html>

    要说明的点是:这里使用asp,并且是vbScript的,因为我有一个功能调不来:即一个网页提交到另一个网页,另一个网页要用什么才能得到前一个网页的内容
    另一点,a.asp中的输入框元素有用name,这样才能被b.asp抓到

    现在说一下这种方案的问题:操作要小心翼翼,打开网页,问我们要保存还是打开,选择打开就完了。保存后,然后再去找这个文件打开,才能正常操作。
    它还是依靠本地的安全性要设低一些才能,否则与因特网上的一样。
    不过,如果配合提示信息,把本地安全性降低还说得过去。
    window.onerror=function(err)
    {
     if(err.indexOf("utomation")!=-1)
     {
      alert("请更改你的IE的安全级别:开始->设置->控制面板->Internet选项->安全->自定义级别->对没有标记为安全的ActiveX控件进行初始化和脚本运行->启用");
      return true;
     }
     else
      return false;
    };

  • 相关阅读:
    获取Mac地址
    GbkToUtf8 Utf8ToGbk PackHttp
    first Automation
    win32 Dll 中添加afx.h 出现如下错误 error LNK2005: _DllMain@12 already defined
    OpenSUSE 开启SSH 和网络设置
    systemctl命令用法详解
    浅谈Python的列表和链表
    用Python实现最大堆
    写一个解二阶魔方的程序
    暴力破解SixPack问题
  • 原文地址:https://www.cnblogs.com/yzx99/p/1385550.html
Copyright © 2011-2022 走看看