Jump to content

Get cPanel Server Credentials Based Upon Customer / Domain


Tcalp

Recommended Posts

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.

 

	//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'];

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated