Page 1 of 1

Advanced Login System

Posted: Sat Oct 24, 2009 8:20 pm
by MasterCoding
He guys
today i gonna show you guys how to make a advanced login system

whe need 3 forms

What whe need in form1 is

2 labels: label1 = username label2= password
2 textboxes: 1 is for username 2 for password
3 buttons: button1 = login button2 = create a user button 3 = exit


this is the hole code for form1:
Code: Select all
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then
            MsgBox("ERROR,YOU NEED AT LEAST ONE LETTER", MsgBoxStyle.Critical)
        Else
            If My.Computer.FileSystem.DirectoryExists(" C:\ACCOUNTS\" + TextBox1.Text + "\") Then
                Dim USERREAD As System.IO.StreamReader = New System.IO.StreamReader("C:\ACCOUNTS\" + TextBox1.Text + "\" + "USERNAME.TXT")
                Dim userline As String
                Dim PASSREAD As System.IO.StreamReader = New System.IO.StreamReader("C:\ACCOUNTS\" + TextBox1.Text + "\" + "PASSWORD.TXT")
                Dim PASSLINE As String
                Do
                    PASSLINE = TextBox2.Text
                    userline = USERREAD.ReadLine
                    Console.WriteLine(PASSLINE)
                    Console.WriteLine(userline)
                Loop Until userline Is Nothing
                If TextBox2.Text = "" Then
                    MsgBox("error,PLEASE INPUT A PASSWORD", MsgBoxStyle.Critical)
                Else
                    If PASSLINE = PASSREAD.ReadLine() = True Then
                        MsgBox("Youre Logd in " + TextBox1.Text)
                        Form3.show()
                    End If
                End If
            Else
                MsgBox("THE USERNAME DONT EXIT", MsgBoxStyle.Critical)
            End If
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Form2.show()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Close()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
what whe need for form2 is:

2 labels: label 1 for username label 2for password
2 textboxes: 1 is for username 2 for password
1 button: Creates the user

the hole code for form2:
Code: Select all
Public Class Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If My.Computer.FileSystem.DirectoryExists(" C:\ACCOUNTS\") = True Then
        Else
        End If

        If TextBox1.Text = "" Then
            MsgBox("ERROR,YOUR ACCOUNT MUST HAVE ONE LETTER IN IT", MsgBoxStyle.Critical)
        Else
        End If

        If TextBox2.Text = "" Then
            MsgBox("ERROR,PLEASE INSERT A PASSWORD", MsgBoxStyle.Critical)
        Else
            MkDir("C:\ACCOUNTS\" + TextBox1.Text)
            Dim username As New System.IO.StreamWriter("C:\ACCOUNTS\" + TextBox1.Text + "\" + "username.txt")
            username.Write(TextBox1.Text)
            username.Close()
            Dim password As New System.IO.StreamWriter("C:\ACCOUNTS\" + TextBox1.Text + "\" + "password.txt")
            password.Write(TextBox2.Text)
            password.Close()
            MsgBox("ACCOUNT CREATED", MsgBoxStyle.Information, "ACCOUNT CREATED")
            Me.Hide()
            Form1.Show()
        End If
    End Sub
End Class
And Form3
is just your one that is gonna show if your logd in

Re: Advanced Login System

Posted: Sun Oct 25, 2009 10:22 am
by hungryhounduk
Hi
I like it, Simple but very effective, great stuff

Chris

Re: Advanced Login System

Posted: Sun Oct 25, 2009 2:07 pm
by CodenStuff
Hello,

Thats very good, MasterCoding ;) excellent!.

Keep up the good work cooll;

Re: Advanced Login System

Posted: Sun Oct 25, 2009 2:11 pm
by Nery
You forgot to explain what this consists in so here's the explanation:
This Advanced Login System contains the very common Login stuff but also contains an example of a registration form which is very useful, with a login form you'll need a registration form for sure!
The first form (Form1) is the login form, where you enter your details to login with an existing account.
The Second form (Form2) is the register form, where you can create a new user for later use in the login form.
The Thrid form (Form3) is just the form that confirms if you're logged in or not (It's some kind of example)

Re: Advanced Login System

Posted: Sat Oct 31, 2009 12:53 am
by GoodGuy17
thanks do you mind if I use this in my vos?

Re: Advanced Login System

Posted: Sat Oct 31, 2009 6:54 am
by MasterCoding
GoodGuy17 wrote:
thanks do you mind if I use this in my vos?


You may use this always

Re: Advanced Login System

Posted: Thu Nov 12, 2009 9:40 pm
by jimnortin
Sometimes... you shouldn't trust those who put "hole" instead of "whole" multiple times... I don't blame you if you're forien though.

Re: Advanced Login System

Posted: Tue Dec 15, 2009 3:10 pm
by AleRi8
Thanks