I'm not sure how large your player base is, so I don't know how many account files you might be fly through but I had a couple of small suggestions. That might help you out with your not wanting duplicates and what not.
What I did back on my own mud's account code. I required my players to supply valid email addresses. To accomplish this I had them input an email in. The code then generated a random "verification code" and emailed it to the player. The account then had 7 days from that time to enter that code into one of there characters to validate their account. After which my pfilecleaner would clean out any invalidated accounts. Also to save some time again I'm not sure how you do your accounts. But I gave each account it's own directory. Then in each folder had a <accountname>.acc file in it. I stored just basic information in that file: #ACCOUNT Name Sarix~ Email [EMAIL PROTECTED] Code Verifyed~ Code_time 0 Pass rommailinglist~ Flags A LogO 1037392543 Default Sarix~ Trust 210 #END End #$ That way when I had to scan I only had to open a small file and quickly grab the needed information out that. I never had to use threats or fork, for any of my account code or my pfilecleaner, (which was a scrip that ran through my entire player file directory found accounts/pfiles that were old and not being used and would delete them.) Figured I would throw out some ideas that might help. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Valnir Sent: Tuesday, August 15, 2006 10:36 AM To: [email protected] Subject: Questions about FORK. Ok.. I'm working on an account system, and want to make sure that no two accounts have the same email address. Don't want users having duplicate accounts. The issue I'm having is that during account creation I'm scanning all the existing user accounts to see if any have the same address. I'm using fork() so that I don't have the entire mud come to a screeching halt while it scans, but for some reason, although everything in the fork() seems to be working fine, it doesn't set the d->connected correctly or process the nanny function again at the end the way I'm wanting it to. Ideas? Thansk! - Valnir /* Code snippet */ void check_dup_email ( DESCRIPTOR_DATA *d, char *email ) { DIR *user_dir; struct dirent *users; USER_DATA *usr; char name[MIL]; char buf[MSL]; bool duplicate = FALSE; int f; if ( ( f = fork() ) == (-1) ) { write_to_buffer( d, "\n\r\n\r", 0 ); write_to_buffer( d, "An error occured while trying to validate your email address!\n\r", 0 ); write_to_buffer( d, "You will not be able to complete continue creating your account\n\r" "until this problem is solved. The staff has been contacted.\n\r\n\r" "Please check back soon!\n\r\n\r" "^e[^fPress Return to Disconnect^e]^0\n\r", 0 ); d->connected = CON_USER_DISCONNECT; bug( "fork() failed in check_dup_email.", 0 ); do_bug( NULL, "fork() failed in check_dup_email." ); return; } if ( !f ) { write_to_buffer( d, "Please wait while we scan for duplicate accounts.", 0 ); process_output( d, FALSE ); if ( ( user_dir = opendir(USER_DIR) ) != NULL ) { while ( ( users = readdir(user_dir) ) != NULL ) { write_to_buffer( d, ".", 0 ); if ( !str_cmp( users->d_name, "." ) || !str_cmp( users->d_name, ".." ) ) continue; if ( !strstr( users->d_name, ".usr" ) ) continue; /* get name from file filename - still need to parse the '.usr' off the filename */ if ( ( usr = load_account( NULL, name ) ) != NULL ) { if ( !str_cmp( usr->email, email ) ) { sprintf( buf, "Attempt to use duplicate email address detected. " "Same as '%s'.", usr->name ); log_string( buf ); duplicate = TRUE; } } unload_account( NULL, usr); process_output( d, FALSE ); if ( duplicate ) break; } } else bug( "Could not open USER_DIR!", 0 ); closedir( user_dir ); write_to_buffer( d, "\n\r\n\r", 0 ); if ( duplicate ) { write_to_buffer( d, "Duplicate email found! We do not allow multiple accounts\n\r" "per player. If you have forgotten your account name, please contact\n\r" "the staff at http://www.legendofthenobles.com/?page=email to request\n\r" "your account name.\n\r\n\r" "^e[^fPress Return to Disconnect^e]^0\n\r", 0 ); process_output( d, TRUE ); d->connected = CON_USER_DISCONNECT; } else { write_to_buffer( d, "No duplicate found.\n\r", 0 ); process_output( d, TRUE ); d->connected = CON_CONFIRM_EMAIL; nanny( d, email ); } exit(0); } return; } -- ROM mailing list [email protected] Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom -- ROM mailing list [email protected] Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom

