3333

Part 1
First nating gagawin sympre iopen ang VB6 hehehe wala kang VB6? eto o portable... VB6 portable or Visual Basic 6.0 Professional Edition
then pag open na... maglagay tayo ng dalawang textbox at isang command button
para saan ang dalawang textbox at command button?
eto dapat ang nakalagay sa mga properties nila

textbox1 (Name) = username <---- para sa username natin
textbox2 (Name) = password<---- para sa password natin
command button (Name) = save (caption) = save <--- para sa save button natin

kapag nalagay na natin lahat yan sa kanya kanya nilang properties double click natin yung save button
para malagyan na natin ng code....

Private Sub save_Click()
Open App.Path & ("\data" + "/" + Account + "Account.txt") For Output As #1
Print #1, username.text
Print #1, password.text
Close #1
MsgBox "Saved", vbQuestion, "S-vpn"
End Sub

ayan tapos na yata tayo sa account ^_^ pasensya na kung medyo magulo or hindi nyo maintindihan...

Part 2 para sa logs at connect naman tayo

gawa ulit tayo ng isang Timer, isang textbox at isang command button ulit ^_^ yung timer ilagay nyo na lang sa isang gilid kasi hindi naman makikita yan...
para saan ito?

Timer (Name) = log_Timer (Enabled) = False (Interval) = 250 <---- yan ang magbabasa ng status ng openvpn natin at mag rerefresh sa textbox3 natin
textbox3 (Name) = logs <---- para sa logs yan
command button (Name) = connect (capton) = Connect <---- para naman sa connect buttong natin

kapag nalagay na ulit natin lahat yan sa kanya kanya nilang properties double click naman po natin yung connect button
para malagyan ulit natin ng code

Private Sub connect_Click()
Shell App.Path & "\bin\openvpn --tls-client --client --dev tun --remote x.x.x.x --proto udp --port 9200 --lport 53 --persist-key --persist-tun --ca data\ca.crt --comp-lzo --mute 3 --tun-mtu 1500 --auth-user-pass data\account.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --route-delay 2 --verb 3 --log data\log.txt --status data\stat.db 1", vbHide
End Sub

pagkatapos na kayo sa connect button eto naman po para sa timer natin

Private Sub log_Timer_Timer()
Dim line(10000) As String
Dim log_ctr As Integer
Open App.Path & "\data\log.txt" For Input Lock Read As #1
Do Until EOF(1)
Line Input #1, line(log_ctr)
log_ctr = log_ctr + 1
Loop
Close #1
If last_log <> log_ctr Then
For n = last_log To log_ctr - 1
Text1.SelStart = Len(Text1.Text)
Text1.SelText = line(n) & vbCrLf
End if
Next
last_log = log_ctr
End If
End Sub


yan tapos na tayo ^_^ may account login na at may logs and connect button na..

paano po yung sa Globe or Smart?

Part 3 para sa globe or smart option ^_^

gawa tayo ng 2 option button
para saan na naman toh?

option1 = (Name) = Smart (Caption) = Smart
option2 = (Name) = Globe (Caption) = Globe

kapag nalagay na ulit natin lahat yan sa kanya kanya nilang properties double click naman po natin yung option1 button (smart)
para malagyan ulit natin ng code


Private Sub Smart_Click()
netw = smart.Caption
smart.Caption = "Smart"
End Sub

Private Sub Globe_Click()
netw = smart.Caption
smart.Caption = "Globe"
End Sub

then pakilagay ito sa pinakaitaas ng form code nyo

Dim netw As String

pag nailagay nyo na yan balik na tayo sa connect button double click nyo ulit para mapunta sa code nya.

tapos ayusin natin yung code nya kasi nagdagdag tayo ng option

Private Sub connect_Click()
If netw = "Smart" then
Shell App.Path & "\bin\openvpn --tls-client --client --dev tun --remote x.x.x.x --proto udp --port 9200 --persist-key --persist-tun --ca data\ca.crt --comp-lzo --mute 3 --tun-mtu 1500 --auth-user-pass data\account.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --route-delay 2 --verb 3 --log data\log.txt --status data\stat.db 1", vbHide
End If

