' VB Script Document sub ShowErr(Msg) bErr = true 'sgBox Msg Document.Writeln "" Document.Writeln "

 

 

 

ERROR:" Document.Writeln "

 

" Document.Writeln Msg ocument.Writeln " failed, and returns 0x" & hex(Err.number) & ".
" Document.Writeln "

 

 

 

" Document.Writeln "
" End Sub function CheckKey() On Error Resume Next ePass.GetLibVersion 'Let detecte whether the ePass 1000ND Active Control loaded. 'If we call any method and the Err.number be set to &H1B6, it 'means the ePass 1000 Safe Active Control had not be loaded. If Err.number = &H1B6 Then MsgBox "USBKEY 驱动没有安装!" Exit function end if ePass.OpenDevice 1, "" If Err then MsgBox "请插入USBKEY !" document.Form1.epsKeyNum.value="Bad" ePass.CloseDevice CheckKey = false Exit function End if CheckKey = true End function function Write() On Error Resume Next If CheckKey() = false then Exit function End If ePass.DeleteFile 0,7990 If err then //MsgBox "删除失败" ePass.CloseDevice //Exit function End If ePass.CloseFile ePass.CloseDevice epsFileSize = 10 'Size of the file to create CreateUsbKey() WriteUsbKey() End function function CreateUsbKey() On Error Resume Next If CheckKey() = false then Exit function End If epsFileSize = 12 'Size of the file to create epsFileType = 2 'EPAS_FILETYPE_DATA epsFileReadAccess = 0 'EPAS_ACCESS_ANYONE epsFileWriteAccess = 0 'EPAS_ACCESS_ANYONE epsFileCryptAccess = 0 'EPAS_ACCESS_ANYONE ePass.CreateFile 0,7990,epsFileSize,epsFileType,epsFileReadAccess,epsFileWriteAccess, epsFileCryptAccess,2 If err then MsgBox "建立文件失败!" ePass.CloseDevice Exit function End If ePass.CloseFile ePass.CloseDevice End function function WriteUsbKey() On Error Resume Next If CheckKey() = false then Exit function End If ePass.OpenFile 2,7990 epsFileContent = BankID.value epsFileSize = 10 ePass.write 0,0,2,epsFileContent,epsFileSize If err then MsgBox "写入文件失败!" ePass.CloseDevice Exit function End If ePass.CloseFile ePass.CloseDevice MsgBox "写USBKey 成功" End function function ReadUsbKey() On Error Resume Next If CheckKey() = false then ReadUsbKey = false Exit function End If ePass.OpenFile 0,7990 strBankID = ePass.Read(0,0,2,10) USB.StrMid.value = strBankID ReadUsbKey = true End function function checkAdminUser1() if ReadUsbKey() then if(USB.userpwd1.value="") then msgbox "对不起你还没有输入密码" checkAdminUser1 = false else checkAdminUser1 = true end if else checkAdminUser1 = false end if End function