Current time: 02-08-2012, 04:17 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WHMPHP Plugin
06-16-2010, 01:38 PM (This post was last modified: 06-16-2010 02:36 PM by jerry.)
Post: #1
WHMPHP Plugin
Do you have a master reseller? But, THT only supports the root way of making resellers.
If you have WHMPHP, your in luck!!

First, open THTROOT/includes/servers/whm.php
After the comments, add
PHP Code:
require_once('THTPATHFULL/includes/whmphp.php'); 

We put it one directory below because it will be included twice when you make a server.

Find:
PHP Code:
private $server

Add After:
PHP Code:
private $pass "CPANEL PASS";
private 
$whmphp;
private 
$user "CPANEL USERNAME"// This may be refrenceable
function whm() {
        
$this->whmphp = new whmphp("YOURIP",$this->user,$this->pass); // Not localhost


Find:
PHP Code:
public function signup($server$reseller$user ''$email ''$pass '') { 

Replace Function With:
PHP Code:
public function signup($server$reseller$user ''$email ''$pass '') {
        global 
$main;
        global 
$db;
        if (
$user == '') { $user $main->getvar['username']; }
        if (
$email == '') { $email $main->getvar['email']; }
        if (
$pass == '') { $pass $main->getvar['password']; }
        
$this->server $server;
        if (
$reseller) {
            
$r $this->whmphp->createreseller($main->getvar['fplan'],$user,$pass,$main->getvar['fdom'],$email);
            echo 
$r[1];
            return 
$r[0];
        } else {
            
$action "/xml-api/createacct".
                        
"?username="$user "".
                        
"&password="$pass ."".
                        
"&domain="$main->getvar['fdom'] ."".
                        
"&plan="$main->getvar['fplan'] ."".
                        
"&contactemail="$email ."";
            
$command $this->remote($action);
            
            if(
$command->result->status == 1) {
                return 
true;    
            }
            else {
                echo 
"Error: "$command->result->statusmsg;    
            }
        }
    } 

Find:
PHP Code:
public function suspend($user$server$reason false) { 

Replace Function With:
PHP Code:
public function suspend($user$server$reason false) {
        
$this->server $server;
        if (
$server == 1) {
            return 
$this->whmphp->suspendreseller($user);
        } else {
            
$action "/xml-api/suspendacct?user=" strtolower($user);
            
$command $this->remote($action);
                    if(
$reason == false) {
                        
$command $this->remote($action);
                    }
                    else {
                        
$command $this->remote($action "&reason=" str_replace(" ""%20"$reason));
                    }
            if(
$command->result->status == 1) {
                return 
true;
            }
            else {
                return 
false;
            }
        }
    } 

Find:
PHP Code:
public function unsuspend($user$server) { 

Replace Function With:
PHP Code:
public function unsuspend($user$server) {
        
$this->server $server;
        if (
$server == 1) {
            return 
$this->whmphp->unsuspendreseller($user);
        } else {
            
$action "/xml-api/unsuspendacct?user=" strtolower($user);
            
$command $this->remote($action);
            if(
$command->result->status == 1) {
                return 
true;
            }
            else {
                return 
false;
            }
        }
    } 

Find:
PHP Code:
public function terminate($user$server) { 

Replace Function With:
PHP Code:
public function terminate($user$server) {
        
$this->server $server;
        if (
$server == 1) {
            return 
$this->whmphp->terminatereseller($user);
        } else {
            
$action "/xml-api/removeacct?user=" strtolower($user);
            
$command $this->remote($action0true);
            if(
$command == true) {
                return 
true;
            }
            else {
                return 
false;
            }
        }
    } 

Download Attachment
Place in: THTROOT/includes/

Your resellers must user the server ID 1. If you have to, switch the server id.
You will need 2 servers of the same details.
One with ID 1 for WHMPHP, one with another ID for whm.

Feel free to IM me for support:
ismywb@gmail.com
laces12@live.com
jerryinchost (Yahoo)
ismywb (Skype)

edit: forgot to attach whmphp.php


Attached File(s)
.php  whmphp.php (Size: 9.84 KB / Downloads: 98)
Find all posts by this user
Quote this message in a reply
12-31-2010, 03:26 AM
Post: #2
RE: WHMPHP Plugin
what version is this for tryed on version 1.2.3 but it doesnt work and now it wont let me add,view,delete servers unless i restore the files Smile but i need it to work with WHMPHP could you please help
Find all posts by this user
Quote this message in a reply
12-22-2011, 06:28 PM
Post: #3
RE: WHMPHP Plugin
I get a blank page with this plugin when adding a server...
Find all posts by this user
Quote this message in a reply
01-03-2012, 07:27 PM
Post: #4
RE: WHMPHP Plugin
Sorry guys, I forgot to mention this:
PHP Code:
require_once('THTPATHFULL/includes/whmphp.php'); 
THTPATHFULL should be replaced with full path to THT. IE: /home/user/www/order
Find all posts by this user
Quote this message in a reply
01-03-2012, 09:26 PM
Post: #5
RE: WHMPHP Plugin
Interesting. I'll have to look into this. Maybe we can add this to TheHostingTool at some point? Smile

Kevin Mark - TheHostingTool Lead Developer
Visit this user's website Find all posts by this user
Quote this message in a reply
01-23-2012, 11:43 AM
Post: #6
RE: WHMPHP Plugin
That would be nice. Big Grin If you do, would you mind adding credit to me in it? like, whmphp module created by Jerry Johnson?
Find all posts by this user
Quote this message in a reply
01-30-2012, 08:50 PM (This post was last modified: 01-30-2012 08:52 PM by jerry.)
Post: #7
RE: WHMPHP Plugin
Hi, I have found a bug in whmphp.php and I have a fix.

By the way, if I haven't said this, I am saying it now, this is not to be used by the root account to create master resellers, if it for masters resellers to create resellers.


Attached File(s)
.php  whmphp.php (Size: 4.42 KB / Downloads: 2)
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)