Quantcast
Channel: WHMCS Community Forums
Viewing all articles
Browse latest Browse all 13458

Get cPanel Server Credentials Based Upon Customer / Domain

$
0
0
I am attempting to do a quick check to see if a user account exists (domain hosting/cPanel) to create an additional DNS zone record. I'm using the following code but the recordset is returning empty.

Code:

                //CHECK IF MAIN DOMAIN IS HOSTED, IF SO CREATE THE DNS RECORD ON THE APPROPRIATE CLUSTER
                $domain = str_replace('http://', '', $params['customfields']['Source URL']);
                $domain = str_replace('https://', '', $domain);
                $domain = trim(str_replace('www.', '', $domain));
                $fields = "tblservers.username, tblservers.password, tblservers.hostname";
                $where = array(
                        'userid'  => $params['clientsdetails']['userid'],
                        'domain'  => $domain,
                );
                $sort = "id";  $sortorder = "ASC";  $limits = "0,5";
                $join = "tblservers ON tblservers.id=tblhosting.server";
                $result = select_query('tblhosting',$fields,$where,$sort,$sortorder,$limits,$join);
                while ($data = mysql_fetch_array($result)) {
                        $cpuser = $data['username'];
                        $cppass = $data['password'];
                        $cphost = $data['hostname'];
                }
               
                $results = localAPI('decryptpassword',array('password2' => $cppass),'admin');               
                $cppass = $results['password'];


Viewing all articles
Browse latest Browse all 13458

Trending Articles