Guest User

Untitled

a guest
Mar 5th, 2018
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 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. * 6 - creation password (string) - if set in settings.cfg
  19. *
  20. */
  21. program AuxService(connection)
  22. var report;
  23. var settings := ACCT_GetSettingsCfgElem("Settings");
  24. var iplist := Unpack(settings.AllowedIPList);
  25.  
  26. while ( connection )
  27. if( !(CStr(connection.ip) in iplist) )
  28. report := array{"Error", "IP is not allowed to use this connection."};
  29. connection.Transmit(report);
  30. return 0;
  31. endif
  32.  
  33. if ( !settings.AllowWWWAccounts )
  34. report := array{"Error", "Web account maker is disabled."};
  35. connection.Transmit(report);
  36. return 0;
  37. endif
  38.  
  39. var event := Wait_For_Event(5);
  40. if ( event ) // New account to be made?
  41. var username := event[1];
  42. var password := event[2];
  43. var cmd_lvl := CStr("0");
  44. var expansion := "AOS";
  45. var email := "mail@example.com";
  46. var admin_pw := "forzadom";
  47.  
  48. if ( settings.AuxWebPassword )
  49. if ( settings.AuxWebPassword != admin_pw )
  50. report := array{"Error", "Invalid administration password."};
  51. connection.Transmit(report);
  52. return 0;
  53. endif
  54. endif
  55.  
  56. var result := CreateNewAccount(username, password, cmd_lvl, expansion, email);
  57. if ( result.errortext )
  58. report := array{"Error", result.errortext};
  59. else
  60. report := array{"Success", "The account was created successfully."};
  61. endif
  62.  
  63. connection.Transmit(report);
  64.  
  65. return 1;
  66. else
  67. report := array{"Error", "Connection timed out."};
  68. connection.Transmit(report);
  69. return 0;
  70. endif
  71. endwhile
  72. endprogram
Add Comment
Please, Sign In to add comment