Example #1
0
    $email = isset($_POST['cpanel_email']) ? $_POST['cpanel_email'] : '';
    //update acc
    $data = array('cpanel_host' => $host, 'cpanel_domain' => $domain, 'cpanel_user' => $user, 'cpanel_pass' => encrypt($pass), 'cpanel_email' => $email);
    $res = update_cpacct($data, isset($_POST['acc_id']) ? $_POST['acc_id'] : '');
    #var_dump($DB->Affected_Rows());
}
//edit acc
if (isset($_GET['id']) && is_numeric($_GET['id']) && _get('do') == 'edit') {
    $current = get_cpanel_acc(_get('id'));
    if (!count($current)) {
        unset($current);
    }
}
//delete acc
if (isset($_GET['id']) && _get('do') == 'delete') {
    del_cpanel_acc(_get('id'));
}
//list rows
$accts = list_whm_accts();
//get root account
$root_acc = get_cpanel_info(array('cpanel_user' => 'root'));
//update sqlite db used for cron job of backup
if (_get('do') == 'update_portable_db') {
    $db = new SQLite3('db/db');
    $hash = encrypt(serialize($accts));
    $r = $db->query("Update hashtext set hash='{$hash}'");
    add_message($r);
}
/**
 * add account
 *
Example #2
0
/**
 * delete acct
 * @param $data
 */
function delacct($data)
{
    $cpanel = authorize_hwm();
    $rs = $cpanel->delAcct(_get('cpuser'));
    ajax_output($rs);
    //del from manager
    $res = del_cpanel_acc(array('cpanel_user' => _get('cpuser'), 'cpanel_host' => _post('cp_host'), 'cpanel_domain' => _post('cp_domain')));
    ajax_output($res);
    //alert email
    $body = HW_Twig_engine::twig_render('email/delacct.tpl', array('domain' => $data->domain, 'username' => $data->cpaneluser, 'email_domain' => $data->email_domain));
    send_mail1($data->email_domain, 'Hoangweb - Hủy tài khoản hosting', $body);
}