Page 1 of 1

Unity Database Login - Works but I would like some info

Posted: 15 Dec 2010, 18:11
by Fishypants
Hey guys, me again. So I recently was able to log into a room from Unity from a smartfox script that I wrote from scratch (as opposed to just copying and pasting the example, it helps me learn it better that way). All is working good in that regard.

Now I have hooked up a MySQL database and I can successfully query and set data to/from it, and thats working great. So the next logical step for me is to create a custom login that validates the user's name and password to the users registered in my database.

I stayed up till 2am last night, but I actually got it to work, (w00t!) but I would really appreciate some clarification on some points:

My understanding of events is this: Client takes user entered name and pass and initiates login procedure to server -> Custom extension intercepts login request and does some logic magic on it (checks the database for a match) then either logs user in or ...??

What is happening is (using the admin tool) if I enter all my information correctly, I get logged in to the zone and room that I tell it to. AWESOME!

BUT, lets say I type my password wrong, I don't get logged into the room, but I stay logged into the zone. Is this normal behavior? I feel that I am missing something, and I should somehow disconnect the client from the server, but I don't know where this should happen. In the custom extension? client side?

Out of curiosity, how does the login system handle duplicate names? What if for some reason, two people try to log in at the same time using the same nickname? How does the server handle this situation? Does 1 person get denied?

Is it normal practice when doing a SQL query to check if the response != null? Would it be that there is always data if it queried successfully and null if it failed?

I have more questions also, but I can't remember them off the top of my head. I am currently at work, so I cannot post my example, but I will do so tonight if it helps. Just looking for some general guidance to point me in the right direction. Thanks guys!

Posted: 15 Dec 2010, 18:37
by ThomasLund ... ogin-phase

(+ the stuff about custom login in the bottom)


Posted: 15 Dec 2010, 18:39
by Fishypants
Hey Thomas, thanks for the reply. I'm using SFS 1.6.x, is this information still valid for what I am doing?

Posted: 15 Dec 2010, 21:21
by ThomasLund

Too many postings to keep track of. No its only partly true. I just didnt notice that this post was in the SFS1 parts of the forums. My bad.

Bunch of SFS1 docs here though:

I'm very certain that some of your answers are in there too


Posted: 15 Dec 2010, 21:26
by Fishypants
hehe :D No worries, actually from what I was reading I already found out the answers to some of my questions. I can basically sign in to the server with nick="" and pass="" and the server will auto assign a name so that can help avoid name conflicts. Interesting . . .

Im actually thinking about using SFS2X . . . seems pretty interesting, with quite a few number of improvements.