منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : كيف اضع لمستخدم رساله في حال اسم المستخدم وكلمة المرور غير صيحه ؟؟
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
الاخوه الكرام
السلام عليكم ورحمة وبركاته
كيف اضع  لمستخدم رساله في حال اسم المستخدم وكلمة المرور غير صيحه ؟؟
نامل من الله المساعدة  في برنامجي المرفق والله يحفظكم ويرعاكم
 تحياتي[attachment=11443]
PHP كود :
Imports System.Data.OleDb
Imports System
.IO
Imports System
.Security.Cryptography
Imports System
.Text

Public Class Form1
    Dim con 
As New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=db1.mdb")

 
   Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button1.Click
        
'Dim db As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb")
        '
Dim rs As New OleDbDataAdapter()
 
       'Dim da As New OleDbDataAdapter("select * from noop Where Name='" & Trim(TextBox1.Text) & "' and pass='" & Trim(TextBox1.Text) & "' ", db)
        '
MsgBox("تم الدخول الى النظام")

 
       Using cm = New OleDbCommand(""con)
 
           cm.CommandText "select count(name) from noop where name=@name and pass=@pass"
 
           cm.Parameters.AddWithValue("@name"TextBox1.Text)
 
           cm.Parameters.AddWithValue("@pass"Encrypt(TextBox2.Text"thekey")) 'يجب ان تكون حفظ كلمة المرور باستخدام هذا التشفير
            If con.State = ConnectionState.Closed Then con.Open()
            If cm.ExecuteScalar <= 0 Then
                MsgBox("Nothing Found", MsgBoxStyle.Critical, "")
            Else
                MsgBox("Now Welcome Back", MsgBoxStyle.Information, "")
            End If
        End Using

    End Sub
    Public Function Encrypt(clearText As String, EncryptionKey As String) As String
        ' 
string EncryptionKey "abc123";
 
       Dim clearBytes As Byte() = Encoding.Unicode.GetBytes(clearText)
 
       Using encryptor As Aes Aes.Create()
 
           Dim pdb As New Rfc2898DeriveBytes(EncryptionKey, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D,
 
                   &H65, &H64, &H76, &H65, &H64, &H65,
 
                   &H76})
 
           encryptor.Key pdb.GetBytes(32)
 
           encryptor.IV pdb.GetBytes(16)
 
           Using ms As New MemoryStream()
 
               Using cs As New CryptoStream(msencryptor.CreateEncryptor(), CryptoStreamMode.Write)
 
                   cs.Write(clearBytes0clearBytes.Length)
 
                   cs.Close()
 
               End Using
                clearText 
Convert.ToBase64String(ms.ToArray())
 
           End Using
        End Using
        Return clearText
    End 
Function

 
   Private Sub Button2_Click(sender As ObjectAs EventArgsHandles Button2.Click
        Using cm 
= New OleDbCommand(""con)
 
           cm.CommandText "insert into noop(name,pass) values(@name,@pass)"
 
           cm.Parameters.AddWithValue("@name"TextBox1.Text)
 
           cm.Parameters.AddWithValue("@pass"Encrypt(TextBox2.Text"thekey")) 'يجب ان تكون حفظ كلمة المرور باستخدام هذا التشفير
            If con.State = ConnectionState.Closed Then con.Open()
            Try
                cm.ExecuteNonQuery()
                MsgBox("Saved!")
            Catch ex As Exception
                MsgBox(Err.Description, MsgBoxStyle.Critical, "")
            End Try
        End Using
    End Sub
End Class 
عدلت على المثال وهذا الكلاس