PHP Code:
Option Explicit
Dim intCnt 
As Integer
Dim intSer 
As String
Dim s 
As String
Dim capZ 
As String



Private Sub Command1_Click()
Dim i&, j%, port&, baud&, buf1(200) As Byteb1 As Bytes1$
port cb_ckh.ListIndex 1
If (port 0Then
    lb_info
.Caption "Please select COM Port!"
End If
baud CLng(cb_btl.Text)
If (
baud 0Then
    lb_info
.Caption "Please select Baud rate!"
End If
'Open Port
i = rf_init_com(port, baud)
If (i <> 0) Then
    lb_info.Caption = "Open Port Fail!"
    Exit Sub
End If
'
Request
rf_request(0, &H52j)
If (
<> 0Then
    lb_info
.Caption "Request Fail!"
    
Exit Sub
End 
If
'Anticollision
i = rf_anticoll(0, 4, buf1(0), b1)
If (i <> 0) Then
    lb_info.Caption = "Anticollision Fail!"
    Exit Sub
End If
s1 = ""
For i = 0 To b1 - 1
    s1 = s1 & Right("00" & Hex(buf1(i)), 2)
Next i
tx_kh.Text = s1
'
Select card
rf_select(0buf1(0), 4b1)
If (
<> 0Then
    lb_info
.Caption "Select card fail!"
    
Exit Sub
ElseIf (intSer s1Then
    lb_info
.Caption "Same Card"
    
Exit Sub
End 
If
lb_info.Caption "Select card succeed!"
intSer s1
Call Command2_Click
End Sub

Private Sub Command2_Click()
Dim i&, m&, buf1(200) As Bytebuf2(200) As Bytes1$, b1 As Byteb2 As Byteb3 As Byte
s1 
Trim(tx_key.Text)
If (
Len(s1) <> 12Then
    lb_info
.Caption "Wrong Key Length!"
    
tx_key.SetFocus
    
Exit Sub
End 
If
For 
0 To 5
    buf1
(i) = Val("&H" Mid(s112))
Next i
cb_kh.ListIndex
If (= -1Then
    lb_info
.Caption "Select Block Please!"
    
Exit Sub
End 
If
If (
op_a.ValueThen
   b1 
= &H60
End 
If
If (
op_b.ValueThen
   b1 
= &H61
End 
If
b3 CByte(m)
'Authentication
i = rf_M1_authentication2(0, b1, b3, buf1(0))
If (i <> 0) Then
    lb_info.Caption = "Authentication Fail£¡"
    Exit Sub
End If
'
Read card
rf_M1_read(0b3buf2(0), b2)
If (
<> 0Then
    lb_info
.Caption "Read Card Fail!"
    
Exit Sub
End 
If

s1 ""
For 0 To b2 1
    s1 
s1 Right("00" Hex(buf2(i)), 2)
Next i
tx_sj
.Text s1
lb_info
.Caption "Read Succeed!"
If (s1 "00000000000000000000000000000001"Then
    lb_info
.Caption "Numero Uno"
    
"Personality One"
    
For 9 To 1 Step -1
          Form1
.ColorPct(i).Picture Form1.ColorPct(1).Picture
          
      Next i
      Form1
.ColorPct(0).Picture LoadPicture("grape.jpg")
      
ElseIf (
s1 "00000000000000000000000000000002"Then
    lb_info
.Caption "Numero Dos"
    
"Personality Two"
    
For 9 To 1 Step -1
          Form1
.ColorPct(i).Picture Form1.ColorPct(1).Picture
          
      Next i
      Form1
.ColorPct(0).Picture LoadPicture("introspective.jpg")
      
      
    Exit 
Sub
End 
If
End Sub

Private Sub Command3_Click()
Dim i&, m&, buf1(200) As Bytebuf2(200) As Bytes1$, b1 As Byteb2 As Byteb3 As Byte
s1 
Trim(tx_key.Text)
If (
Len(s1) <> 12Then
    lb_info
.Caption "Wrong Key Length!"
    
tx_key.SetFocus
    
Exit Sub
End 
If
For 
0 To 5
    buf1
(i) = Val("&H" Mid(s112))
Next i
cb_kh.ListIndex
If (= -1Then
    lb_info
.Caption "Select Block Please!"
    
Exit Sub
End 
If
If (
op_a.ValueThen
   b1 
= &H60
End 
If
If (
op_b.ValueThen
   b1 
= &H61
End 
If

s1 Trim(tx_sj.Text)
If (
Len(s1) <> 32Then
    lb_info
.Caption "Wrong Data length "
    
tx_sj.SetFocus
    
Exit Sub
End 
If
For 
0 To 15
    buf2
(i) = Val("&H" Mid(s112))
Next i
'Authentication
b3 = CByte(m)
i = rf_M1_authentication2(0, b1, b3, buf1(0))
If (i <> 0) Then
    lb_info.Caption = "Authentication Fail!"
    Exit Sub
End If
'
Write card
rf_M1_write(0b3buf2(0))
If (
<> 0Then
    lb_info
.Caption "Write Card Fail£¡"
    
Exit Sub
End 
If

lb_info.Caption "Write Succeed!"
End Sub

Private Sub Command4_Click()
Dim i&
rf_halt(0)
If (
<> 0Then
    lb_info
.Caption "Halt Fail!"
    
Exit Sub
End 
If
lb_info.Caption "Halt Succeed"
End Sub

Private Sub Command5_Click()
Form1.Show
End Sub

Private Sub Form_Load()
Dim i&
Timer1.Interval ' Add these 3 lines of code where ever you want timer to start calling the function
Timer1.Enabled = True
s = "Now is the time for all good men to come to the aid of their country  "
Timer2.Interval = 300
Timer2.Enabled = True
intCnt = 1
For i = 0 To 63
    cb_kh.AddItem CStr(i), i
Next i
cb_ckh.ListIndex = 0: cb_btl.ListIndex = 1: cb_kh.ListIndex = 4
End Sub

Private Sub Timer1_Timer()
If intCnt = 60 Then
Call Command1_Click
intCnt = 1
Else
intCnt = intCnt + 1
End If
End Sub

Private Sub Timer2_Timer()
Dim n As Integer
Static t As String
Static ndx As Integer
If Len(t) = 0 Then t = Space$(20)
n = Len(s)
ndx = (ndx Mod n) + 1
Mid$(t, 1, 19) = Mid$(t, 2, 19)
Mid$(t, 20, 1) = Mid$(s, ndx, 1)

End Sub