Jun 18, 2014 Replies: 1 Here is a small example of a login screen that if successful will load the main form. Might not be perfect. But is a good start for someone. Uses a MySQL database. Attachments LoginExample.zip LoginExample.zip 7.1 KB · Views: 1,074 Click to expand...
Here is a small example of a login screen that if successful will load the main form. Might not be perfect. But is a good start for someone. Uses a MySQL database.
ivan.tellez Active Member Licensed User Longtime User Jun 30, 2014 #2 Hi, thanks for sharing. I think this is the worst aproach for making a login, because you are requesting the actual password from the database. This is really unsafe, and it can be sniffed ot of the network. Instead of: Code: Dim RS As ResultSet = MySQL.SQLCon.ExecQuery("SELECT * FROM users WHERE T_username = '" & UserNameToCheck & "';") Its easier and safer something like this: Code: Dim RS As ResultSet = MySQL.SQLCon.ExecQuery("SELECT * FROM users WHERE T_username = '" & UserNameToCheck & "' AND T_password = '" & PasswordToCheck & "';") If you get no records, the password and/or the username are wrong. Also consider avoiding storing passwords as plain text. you can use a hash function to store them.
Hi, thanks for sharing. I think this is the worst aproach for making a login, because you are requesting the actual password from the database. This is really unsafe, and it can be sniffed ot of the network. Instead of: Code: Dim RS As ResultSet = MySQL.SQLCon.ExecQuery("SELECT * FROM users WHERE T_username = '" & UserNameToCheck & "';") Its easier and safer something like this: Code: Dim RS As ResultSet = MySQL.SQLCon.ExecQuery("SELECT * FROM users WHERE T_username = '" & UserNameToCheck & "' AND T_password = '" & PasswordToCheck & "';") If you get no records, the password and/or the username are wrong. Also consider avoiding storing passwords as plain text. you can use a hash function to store them.