Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Username and Password from database


Wing
 Share

Recommended Posts

Hello!

I was wondering how would I get it to check a mysql database for a valid username and password, and if valid and matching it would then create the account files in the server.

Basically I want to get rid of Origins registering system, and have them login with MySQL database information. If its a new account a file will be created to remember the account, and will be sent to character creation screen.
Link to comment
Share on other sites

@[rose:

> link=topic=78286.msg839408#msg839408 date=1329611963]
> Well for one you'll need to learn how to use ADO.
>
> From there you should find it obvious if your skills are well enough.

Thanks! Will this be able to connect to a remote MySQL database?
Link to comment
Share on other sites

Here is how I'm doing it so far.

```
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub MysqlLogin(ByVal username As String, ByVal password As String)

    Set cn = New ADODB.Connection
    cn.ConnectionString = ConnectString()
    Dim sql As String
    Set rs = New ADODB.Recordset
    sql = "select Count(uid) from _users where username = '" & username & "' AND password = '" & password & "';"

    rs.Open sql, cn, adOpenDynamic, adLockReadOnly

    If rs(0) = 1 Then
        ' login okay send character selection screen
    Else
        ' login not okay
    End If

End Sub

Private Function ConnectString() As String
    Dim ServerName As String
    Dim DatabaseName As String
    Dim username As String
    Dim password As String

    ' change to IP if not on local machine
    ' Make sure that you give permission to log into the
    ' server from this address
    ' See Adding New User Accounts to MySQL
    ' Make sure that you d/l and install the MySQL Connector/ODBC 3.51 Driver

    ServerName = "localhost"
    DatabaseName = "test"
    username = "test"
    password = "test"

    ConnectString = "DRIVER={MySQL ODBC 3.51 Driver};" & _
                "SERVER=" & ServerName & _
                ";DATABASE=" & DatabaseName & ";" & _
                "USER=" & username & _
                ";PASSWORD=" & password & _
                ";OPTION=3;"
End Function
```
I just need to figure out how to pull the salt from the db and add it to the password before it checks for the password… Hope this helps. Btw this will be different for you. I'm working with MyBB forum software.
Link to comment
Share on other sites

I highly suggest not doing anything like that at all. Remote querying is delayed and unthreaded. This will make your server perform like me trying to drive with a broken ankle. It'll be like a rabbit staggering along every so often.

Either learn how to do background tasks in VB6 or do what I did and create an authentication server.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...