If netw = "Globe" then
Shell App.Path & "\bin\openvpn --tls-client --client --dev tun --remote x.x.x.x --proto udp --port 9200 --lport 53 --persist-key --persist-tun --ca data\ca.crt --comp-lzo --mute 3 --tun-mtu 1500 --auth-user-pass data\account.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --route-delay 2 --verb 3 --log data\log.txt --status data\stat.db 1", vbHide
End If

End Sub
o ayan tapos na tayo sa part 3 natin ^_^ 

ano pa ba?

paano kung dalawa or madami ang server nyo? 

madali na lang din yan ^_^ eto sa part 4

Part 4 Server selection

gawa po tayo ng isang combo box
paano po ang gagawin sa combo box?

combo box (Name) = server (Enabled) = False
then paki delete yung nasa text nya.

then 
sa form load natin ilagay natin ito

Server.AddItem ("Server-1")
Server.AddItem ("Server-2")

bali magiging ganito ang form load nyo

Private Sub Form_Load()
Server.AddItem ("Server-1")
Server.AddItem ("Server-2")
End Sub

then balik tayo sa Smart option and globe option then
burahin nyo na yung netw = smart.caption na nilagay natin then dagdagan natin ng server.Enabled = true

Private Sub Smart_Click()
smart.Caption = "Smart"
server.Enabled = True
End Sub

Private Sub Globe_Click()
smart.Caption = "Globe"
server.Enabled = True
End Sub

tapos double click nyo yung combo box na ginawa natin and dito natin ilagay yung netw =smart.Caption + server.Text

Private Sub Server_Click()
netw = smart.Caption + server.Text
End Sub

then dun na ulit tayo sa connect mag babago... 

Private Sub connect_Click()
If netw = "SmartServer-1" then 
Shell App.Path & "\bin\openvpn --tls-client --client --dev tun --remote x.x.x.x --proto udp --port 9200 --persist-key --persist-tun --ca data\ca.crt --comp-lzo --mute 3 --tun-mtu 1500 --auth-user-pass data\account.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --route-delay 2 --verb 3 --log data\log.txt --status data\stat.db 1", vbHide
End If

If netw = "GlobeServer-1" then
Shell App.Path & "\bin\openvpn --tls-client --client --dev tun --remote x.x.x.x --proto udp --port 9200 --lport 53 --persist-key --persist-tun --ca data\ca.crt --comp-lzo --mute 3 --tun-mtu 1500 --auth-user-pass data\account.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --route-delay 2 --verb 3 --log data\log.txt --status data\stat.db 1", vbHide
End If

If netw = "SmartServer-2" then
Shell App.Path & "\bin\openvpn --tls-client --client --dev tun --remote x.x.x.x --proto udp --port 9200 --persist-key --persist-tun --ca data\ca.crt --comp-lzo --mute 3 --tun-mtu 1500 --auth-user-pass data\account.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --route-delay 2 --verb 3 --log data\log.txt --status data\stat.db 1", vbHide
End If

If netw = "GlobeServer-2" then
Shell App.Path & "\bin\openvpn --tls-client --client --dev tun --remote x.x.x.x --proto udp --port 9200 --lport 53 --persist-key --persist-tun --ca data\ca.crt --comp-lzo --mute 3 --tun-mtu 1500 --auth-user-pass data\account.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --route-delay 2 --verb 3 --log data\log.txt --status data\stat.db 1", vbHide
End If

End Sub
O tapos na ba tayo? may nakalimutan pa ba ako?

ahh Screen shot... wait eto na isusunod ko na..

VIDEO TUTORIAL


Thanks to:
Kaz
gnod1
mp3sniff
ggmreg
shadow046
soure: SYMB

0 comments Blogger 0 Facebook

Post a Comment

 
Blog your needs © 2013. All Rights Reserved. Share on Ads Network Reviews. Powered by Blogger
Top