Advanced Login System

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
8 posts Page 1 of 1
Contributors
User avatar
MasterCoding
Top Poster
Top Poster
Posts: 156
Joined: Sat Oct 24, 2009 4:26 pm

Advanced Login System
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
You do not have the required permissions to view the files attached to this post.
User avatar
hungryhounduk
VIP - Site Partner
VIP - Site Partner
Posts: 2870
Joined: Mon Jul 27, 2009 11:58 am

Re: Advanced Login System
hungryhounduk
Hi
I like it, Simple but very effective, great stuff

Chris
Image
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

Re: Advanced Login System
CodenStuff
Hello,

Thats very good, MasterCoding ;) excellent!.

Keep up the good work cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Nery
Co-Admin Moderator
Co-Admin Moderator
Posts: 1117
Joined: Mon Sep 07, 2009 8:11 pm

Re: Advanced Login System
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)
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Re: Advanced Login System
GoodGuy17
thanks do you mind if I use this in my vos?
User avatar
MasterCoding
Top Poster
Top Poster
Posts: 156
Joined: Sat Oct 24, 2009 4:26 pm

Re: Advanced Login System
MasterCoding
GoodGuy17 wrote:
thanks do you mind if I use this in my vos?


You may use this always
User avatar
jimnortin
Just Registered
Just Registered
Posts: 1
Joined: Thu Nov 12, 2009 8:59 pm

Re: Advanced Login System
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.
User avatar
AleRi8
Top Poster
Top Poster
Posts: 153
Joined: Sun Sep 20, 2009 2:30 pm

Re: Advanced Login System
AleRi8
Thanks
check out my software
win7 itweaker basic £4.50
viewtopic.php?f=70&t=793
8 posts Page 1 of 1
Return to “Tutorials”