<%
  ' Declaration variable
  dim FS, objFile
  dim curPath, tmpPath
  dim msg
  dim UserID, UserPWD, FIRTextData
  dim fUserID, fFIRSize, fFIRTextData
  dim payload, objUCBioBSP, objMatching
  
  UserID = Request.Form("UserID")
  FIRTextData = Request.Form("FIRTextData")
  
  ' Get current path
  tmpPath = Request.ServerVariables("PATH_TRANSLATED")
  curPath = left(tmpPath, InStrRev(tmpPath, "\")) & "FDB\"
  
  SET FS = Server.CreateObject("Scripting.FileSystemObject")
  
  ' Check file exist
  if not ( FS.FileExists(curPath & UserID & ".FDB") ) then
  	' File not found error
  	msg = "User not found! (UserID: " & UserID & ")"
  else
  	' Read fir data form file
  	SET objFile = FS.OpenTextFile(curPath & UserID & ".FDB", 1)
  	
  	' Read user id and fir data form file
  	fUserID			= objFile.ReadLine
  	fFIRSize		= objFile.ReadLine
  	fFIRTextData	= objFile.ReadLine
  	
  	objFile.Close
  	
  	' Match captured fir data with stored fir data
  	
  	' Set UCBioBSPCOM object
  	Set objUCBioBSP = Server.CreateObject("UCBioBSPCOM.UCBioBSP")
  	Set objMatching = objUCBioBSP.Matching
    
  	' Verify Match
  	call objMatching.VerifyMatch(CStr(FIRTextData), CStr(fFIRTextData))
    
  	if objUCBioBSP.ErrorCode = 0 then
    	if objMatching.MatchingResult = 0 then	' Matching failed. [0:FALSE,Others:TRUE]
  	    msg = "Verification failed!"
  	 	else	' Matching success
  	 		msg = "Verification success!"
  	  end if
  	else
  		msg = "Error! (" + objUCBioBSP.ErrorDescription + ")"
  	end if
  	
  	' Release UCBioBSPCOM object
  	Set objMatching = nothing
  	Set objUCBioBSP = nothing
  end if

  SET FS = nothing
%>

<html>

<body>

<center>
<hr>
<H2>Demo Page for Verification (Result)</H2>
<hr>

<br>

<b>User ID : <%= UserID %></b>

<br>
<br>
<br>

<font size=5 color=#000080><b><%= msg %></b></font>
<hr noshade width=300>

<br>

<br>
<input type=button OnClick="javascript:location.href='./default.asp';" value=" << Return to Home ">
<br>
<p>

<br>

<hr>
<font size=2>Copyright  2008. UNION COMMUNITY Co., Ltd.</font>
</center>

</body>
</html>
