2014-09-25, 12:35 AM
ياخي انت انسان كلك بركة والله توصلت للحل
شوف الدالة معروفة لكن طريقة استخدامها مع كود الحفظ للجدول هو الاشكال اللي ملعوزني كل اليوم..
الدالة هي:
الاستخدام كالتالي
والحفظ للجدول كالتالي:
هذا لعل احد يستفيد منه
النقطة المتبقية هي كيفية تحويل التشفير القديم لجديد
شوف الدالة معروفة لكن طريقة استخدامها مع كود الحفظ للجدول هو الاشكال اللي ملعوزني كل اليوم..
الدالة هي:
كود :
Private Function getMD5Hash(ByVal strToHash As String) As String
Dim md5Obj As New System.Security.Cryptography.MD5CryptoServiceProvider()
Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash)
bytesToHash = md5Obj.ComputeHash(bytesToHash)
Dim strResult As String = ""
Dim b As Byte
For Each b In bytesToHash
strResult += b.ToString("x2")
Next
Return strResult
End Function
كود :
txtpassword.Text = getMD5Hash(plaintxt.Text).Trim
والحفظ للجدول كالتالي:
كود :
Dim s As New MySqlCommand("update mybb_users set salt=@salt,password=@password where uid=@uid", con)
s.Parameters.AddWithValue("@salt", "")
s.Parameters.AddWithValue("@password", txtpassword.Text)
s.Parameters.AddWithValue("@uid", uid.Text)
If con.State = ConnectionState.Closed Then
con.Open()
End If
Try
s.ExecuteNonQuery()
MsgBox("Done!", MsgBoxStyle.Information, "")
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Critical, "")
End Try
هذا لعل احد يستفيد منه
النقطة المتبقية هي كيفية تحويل التشفير القديم لجديد