HWID LOGIN help
Hey guys I have just started with VB 2008 and found some tuts and made this
This is basicly making a hwid login system for what I want to be some sort of another program. I want to make it so the other program is in the same folder but cant be opened unless opened though this system.
I know how to make it open the program on login succesful but im not sure how to make it so the program cant be opened without logging in first.
I would love to learn so any help would be lovely!
Code:
Imports System.IO
Imports System.Management
Imports System.Net
'imports
Public Class Form1
'string used to store the HWID
Dim HWID As String = ""
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'sets the form text to the current HWID
Me.Text = "HWID: " & getHWID()
End Sub
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
'checkLogin() returns a boolean/this checks if login worked or failed
'it passes the username and password to the function
Select Case checkLogin(txtLogin.Text, txtPass.Text)
Case True
MessageBox.Show("Login Successful")
Try
Process.Start("C:\Nexon\Combat Arms\CombatArms.exe\")
Close()
Catch ex As Exception
End Try
Case False
MessageBox.Show("Login Failed")
Dim webAddress As String = "http://www.nexon.net"
Process.Start(webAddress)
Close()
End Select
End Sub
Private Function getHWID()
'not going to explain this, in short it grabs
'the HWID from the system you are on
Dim mc As New ManagementClass("win32_processor")
Dim moc As ManagementObjectCollection = mc.GetInstances()
For Each mo As ManagementObject In moc
If HWID = "" Then
HWID = mo.Properties("processorID").Value.ToString()
Exit For
End If
Next
Return HWID
End Function
Private Function checkLogin(ByVal sUser As String, ByVal sPass As String) As Boolean
'this array reads HWID|user|pass from the txt file
Dim login As String()
'I used HttpWebRequest to loop through each line indvidually
'I figured it would be easier that using WebClient
'HttpWebRequest.Create("") opens our text file
'Replace your the URL with the URL path to your txt
Dim wr As HttpWebRequest = HttpWebRequest.Create("http://*************.com/HWID.txt")
'HttpWebResponse downloads the txt as a stream
Dim response As HttpWebResponse = wr.GetResponse()
'StreamReader reads the stream
Dim sr As StreamReader = New StreamReader(response.GetResponseStream())
'this loop goes through each line of the stream and checks
'the HWID and login information
While Not sr.EndOfStream
'inside the txt, each lines reads HWID|user|pass
'this is split up into the array like so
'login(0) = HWID, login(1) = user, login(2) = pass
login = sr.ReadLine.Split("|")
'checks the login information
If login(0) = HWID Then
If sUser = login(1) Then
If sPass = login(2) Then
'if all three are correct the function returns true
Return True
End If
End If
End If
End While
'if none worked, it returns false
Return False
End Function
End Class
I know how to make it open the program on login succesful but im not sure how to make it so the program cant be opened without logging in first.
I would love to learn so any help would be lovely!


