Advertisement
Guest User

Untitled

a guest
May 10th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.52 KB | None | 0 0
  1. <?php
  2. $config_inside = true;
  3. require("config.php");
  4. require("httpsocket.php");
  5.  
  6. class DirectAdminAPI
  7. {
  8.     private $sock;
  9.    
  10.     private function CreateConnection()
  11.     {  
  12.         $this->sock = new HTTPSocket;
  13.        
  14.         if ($da_secure == true)
  15.             $this->sock->connect("ssl://".$da_host, $da_port);
  16.         else
  17.             $this->sock->connect($da_host, $da_port);
  18.         $this->sock->set_login($da_username,$da_password);
  19.         echo "CreateConnection<br />\n";
  20.     }
  21.  
  22.     public function CreateUser($username, $email, $pass, $domain, $package)
  23.     {
  24.         $this->CreateConnection();
  25.         $this->sock->query('/CMD_API_ACCOUNT_USER',
  26.             array(
  27.                 'action' => 'create',
  28.                 'add' => 'Submit',
  29.                 'username' => $username,
  30.                 'email' => $email,
  31.                 'passwd' => $pass,
  32.                 'passwd2' => $pass,
  33.                 'domain' => $domain,
  34.                 'package' => $package,
  35.                 'ip' => $da_host,
  36.                 'notify' => 'yes'
  37.             )
  38.         );
  39.  
  40.         $resultt = $this->sock->fetch_parsed_body();
  41.         //echo "ERROR-". $resultt["error"] ."-"; // debug
  42.         if ($result["error"] != "0")
  43.         {
  44.             echo "<b>Error Creating user ". $username ." on server ". $da_host .":<br />\n";
  45.             echo $resultt["text"]."<br />\n";
  46.             echo $resultt["details"]."<br /></b>\n";
  47.         }
  48.         else
  49.             echo "User ". $username ." created on server ". $da_host ."<br />\n";
  50.            
  51.         echo "CreateUser<br />\n";
  52.     }
  53. }
  54.  
  55. $wocket = new DirectAdminAPI();
  56.  
  57. $username = "pizza";
  58. $pass = "waAWw94";
  59. $email = "jarno@jfdhosting.nl";
  60. $domain = "newyorkpizza.nl";
  61. $package = "Unlimited";
  62.  
  63. $wocket->CreateUser($username, $email, $pass, $domain, $package);
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement