Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* $Id: newAccount.src 1085 2007-10-16 08:09:01Z sroyalty $
- *
- */
- use uo;
- use os;
- include ":accounts:accounts";
- include ":accounts:settings";
- /* NOTES:
- *
- * Expects a packed array:
- * 1 - username (string)
- * 2 - password (string)
- * 3 - default command level (integer)
- * 4 - expansion (string)
- * 5 - email ( string)
- *
- */
- program AuxService(connection)
- var report;
- var settings := ACCT_GetSettingsCfgElem("Settings");
- var iplist := Unpack(settings.AllowedIPList);
- print(connection);
- while ( connection )
- if( !(CStr(connection.ip) in iplist) )
- report := array{"Error", "IP is not allowed to use this connection."};
- connection.Transmit(report);
- return 0;
- endif
- if ( !settings.AllowWWWAccounts )
- report := array{"Error", "Web account maker is disabled."};
- connection.Transmit(report);
- return 0;
- endif
- var event := Wait_For_Event(5);
- if ( event ) // New account to be made?
- var username := event.value[1];
- var password := event.value[2];
- var cmd_lvl := event.value[3];
- var expansion := event.value[4];
- var email := event.value[5];
- var result := CreateNewAccount(username, password, cmd_lvl, expansion, email);
- if ( result.errortext )
- report := array{"Error", result.errortext};
- else
- report := 1;
- print("Account created");
- endif
- connection.Transmit(report);
- return 1;
- else
- report := array{"Error", "Connection timed out."};
- connection.Transmit(report);
- return 0;
- endif
- endwhile
- endprogram
Add Comment
Please, Sign In to add comment