here is the download
[attachment=3283:TB_Login_Form.zip]
Here is the code for people that don't download!
Also i am a noob! HEHEHE!
Imports System.Net Imports System.IOb Imports System.Text Public Class LoginForm1 Dim LoginStatus Dim Group Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Login() End Sub Public Sub Login() Try If UsernameTextBox.Text = "" Then MsgBox("Please enter a Username!", MsgBoxStyle.Exclamation, "Username:") Exit Sub End If If PasswordTextBox.Text = "" Then MsgBox("Please enter a Password!", MsgBoxStyle.Exclamation, "Password:") Exit Sub End If CheckLogin() If LoginStatus = "0" Then MsgBox("Invalid Username/Password" + Environment.NewLine + "Possible Server Timeout, Try Again Later", MsgBoxStyle.Information, "Login Failed!") UsernameTextBox.Text = "" PasswordTextBox.Text = "" Exit Sub ElseIf LoginStatus = "1" Then If Group = 8 Then ' Banned User Group Number MsgBox("If you was banned from the site what makes you think you can use programs made for the site", MsgBoxStyle.Critical, "Banned User") Application.Exit() Else ' Everyone Else Can Use The Program Form1.Show() Me.Close() End If Else MsgBox("There was an error while connecting. Please try again in a few minutes.", MsgBoxStyle.Critical, "Server Error") End If Catch ex As Exception End Try End Sub Public Sub CheckLogin() Try 'call our function to loginto the site and then return all its s*** as a stream Dim rssStream As System.IO.StreamReader = LoginSite(UsernameTextBox.Text, PasswordTextBox.Text) Dim rssDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument() 'load the stream as a XML file rssDoc.Load(rssStream) 'tell it what Main node to look under Dim rssItems As System.Xml.XmlNodeList = rssDoc.SelectNodes("User") Dim currentRssItem As System.Xml.XmlNode 'tells it to loop through and find all our data we want For Each currentRssItem In rssItems Dim rssDetail As System.Xml.XmlNode 'get if we are logged in or not a 0 is a Not logged in and a 1 is a logged in rssDetail = currentRssItem.SelectSingleNode("LoggedIn") If Not IsNothing(rssDetail) Then LoginStatus = rssDetail.InnerText Else LoginStatus = "0" End If 'Get the group ID rssDetail = currentRssItem.SelectSingleNode("Group") If Not IsNothing(rssDetail) Then Group = rssDetail.InnerText Else Group = "" End If 'Now that we have all our stuff lets put it into Labels so we can use it later Next Catch Err As Exception LoginStatus = "0" End Try End Sub Public Function LoginSite(ByVal username As String, ByVal pass As String) As Object Try Dim requestUriString As String = "http://www.teambinary.org/apps/authenticate/login.php" Dim request As HttpWebRequest = DirectCast(WebRequest.Create(requestUriString), HttpWebRequest) request.Method = "POST" request.ContentType = "application/x-www-form-urlencoded" Dim computerName As String = SystemInformation.ComputerName Dim textArray3 As String() = New String() {"username=" & username & "&" & "password=" & pass} Dim text2 As String = String.Concat(textArray3) Dim encoding1 As New System.Text.ASCIIEncoding Dim buffer1 As Byte() = encoding1.GetBytes(text2) Dim stream1 As IO.Stream = request.GetRequestStream stream1.Write(buffer1, 0, buffer1.Length) stream1.Close() Dim response1 As Net.HttpWebResponse = CType(request.GetResponse, Net.HttpWebResponse) Dim reader1 As New IO.StreamReader(response1.GetResponseStream) Return reader1 Catch exception1 As WebException End Try End Function Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click Me.Close() End Sub Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class
Edited by egworld, 22 December 2008 - 09:06 PM.