How do i do an account/password check system?

Started by
29 comments, last by kalldrex 23 years, 2 months ago
How would i set up a server so that it..... 1)The client sends his username and the server seaches through a database to confirm it 2)When the client sends the password it confirms that the password belongs to that username! I need this as simple as possible so i can easily add and remove usernames and passwords at my discretion!
ALL YOUR BASE ARE BELONG TO US!!!!
Advertisement
Well, This all depends on what sort of database you will be using.

SQL, Access, Pandora, Oracle, CSV, Text, Excel, etc etc etc.

Personally I use SQL and I just use the ADO object to access the DB and then I just perform a Query "SELECT Password From UserDB Where Username=''''"

If it reutnrs anything then the Username is valid, now I check to see if the password matches the one returned from the Database, if that is true then they are logged in otherwise I send a error message back and disconnect them.
1) what''s the difference between these methods
2) besides access,excel, and text how much $ do they cost?
3) Which one''s the easiest to program with?
ALL YOUR BASE ARE BELONG TO US!!!!
I can make a Java or Perl script that would do this on the client side for a fair price. Email me at adtomi@popmail.com.
Bob Jones
You don''t want to use client side password checking, they can be broken more easily. Keep it all encryted and on the server''s side.


http://www.gdarchive.net/druidgames/
Yes I am quite aware of this as I said that the client would SEND the password to the server!
ALL YOUR BASE ARE BELONG TO US!!!!
I simply send the username password from the client to the server. The server then assembles a file name out of them and if the file exists it opens it and if it doesn''t it''ll send back a message to have the program exit.

Cost = free.

There''s a few things you''ll need to do to keep people from stealing login information but it''s nothing difficult. Don''t use even the username within the game world and keep your server secure.

SQL server is a really good idea but it''s $2000 to beable to use it for anything other than development. I may eventually use it but I''m going to wait and see how the current system holds up.

Ben
http://therabbithole.redback.inficad.com
Yes this is waht i want to do but my book on c++ only tells how to open files using the sequential method and that''s no good plus it prolly hard to do this with it cause i don''t know how to make it that it looks for a filename with the user''s name. If you could send me that part of your code or a sample or something i''d apprecieate it.

By your second thing I think you are saying don''t use the username within the game correct? Well i think i''m going to set it up like other MMORPGs that you can set up multiple chars on one account since i don''t want people having more then one account! Then the only ones who can see the actual username is the Admins.
ALL YOUR BASE ARE BELONG TO US!!!!
Kalldrex, I was talking to Nitro123 .

If you want to try to open a file that you don't know exists, just try to open it, if the call fails, then say that the password/user name was incorrect:
    bool CheckNamePWord(char *name, char *pword, unsigned int psize) {  char filepath[260];  sprintf(filepath,"AC_%s\\login.inf",name);  FILE *fp = fopen(filepath,"rb");  if(fp!=NULL) {    /* Now we know that file exists, so let's encrypt the password that was provided with whatever encryption you use */    for(unsigned int a=0; a<psize; a++) {      if(fgetc(fp)!=pword[a]) {        fclose(fp);        return false;      }    }    // Well the account exists, and the pword is correct, so return that it worked out    fclose(fp);    return true;  }  return false;}    

There are probably tons of ways to even make that secure, but I hope it conveys what my idea is at least .

[EDIT: fix my code a little ]


http://www.gdarchive.net/druidgames/


Edited by - Null and Void on February 16, 2001 8:22:38 PM
I don''t have anything to add to this... I do however have a comment.

The code submitted by Null and Void is at the very root how game programmers need to think. Given a problem; you need to come up with a solution. The solution should be simple and concise which is exactly what has been provided in the example code.

I love to see this kind of thinking...

Game On,


Dave "Dak Lozar" Loeser
Dave Dak Lozar Loeser
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."--anonymous

This topic is closed to new replies.

Advertisement