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)
- * 6 - creation password (string) - if set in settings.cfg
- *
- */
- program AuxService(connection)
- var report;
- var settings := ACCT_GetSettingsCfgElem("Settings");
- var iplist := Unpack(settings.AllowedIPList);
- 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[1];
- var password := event[2];
- var cmd_lvl := CStr("0");
- var expansion := "AOS";
- var email := "mail@example.com";
- var admin_pw := "forzadom";
- if ( settings.AuxWebPassword )
- if ( settings.AuxWebPassword != admin_pw )
- report := array{"Error", "Invalid administration password."};
- connection.Transmit(report);
- return 0;
- endif
- endif
- var result := CreateNewAccount(username, password, cmd_lvl, expansion, email);
- if ( result.errortext )
- report := array{"Error", result.errortext};
- else
- report := array{"Success", "The account was created successfully."};
- 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