Advertisement
Guest User

Untitled

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