I have a question about security... Suppose the client types in their login information and sends that to the server. The server checks the MySQL database to see if said account details are correct, and if so it reads from the database all the info it needs. Then the server sends back the info to the client, the client never touching the database or password.
Shouldn't this method be completely secure? (More or less) If the client never connects to the database and never receives a password, they have no way of getting in.
The only disadvantage I see is that when interacting with other players it will have to ask the server for account info, which is kind of a hassle... But am I correct in that this would be secure?
Here's the other option I thought of: The client connects to a website which acts as a median between them and the database. The client sends out an SHA-1 encrypted password. (So they don't know what the actual password is.) Using the same hash, the website has encrypted the password of the MySQL database, and checks this against what it received from the client. If it's a match, the website gives the ok to use the password to connect to the database and lookup the necessary database information. After doing so, it returns the information to the client, that way the only password they know is already encrypted in one-way encryption. (Therefore near impossible to decrypt or figure out)
The second method requires a lot more php to complete, but actually seems like it should work just as well as the first one, and that way I don't have to send as many messages from the server; the client can look it up without having the password revealed. And it also allows the player to log in before connecting to the server, which is kind of what I was planning on doing.
Please let me know if my thinking is correct, or if I'm missing something here that would endanger the database.
Edited by Funk E. Gamez, 05 January 2012 - 11:32 AM.