change domain name error

gumiss

New member
Joined
Oct 31, 2019
Messages
1
hi,
I'm trying to change domain names for several users using:
Code:
<?php

include('./httpsocket.php');

$domain= $_POST["domain"];
$server = $_POST["server"];
$login = $_POST["login"];
$pass = $_POST["pass"];
$user = $_POST["user"];

$sock = new HTTPSocket;

$sock->connect($server, 2222);

$sock->set_login($login.'|'.$user,$pass);

$sock->set_method('POST');

        $sock->query('/CMD_API_CHANGE_DOMAIN', 
        array(
                'old_domain'=>$domain,
                'new_domain'=>$domain.'.local'
             ));

        $result = $sock->fetch_result();
        if ($result['error'] != "0")
        {
                echo "<b>Error! The name cannot be changed! '$domena' for '$user'<br>\n";
                echo $result['text']."<br>\n";
                echo $result['details']."<br></b>\n";
                var_dump($result);"<br>\n";
        }
        else
        {
                echo "Domain '$domena' has been changed to' $domena'.local<br>\n";
        }
exit(0);
?>

start script

Code:
s=NUMBER_LIST_WITH_USER_AND_DOMAIN
list=$s.txt
server="pro$s"
login='admin'
pass='PASS'
cat $list | while read row
    do
        user=$(echo $row | awk -F: '{ print $1 }')
        domain=$(echo $row | awk -F: '{ print $2 }')
        curl -d "server=$server&login=$login&pass=$pass&user=$user&domain=$domain" -X POST https://address/path/to/change.php
    done

Sometimes, domain names are not changed. I want to get an error message but all I get is:
Code:
<b>Error! The name cannot be changed! DOMAIN for USER<br>
<br>
<br></b>
bool(false)
I looked at https://www.directadmin.com/features.php?id=694.

please help
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,854
Location
GMT +7.00
Hello,


If directadmin does not return more details, then you might need to check its logs under /var/log/directadmin/ or request this to be added in a new release.
 
Top