function resellerclubsdhostingin_ClientArea($params)
{
    if (isset($_POST['cplogin']) && strlen(trim($_POST['cplogin'])) > 0) {
        $cplogin_action = strtolower(trim($_POST['cplogin']));
        switch ($cplogin_action) {
            case 'webhost':
                _redirect_to_webhosting_control_panel($params);
                break;
            case 'mailhost':
                _redirect_to_mailhosting_control_panel($params);
                break;
            case 'dns':
                _redirect_to_dns_control_panel($params);
                break;
            case 'webmail':
                _redirect_to_webmail_control_panel($params);
                break;
        }
    }
    global $smarty;
    global $orderbox;
    try {
        $is_processing = false;
        $plan_pieces = _get_plan_details($params['configoption1']);
        if ('windows' == $plan_pieces['type']) {
            $api_path_orderid_from_domain = '/singledomainhosting/windows/in/orderid.json';
            $api_path_order_details = '/singledomainhosting/windows/in/details.json';
            $api_path_dns_details = '/singledomainhosting/windows/in/dns-record.json';
        } else {
            $api_path_orderid_from_domain = '/singledomainhosting/linux/in/orderid.json';
            $api_path_order_details = '/singledomainhosting/linux/in/details.json';
            $api_path_dns_details = '/singledomainhosting/linux/in/dns-record.json';
        }
        $order_id_result = $orderbox->api('GET', $api_path_orderid_from_domain, array('domain-name' => $params['domain']), $response, 'resellerclubsdhostingin', 'clientarea');
        if (is_array($order_id_result) && array_key_exists('status', $order_id_result) && strtolower($order_id_result['status']) == 'error') {
            $is_processing = true;
        } else {
            $order_id = $order_id_result;
            $order_details = $orderbox->api('GET', $api_path_order_details, array('order-id' => $order_id), $response, 'resellerclubsdhostingin', 'clientarea');
            $order_dns_details = $orderbox->api('GET', $api_path_dns_details, array('order-id' => $order_id), $response, 'resellerclubsdhostingin', 'clientarea');
        }
        $smarty->assign('is_processing', $is_processing);
        if ($is_processing) {
            $smarty->assign('sdh_status', 'Processing...');
        } else {
            if ('windows' == $plan_pieces['type']) {
                $cp_url = 'http://' . $order_details['ipaddress'] . ':8880';
            } else {
                $cp_url = 'http://' . $order_details['ipaddress'] . '/cpanel';
            }
            $cp_url_href = "<a href=\"{$cp_url}\" target=\"_blank\">{$cp_url}</a>";
            $temp_url_href = "<a href=\"{$order_details['tempurl']}\" target=\"_blank\">{$order_details['tempurl']}</a>";
            $smarty->assign('sdh_status', $order_details['currentstatus']);
            $smarty->assign('sdh_webhosting_panel', _display_webhosting_panel_form());
            $smarty->assign('sdh_mailhosting_panel', _display_mailhosting_panel_form());
            $smarty->assign('sdh_dns_panel', _display_dns_panel_form());
            $smarty->assign('sdh_webmail_panel', _display_webmail_panel_form());
            $smarty->assign('sdh_temp_url', $temp_url_href);
            $smarty->assign('sdh_cp_url', $cp_url_href);
            $smarty->assign('sdh_cp_username', $order_details['siteadminusername']);
            $smarty->assign('sdh_cp_password', $order_details['siteadminpassword']);
            $smarty->assign('sdh_ip_address', $order_details['ipaddress']);
            $smarty->assign('sdh_mailpop', $order_details['mailpop'] == '-1' ? 'Unlimited' : $order_details['mailpop']);
            $smarty->assign('sdh_diskspace', $order_details['webspace'] == '-1' ? 'Unlimited' : $order_details['webspace']);
            $smarty->assign('sdh_bandwidth', $order_details['bandwidth'] == '-1' ? 'Unlimited' : $order_details['bandwidth']);
            $smarty->assign('sdh_allocated_mailspace', $order_details['mailspace'] == '-1' ? 'Unlimited' : $order_details['mailspace'] . " GB");
            $smarty->assign('nameservers', $order_details['nameserver']);
            $smarty->assign('dns_details', $order_dns_details);
        }
    } catch (Exception $e) {
        return $e->getMessage();
    }
}
function resellerclubwebservices_ClientArea($params)
{
    if (isset($_POST['cplogin']) && strlen(trim($_POST['cplogin'])) > 0) {
        $cplogin_action = strtolower(trim($_POST['cplogin']));
        switch ($cplogin_action) {
            case 'webhost':
                _redirect_to_webhosting_control_panel($params);
                break;
            case 'mailhost':
                _redirect_to_mailhosting_control_panel($params);
                break;
            case 'dns':
                _redirect_to_dns_control_panel($params);
                break;
            case 'webmail':
                _redirect_to_webmail_control_panel($params);
                break;
            case 'websitebuilder':
                _redirect_to_websitebuilder_control_panel($params);
                break;
        }
    }
    global $smarty;
    global $orderbox;
    try {
        $is_processing = false;
        $plan_pieces = _get_plan_details($params['configoption1']);
        $api_path_orderid_from_domain = '/webservices/orderid.json';
        $api_path_order_details = '/webservices/details.json';
        $api_path_dns_details = '/webservices/dns-record.json';
        $order_id_result = $orderbox->api('GET', $api_path_orderid_from_domain, array('domain-name' => $params['domain']), $response, 'resellerclubwebservices', 'clientarea');
        if (is_array($order_id_result) && array_key_exists('status', $order_id_result) && strtolower($order_id_result['status']) == 'error') {
            $is_processing = true;
        } else {
            $order_id = $order_id_result;
            $order_details = $orderbox->api('GET', $api_path_order_details, array('order-id' => $order_id), $response, 'resellerclubwebservices', 'clientarea');
            $order_dns_details = $orderbox->api('GET', $api_path_dns_details, array('order-id' => $order_id), $response, 'resellerclubwebservices', 'clientarea');
        }
        $smarty->assign('is_processing', $is_processing);
        if ($is_processing) {
            $smarty->assign('wpp_status', 'Processing...');
        } else {
            $smarty->assign('wpp_status', $order_details['currentstatus']);
            if ('website builder' == $plan_pieces['type']) {
                $smarty->assign('is_websitebuilder', true);
                $smarty->assign('wpp_websitebuilder_panel', _display_websitebuilder_panel_form());
                $smarty->assign('wpp_ip_address', $order_details['ipaddress']);
                $smarty->assign('wpp_mailpop', $order_details['mailpop'] == '-1' ? 'Unlimited' : $order_details['mailpop']);
                $smarty->assign('wpp_diskspace', $order_details['webspace'] == '-1' ? 'Unlimited' : $order_details['webspace']);
                $smarty->assign('wpp_bandwidth', $order_details['bandwidth'] == '-1' ? 'Unlimited' : $order_details['bandwidth']);
            }
            $smarty->assign('wpp_mailhosting_panel', _display_mailhosting_panel_form());
            $smarty->assign('wpp_dns_panel', _display_dns_panel_form());
            $smarty->assign('wpp_webmail_panel', _display_webmail_panel_form());
            $smarty->assign('wpp_allocated_mailspace', $order_details['mailspace'] == '-1' ? 'Unlimited' : $order_details['mailspace'] . " GB");
            $smarty->assign('wpp_email_accounts', $order_details['no_of_mail_boxes'] == '-1' ? 'Unlimited' : $order_details['no_of_mail_boxes']);
            $smarty->assign('nameservers', $order_details['ns_detail']);
            $smarty->assign('dns_details', $order_dns_details);
        }
    } catch (Exception $e) {
        return $e->getMessage();
    }
}