<?php require 'soap_config.php'; $client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri, 'trace' => 1, 'exceptions' => 1)); try { if ($session_id = $client->login($username, $password)) { echo 'Logged successfull. Session ID:' . $session_id . '<br />'; } //* Parameters $reseller_id = 1; $c_id = 1; //* Get the client record $client_record = $client->client_get($session_id, $reseller_id); //* Change parameters $client_record['country'] = 'de'; $client_record['username'] = '******'; $client_record['contact_name'] = 'brush'; $affected_rows = $client->client_update($session_id, $c_id, $reseller_id, $client_record); echo "Number of records that have been changed in the database: " . $affected_rows . "<br>"; if ($client->logout($session_id)) { echo 'Logged out.<br />'; } } catch (SoapFault $e) { echo $client->__getLastResponse(); die('SOAP Error: ' . $e->getMessage()); }
function ispcfg3_UnsuspendAccount($params) { $username = $params['username']; $password = $params['password']; $domain = strtolower($params['domain']); $clientsdetails = $params['clientsdetails']; $soapuser = $params['configoption1']; $soappassword = $params['configoption2']; $soapsvrurl = $params['configoption3']; $soapsvrssl = $params['configoption4']; $webcreation = $params['configoption9']; $dns = $params['configoption18']; $addmaildomain = $params['configoption21']; $addftpuser = $params['configoption22']; if ($soapsvrssl == 'on') { $soap_url = 'https://' . $soapsvrurl . '/remote/index.php'; $soap_uri = 'https://' . $soapsvrurl . '/remote/'; } else { $soap_url = 'http://' . $soapsvrurl . '/remote/index.php'; $soap_uri = 'http://' . $soapsvrurl . '/remote/'; } if (isset($username) && $username != '' && (isset($password) && $password != '')) { try { /* Connect to SOAP Server */ $client = new SoapClient(null, array('location' => $soap_url, 'uri' => $soap_uri, 'exceptions' => 1, 'trace' => false)); /* Authenticate with the SOAP Server */ $session_id = $client->login($soapuser, $soappassword); $result_id = $client->client_get_by_username($session_id, $username); $sys_userid = $result_id['client_id']; $sys_groupid = $result_id['groups']; $client_detail = $client->client_get($session_id, $sys_userid); $parent_client_id = $client_detail['parent_client_id']; $domain_id = $client->dns_zone_get_by_user($session_id, $sys_userid, $client_detail['default_dnsserver']); if ($webcreation == 'on') { $clientsites = $client->client_get_sites_by_user($session_id, $sys_userid, $sys_groupid); $i = 0; $j = 1; while ($j <= count($clientsites)) { $domainres = $client->sites_web_domain_set_status($session_id, $clientsites[$i]['domain_id'], 'active'); logModuleCall('ispconfig', 'UnSuspend Web Domain', $clientsites[$i]['domain_id'], $domainres, '', ''); $i++; $j++; } } if ($addftpuser == 'on') { $ftpclient = $client->sites_ftp_user_get($session_id, array('username' => $username . '%')); $i = 0; $j = 1; while ($j <= count($ftpclient)) { $ftpclient[$i]['active'] = 'y'; $ftpclient[$i]['password'] = ''; $ftpid = $client->sites_ftp_user_update($session_id, $sys_userid, $ftpclient[$i]['ftp_user_id'], $ftpclient[$i]); logModuleCall('ispconfig', 'UnSuspend Ftp User', $ftpclient[$i]['ftp_user_id'], $ftpclient[$i], '', ''); $i++; $j++; } } if ($addmaildomain == 'on') { $emaildomain = $client->mail_domain_get_by_domain($session_id, $domain); $mailid = $client->mail_domain_set_status($session_id, $emaildomain[0]['domain_id'], 'active'); logModuleCall('ispconfig', 'UnSuspend Email Domain', $emaildomain[0]['domain_id'], $mailid, '', ''); } if ($dns == 'on') { $i = 0; $j = 1; while ($j <= count($domain_id)) { $affected_rows = $client->dns_zone_set_status($session_id, $domain_id[$i]['id'], 'active'); $i++; $j++; logModuleCall('ispconfig', 'UnSuspend Domain', $domain_id[$i]['id'], $affected_rows, '', ''); } } $client_detail['locked'] = 'n'; $client_detail['password'] = ''; $client_result = $client->client_update($session_id, $sys_userid, $parent_client_id, $client_detail); logModuleCall('ispconfig', 'UnSuspend Client', $sys_userid . ' ' . $sys_groupid, $client_result, '', ''); if ($client->logout($session_id)) { } $successful = '1'; } catch (SoapFault $e) { $error = 'SOAP Error: ' . $e->getMessage(); $successful = '0'; } if ($successful == 1) { $result = 'success'; } else { $result = 'Error: ' . $error; } } else { /* * No username or password set. */ $result = 'Username or Password is Blank or Not Set'; } return $result; }
<?php require 'soap_config.php'; $client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri, 'trace' => 1, 'exceptions' => 1)); try { if ($session_id = $client->login($username, $password)) { echo 'Logged successfull. Session ID:' . $session_id . '<br />'; } //* Parameters $reseller_id = 1; $client_id = 1; //* Get the client record $client_record = $client->client_get($session_id, $client_id); //* Change parameters $client_record['country'] = 'de'; $client_record['username'] = '******'; $client_record['contact_name'] = 'brush'; //* We set the client password to a empty string as we do not want to change it. $client_record['password'] = ''; $affected_rows = $client->client_update($session_id, $c_id, $reseller_id, $client_record); echo "Number of records that have been changed in the database: " . $affected_rows . "<br>"; if ($client->logout($session_id)) { echo 'Logged out.<br />'; } } catch (SoapFault $e) { echo $client->__getLastResponse(); die('SOAP Error: ' . $e->getMessage()); }
/** * Returns the client. * * @return IspData\Client */ public function getClient($clientId) { $data = $this->server->client_get($this->sessionId, $clientId); return Data\Client::fromData($data); }