How do i do an account/password check system?

Started by
29 comments, last by kalldrex 23 years, 3 months ago
Also what about if i made a structure for each account and each character which would store their x,y position, items, etc... This would save processing power instead of opening files but will they stay the same if the server reboots or crashes etc?
ALL YOUR BASE ARE BELONG TO US!!!!
Advertisement
Question. Is there a way to read a MS access database and do the account/password system this way cause this would be so much easier!
ALL YOUR BASE ARE BELONG TO US!!!!
  #include <stdio.h>#include <string.h>bool CheckNamePWord(char *username, char *password, unsigned int psize) {  char filepath[260];  sprintf(filepath,"AC_%s\\login.inf",username);  FILE *fp = fopen(filepath,"rt");  if(fp!=NULL) {    for(unsigned int a=0; a<psize; a++) {      if(fgetc(fp)!=password[a]) {        fclose(fp);        return false;      }    }    fclose(fp);    return true;  }  return false;}int main(void) {  char username[100];  char password[100];  printf("Please enter your user name: ");  fflush(stdin);  fgets(username,100,stdin);  username[strlen(username)-1] = ''\0'';  printf("Please enter your password: ");  fflush(stdin);  fgets(password,100,stdin);  password[strlen(password)-1] = ''\0'';  if(CheckNamePWord(username, password, strlen(password)) {    printf("Login information was correct.");  } else {    printf("Your password or user name was incorrect.");  }    return 0;}  



http://www.gdarchive.net/druidgames/
As a note: I think you should start with something easier than an ORPG. It is apparent that you''re not quite ready for something that big (I don''t even think that I am ). Don''t take this as an insult though, I just think you should start on a smaller level.


http://www.gdarchive.net/druidgames/
Thanks for the advice but I like challenging myself :p. Actully opening and closing files I haven''t learned yet though i will need to learn ti to store information.

BTW what files do i create? like if my username is kalldrex the it would be AC_kalldrex.??? I can''t tell what that \\\login.inf is for.

Heh i also have a lot of time cause my friend has to learn how to use our 3d engine and so I also can''t do anything till he gets a working client working!

Once i get passed this part It will be a lot easier cause mostly all i have to do is scripts and stuff! This is right now the hardest part of my part of the game. Heh i''ll never give up
ALL YOUR BASE ARE BELONG TO US!!!!
I meant AC as in account. So, if your user name was Kalldrex, your password would be in the file at AC_Kalldrex\login.inf. This way, to add a new user, you create a folder for them, then give them a login.inf file with their password in it.


http://www.gdarchive.net/druidgames/
sweet . One thing tho heh how exactly would i have it so it looks in a file for a specific variable? I''m unsure of how to do this cause i would need to store like their stats and stuff.

Thanks for the code tho!
ALL YOUR BASE ARE BELONG TO US!!!!
I would like to use this same principle in one of my programs, but do not understand what program I should use to handle the database: mysql? Isn''t mysql expensive? Any information on what I need to have would be appreciated. Thanks.
quote:Original post by gunk

I would like to use this same principle in one of my programs, but do not understand what program I should use to handle the database: mysql? Isn''t mysql expensive? Any information on what I need to have would be appreciated. Thanks.


I assume you are looking for an economical way of doing this... If you aren''t in need of a relational database you can find some classes (C++) on the net that allow you to read from .dbf files.

http://www.fileguru.com/c/2131.html is just one of many classes that allow you to do just that. I found this by going to http://www.google.com and searching for ''C++ .DBF''

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
Okay i like what MySQL is seeming like but the only problem is i can''t find ANY information on running a MySQL server or even how to query the database for information in a c++ program. Where cna i find info on this? I alreayd have some good GUI''s for it administration!
ALL YOUR BASE ARE BELONG TO US!!!!

This topic is closed to new replies.

Advertisement