PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2008 Problem with login system for my encrypter.-VBForums
Results 1 to 3 of 3

Thread: Problem with login system for my encrypter.

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    3

    Unhappy Problem with login system for my encrypter.

    Im having a bit of trouble with getting my login system to cooperate with my encrypter/decrypter. When I test out my program, I find that my login system is not doing its job and even if I type my information wrong on the login, it will still encrypt/decrypt my text.(from form1) Here is my code. Hopefully someone can tell me what im missing.
    vb.net Code:
    1. Public Class Form1
    2.     Dim DES As New System.Security.Cryptography.TripleDESCryptoServiceProvider
    3.     Dim Hash As New System.Security.Cryptography.MD5CryptoServiceProvider
    4.     Dim SecondForm As New LoginForm1
    5.  
    6.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    7.         SecondForm.Show()
    8.         Try
    9.             DES.Key = Hash.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text))
    10.             DES.Mode = Security.Cryptography.CipherMode.ECB
    11.             Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateEncryptor
    12.             Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox2.Text)
    13.             TextBox2.Text = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
    14.         Catch ex As Exception
    15.             MessageBox.Show("The following error(s) have occurred: " & ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
    16.         End Try
    17.     End Sub
    18.  
    19.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    20.         SecondForm.Show()
    21.         Try
    22.             DES.Key = Hash.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text))
    23.             DES.Mode = Security.Cryptography.CipherMode.ECB
    24.             Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateDecryptor
    25.             Dim Buffer As Byte() = Convert.FromBase64String(TextBox2.Text)
    26.             TextBox2.Text = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
    27.         Catch ex As Exception
    28.             MessageBox.Show("The following error(s) have occurred: " & ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
    29.         End Try
    30.     End Sub
    31. End Class
    Thanks In Advance.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Problem with login system for my encrypter.

    Where, in the code you posted, does it check for correct login information?

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    3

    Re: Problem with login system for my encrypter.

    Sorry. I wasnt sure which part to post. but here is the other part.

    vb.net Code:
    1. Public Class LoginForm1
    2.  
    3.     Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
    4.         If UsernameTextBox.Text = "Jbknight3" And PasswordTextBox.Text = "Jbknight4" Then
    5.             MsgBox("Access Granted", MsgBoxStyle.Critical, "Granted")
    6.         Else
    7.             MsgBox("Wrong Username And/or Password!", MsgBoxStyle.Critical, "")
    8.         End If
    9.         If UsernameTextBox.Text = "" And PasswordTextBox.Text = "" Then
    10.             MsgBox("Type Something!", MsgBoxStyle.Critical, "")
    11.         End If
    12.         Me.Close()
    13.     End Sub
    14.  
    15.     Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
    16.         Me.Close()
    17.     End Sub
    18. End Class
    Last edited by Jbknight3; Oct 21st, 2009 at 06:18 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width