Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

delete_account.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. require_once('config.php');
  3. //check to see that the form has been submitted
  4. if(isset($_POST))
  5. {
  6. //delete user from mail-server
  7. $obBaseApp = new COM("hMailServer.Application");
  8. $obBaseApp->Connect();
  9. $obBaseApp->Authenticate($CONF['mail_admin_user'], $CONF['mail_admin_pass']);
  10. $domain = $obBaseApp->Domains->ItemByName($CONF['host']);
  11. $email = $user->username . "@" . $CONF['host'];
  12. $account = $domain->Accounts->ItemByAddress($email);
  13. $account->Delete();
  14. //delete any public keys from git auth
  15. $dir = $CONF['git_key_dir'].'u\\'.$user->username;
  16. if (is_dir($dir))
  17. {
  18. foreach (glob($dir."\\*") as $filename)
  19. {
  20. if (is_file($filename))
  21. {
  22. unlink($filename);
  23. }
  24. }
  25. }
  26. putenv("HOME=/home/git");
  27. $result = shell_exec('bash --login -c "'.$CONF['gitolite_path'].'gitolite trigger SSH_AUTHKEYS"');
  28. /*
  29. $r = new minecraftRcon($CONF['minecraft_server'], $CONF['rcon_port'], $CONF['rcon_pass']);
  30. // Authenticate, and if so, execute command(s)
  31. if ( $r->Auth() ) {
  32. $r->mcRconCommand('pex user '.$user->minecraft_user." group remove Member");
  33. }
  34. */
  35. //delete the user from the main database
  36. $user->delete($db);
  37. //log the user out
  38. $userTools->logout($CONF);
  39. echo "true";
  40. }
  41. else
  42. {
  43. echo "false";
  44. }
  45. ?>