Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    1

    Default help me how to suspend an account

    Hi,

    I am programmer with asp, can you please help me how can i suspend an account with asp programming or someone help me with an script that suspend an account and then i pass domain name and parameteres to php script and then it reply back to asp script?

    Regards,
    Hamed
    Last edited by hamed23100; 01-24-2009 at 07:13 AM.

  2. #2
    Member
    Join Date
    Aug 2003
    Location
    Texas
    Posts
    91

    Default

    You could always just use PHP curl to suspend the account. Here you go...

    Code:
    <?php 
    // start the session and pass the Session parameter
    session_start(); 
    header("Cache-control: private"); //IE 6 Fix
    
    ######### Set up basic variables #########
    $serverIPaddress="192.168.1.1:2087";
    $whmusername="root";
    $whmpassword="123456";
    $server="https://$whmusername:$whmpassword@$serverIPaddress";
    
    //set the username of the account you are working with
    $user = "bobby12";
    $agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
    
    
    
    ######### Here are few example of many of the items that you could do with curl.  It will not execute until the very bottom #########
    
    //change user's password
    $url="$server/scripts/passwd?password=$passwd&domain=$user&user=$user";
    
    //enable shell access		
    $url="$server/scripts2/domanageshells?user=$user&shell=Enable+Jailed+Shell&user=$user";
    
    //bandlimit increase		
    $url="$server/scripts2/dolimitbw?user=$user&bwlimit=$bndwidth";
    		
    //suspend an account
    $url="$server/scripts2/suspendacct?domain=$user&user=$user&suspend-domain=Suspend&reason=";
    
    //UN-suspend an account
    $url="$server/scripts2/suspendacct?domain=$user&user=$user&unsuspend-domain=UnSuspend&reason=";
    
    //add front page extensions
    $url="$server/scripts/installfp?domain=$user&user=$user&submit-domain=Install";
    
    //remove front page extensions
    $url="$server/scripts/uninstallfp?domain=$user&user=$user&submit-domain=UnInstall";
    
    //modify the quota on the account		
    $url="$server/scripts/editquota?user=$user&quota=$quota";
    
    //add a domain pointer
    $url="$server/scripts/park?txtdomain=&domain=$domain&ndomain=$NewDomain";
    		
    //modify the account
    $url="$server/scripts/saveedituser?user=$user&BWLIMIT";
    $url.="=$BWLIMIT&FEATURELIST=$FEATURELIST&IP=$IP&OWNER";
    $url.="=$OWNER&PLAN=$PLAN&STARTDATE=$STARTDATE&DNS=$domain";
    $url.="&RS=$RS&LANG=english&newuser=$user&seeshell=$shell&MAXPOP";
    $url.="=$MAXPOP&MAXFTP=$MAXFTP&MAXLST=$MAXLST&MAXSUB=$MAXSUB&MAXSQL";
    $url.="=$MAXSQL&MAXPARK=$MAXPARK&MAXADDON=$MAXADDON";
    
    //generate a csr
     //need to replace spaces in all of the variables with the '+' sign
    $host = str_replace(" ","+",$host);
    $country = str_replace(" ","+",$country);
    $state = str_replace(" ","+",$state);
    $city = str_replace(" ","+",$city);
    $cod = str_replace(" ","+",$cod);
    $co = str_replace(" ","+",$co);
    $email = str_replace(" ","+",$email);
    $pass = str_replace(" ","+",$pass);
    $url="$server/scripts/gencrt?xemail=$xemail&host=$host&country";
    $url.="=$country&state=$state&city=$city&co=$co&cod=$cod&email=$email&pass=$pass";
    		
    ######### execute curl #########
    
    $ch=curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
    curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
    curl_setopt($ch, CURLOPT_MAXREDIRS, 4);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 120);
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
    $buffer = curl_exec($ch);
    curl_close($ch);
    
    ?>
    Last edited by wsenter; 01-26-2009 at 12:20 AM. Reason: typo

  3. #3
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by hamed23100 View Post
    Hi,

    I am programmer with asp, can you please help me how can i suspend an account with asp programming or someone help me with an script that suspend an account and then i pass domain name and parameteres to php script and then it reply back to asp script?

    Regards,
    Hamed
    Our XML API will work with any programming language that can work with XML and HTTP/HTTPS. You can read more about our XML API at:

    http://www.cPanel.net/plugins/xmlapi

    Basically you would pass some parameters to a special URL in WHM beginning with xml-api/ and you will receive results back to your script (ASP, PHP, Perl etc.) in XML format.

  4. #4
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    In short, if you are able to setup a secure connection to WHM (which I have no clue as far as how to do that with asp) you simply call:

    Code:
    /xml-api/suspendacct/user=bob&reason=I%20do%20not%20like%20bob
    Full documentation is available at http://www.cpanel.net/plugins/xmlapi/suspendacct.html

    This will return an xml document that will contain all relevant information on the suspension.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  5. #5
    Member
    Join Date
    Oct 2008
    Posts
    12

    Default

    For ASP the equivalent of cURL that you would want to use in this application is HTTPWebRequest.

Similar Threads & Tags
Similar threads

  1. Filed with Developers Search for Suspend / Unsuspend an Account function in WHM [Case 57215]
    By DjiXas in forum Feature Requests for cPanel/WHM
    Replies: 8
    Last Post: 02-22-2012, 09:10 AM
  2. suspendacct to suspend account, what command to suspend reseller?
    By sodapopinski in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 04-06-2009, 10:06 AM
  3. Cant suspend account?
    By Daemon1 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-13-2007, 09:30 PM
  4. cannot suspend account
    By katmai in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 12-16-2006, 12:09 AM
  5. Suspend Account?
    By jackal in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 06-27-2003, 06:18 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube