Guest User

Untitled

a guest
Mar 3rd, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. /* $Id: newAccount.src 1085 2007-10-16 08:09:01Z sroyalty $
  2. *
  3. */
  4. use uo;
  5. use os;
  6.  
  7. include ":accounts:accounts";
  8. include ":accounts:settings";
  9.  
  10. /* NOTES:
  11. *
  12. * Expects a packed array:
  13. * 1 - username (string)
  14. * 2 - password (string)
  15. * 3 - default command level (integer)
  16. * 4 - expansion (string)
  17. * 5 - email ( string)
  18. *
  19. */
  20. program AuxService(connection)
  21. var report;
  22. var settings := ACCT_GetSettingsCfgElem("Settings");
  23. var iplist := Unpack(settings.AllowedIPList);
  24.  
  25. print(connection);
  26. while ( connection )
  27.  
  28. if( !(CStr(connection.ip) in iplist) )
  29. report := array{"Error", "IP is not allowed to use this connection."};
  30. connection.Transmit(report);
  31. return 0;
  32. endif
  33.  
  34. if ( !settings.AllowWWWAccounts )
  35. report := array{"Error", "Web account maker is disabled."};
  36. connection.Transmit(report);
  37. return 0;
  38. endif
  39.  
  40. var event := Wait_For_Event(5);
  41. if ( event ) // New account to be made?
  42. var username := event.value[1];
  43. var password := event.value[2];
  44. var cmd_lvl := event.value[3];
  45. var expansion := event.value[4];
  46. var email := event.value[5];
  47.  
  48.  
  49. var result := CreateNewAccount(username, password, cmd_lvl, expansion, email);
  50. if ( result.errortext )
  51. report := array{"Error", result.errortext};
  52. else
  53. report := 1;
  54. print("Account created");
  55. endif
  56.  
  57. connection.Transmit(report);
  58.  
  59. return 1;
  60. else
  61. report := array{"Error", "Connection timed out."};
  62. connection.Transmit(report);
  63. return 0;
  64. endif
  65. endwhile
  66. endprogram
Add Comment
Please, Sign In to add comment