!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/billing/system/application/controllers/   drwxr-xr-x
Free 13.18 GB of 57.97 GB (22.73%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     client.php (63.79 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
class client extends Controller
{

    function 
client()
    {

        
parent::Controller();
    }


    function 
index()
    {
        if(
$this->clogin->is_logged_in())
        {
            
redirect("admin/cpanel""Location");
        }
        else
        {
            
redirect("login/index""Location");
        }
    }
    

/**
*User Name Validation
*By Md. Golam Robbany
*Date : 2010-08-07
*Email : mgrnahid@gmail.com
*/

    
function validateUser()
    {

    
/* RECEIVE VALUE */
    
$validateValue=$_POST['validateValue'];
    
$validateId=$_POST['validateId'];
    
$validateError=$_POST['validateError'];
    
/* RETURN VALUE */
    
$arrayToJs = array();
    
$arrayToJs[0] = $validateId;
    
$arrayToJs[1] = $validateError;
    if(
$this->clientModel->checkClientLogin($validateValue) =="0"){        // validate??
    
$arrayToJs[2] = "true";            // RETURN TRUE
    
echo '{"jsonValidateReturn":'.json_encode($arrayToJs).'}';            // RETURN ARRAY WITH success
    
}else{
    for(
$x=0;$x<1000000;$x++){
        if(
$x == 990000){
            
$arrayToJs[2] = "false";
            echo 
'{"jsonValidateReturn":'.json_encode($arrayToJs).'}';        // RETURN ARRAY WITH ERROR
            
}
        }

    }

}


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Payment Form
 * @copyright 2011
 */
 
    
function showPaymentForm($idClient,$clinetType=1,$lastBalance 0,$id_reseller=-1)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
            if(
$clinetType == SIP_USER)
            {
                
$clientCURD $this->session->userdata('sipClientCURD');
                if(
$clientCURD == NO_ACCESS)
                
redirect("admin/cpanel/accessDenied""Location");
            }
            if(
$clinetType == ANI_USER)
            {
                
$clientCURD $this->session->userdata('aniClientCURD');
                if(
$clientCURD == NO_ACCESS)
                
redirect("admin/cpanel/accessDenied""Location");                
            }
            if(
$clinetType == WHOLESALE_USER)
            {
                
$clientCURD $this->session->userdata('wholeSaleClientCURD');
                if(
$clientCURD == NO_ACCESS)
                
redirect("admin/cpanel/accessDenied""Location");
            }
            
            
                
$data['paymentHistory'] = $this->clientModel->clientPaymentHistory($idClient,$clinetType);
                 
$data['id']        = '';
                
$data['id_client']        = $idClient;
                
$data['clienttype'] = $clinetType;
                
$data['lastbalance'] = $lastBalance;
                
$data['amount']        = '0.00';
                
$data['id_reseller']        = $id_reseller;
                
$data['type']        = 1;
                
$data['description']        = '';
                
$data['paymentdate'] = date('Y-m-d H:i:s');
                
$this->load->view('client/add_payment_form',$data);
               
        }
        else
        {
            
redirect("login/index""Location");
        }
    }


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add Payment of Client
 * @copyright 2011
 */
 
 

    
function addPayment()
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            if(
$clinetType == SIP_USER)
            {
                
$clientCURD $this->session->userdata('sipClientCURD');
                if(
$clientCURD != ALL_ACCESS)
                
redirect("admin/cpanel/accessDenied""Location");
            }
            elseif(
$clinetType == ANI_USER)
            {
                
$clientCURD $this->session->userdata('aniClientCURD');
                if(
$clientCURD != ALL_ACCESS)
                
redirect("admin/cpanel/accessDenied""Location");                
            }
            elseif(
$clinetType == WHOLESALE_USER)
            {
                
$clientCURD $this->session->userdata('wholeSaleClientCURD');
                if(
$clientCURD != ALL_ACCESS)
                
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$idClient $this->input->post('id_client');
               
$clienttype $this->input->post('clienttype');
               
$addDscripttion "Add Client Payment,  idClient: ".$idClient."and Client Type:".$clienttype;
               
$this->clientModel->addClientPayment($userID);
               
$this->generallib->addUserLog($userID,'-1','Insert',$addDscripttion);
               if(
$clienttype==SIP_USER)
               
redirect("client/sipEditForm/".$idClient"Location");
               if(
$clienttype==ANI_USER)
               
redirect("client/aniEditForm/".$idClient."/10""Location");
               if(
$clienttype==WHOLESALE_USER_TYPE)
               
redirect("client/editFormClientsIP/".$idClient."/23""Location");

            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }






/**
 ***********************************************************************
 * @Start WholeSale Client Section *************************************
 ***********************************************************************
*/



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show WholeSale Client List
 * @copyright 2011
 */
 

    
function clientsIPList($errorMessage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('wholeSaleClientCURD');
            if(
$clientCURD == NO_ACCESS)
            
redirect("admin/cpanel/accessDenied""Location");
            
            
$data['full_name'] = "NULL";
            
$data['login'] = "NULL";
            
$data['password'] = "NULL";
            
$data['rateList'] = $this->generallib->getTariffList($id_rate='NULL');
            
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($id_reseller='NULL');
            
$data['phone'] = "NULL";
            
$data['startoffset'] = "0";
            
$data['limit'] = LIMIT_PERPAGE;
            
$data['id_rate'] = "NULL";
            
$data['id_reseller'] = "NULL";
            
$data['total'] = $this->clientModel->getTotalnumClientsIP($login 'NULL',$password 'NULL',$full_name='NULL',$phone='NULL',$id_rate='NULL',$id_reseller='NULL');
            
$data['clientList'] = $this->clientModel->clientsIPList($startoffset 0,$limit LIMIT_PERPAGE,$login 'NULL',$password 'NULL',$full_name='NULL',$phone='NULL',$id_rate='NULL',$id_reseller='NULL');
            
$data['titleMessage'] = TITLE055;
            if(
$errorMessage ==-17)
            
$data['titleErrorMessage'] = FROMMESSAGE017;
            elseif(
$errorMessage ==16)
            
$data['titleErrorMessage'] = FROMMESSAGE016;
            elseif(
$errorMessage==15)
            
$data['titleErrorMessage'] = FROMMESSAGE015;
            else
            
$data['titleErrorMessage'] = "";
            
$this->load->view('wholesale/client_list',$data);
        }
        else
        {
            
redirect("logout""Location");
        }
    }





/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show WholeSale Client List Pagination
 * @copyright 2011
 */

    
function clientsIPListPagi($startoffset,$limit,$full_name,$login,$password,$id_rate,$id_reseller,$phone,$myRandom=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('wholeSaleClientCURD');
            
$data['full_name'] = $full_name;
            
$data['login'] = $login;
            
$data['password'] = $password;
            
$data['phone'] = $phone;
            
$data['startoffset'] = $startoffset;
            
$data['limit'] = $limit;
            
$data['id_rate'] = $id_rate;
            
$data['id_reseller'] = $id_reseller;
            
$data['total'] = $this->clientModel->getTotalnumClientsIP($login,$password,$full_name,$phone,$id_rate,$id_reseller);
            
$data['clientList'] = $this->clientModel->clientsIPList($startoffset,$limit,$login,$password,$full_name,$phone,$id_rate,$id_reseller);
            
$data['titleMessage'] = TITLE055;
            
$errorMessage ="";
            if(
$errorMessage ==-17)
            
$data['titleErrorMessage'] = FROMMESSAGE017;
            elseif(
$errorMessage ==16)
            
$data['titleErrorMessage'] = FROMMESSAGE016;
            elseif(
$errorMessage==15)
            
$data['titleErrorMessage'] = FROMMESSAGE015;
            else
            
$data['titleErrorMessage'] = "";
            
$this->load->view('wholesale/client_list_pagi',$data);
        }
        else
        {
            
redirect("logout""Location");
        }
    }
    

/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Add Form of Wholesale Client
 * @copyright 2011
 */
 

    
function addFormClientsIP($errorMesssage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('wholeSaleClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
$data['id']        = '';
                
$data['login']        = '';
                
$data['password']        = '';
                
$data['calllimit'] = '0';
                
$data['rateList']        = $this->generallib->getTariffList($id_rate='NULL');
                
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($id_reseller='NULL');
                
$data['balance']        = INIT_BALANCE;
                
$data['tech_prefix'] = '';
                
$data['billing_prefix'] = '';
                
$data['full_name'] = '';
                
$data['email'] = '';
                
$data['cell'] = '';
                
$data['phone'] = '';
                
$data['city'] = '';
                
$data['countryList']        = $this->generallib->getCountryList($country='NULL');
                
$data['state'] = '';
                
$data['address'] = '';
                
$data['status'] = '1';
                
$data['action']        = 'Add';

                
$data['titleMessage'] = TITLE056;
                
$data['titleAccountMessage'] = TITLE008;
                
$data['titlePersonalMessage'] = TITLE009;

                if(
$errorMesssage==0)
                
$data['titleErrorMessage'] = FROMMESSAGE001;
                elseif(
$errorMesssage==-1)
                
$data['titleErrorMessage'] = FROMMESSAGE001;
                elseif(
$errorMesssage==32)
                
$data['titleErrorMessage'] = FROMMESSAGE032;
                else
                
$data['titleErrorMessage'] = "";

                
$this->load->view('wholesale/add_form',$data);

            }
        }
        else
        {
            
redirect("logout""Location");
        }
    }





/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add/Edit GW Client
 * @copyright 2011
 */
 

    
function addEditClientsIP()
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('wholeSaleClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$id $this->input->post('id');
               
$action $this->input->post('action');
               
$login $this->input->post('login');
               
$password $this->input->post('password');
               
$id_rate $this->input->post('id_rate');
               
$balance $this->input->post('balance');
               
$checkLogin $this->clientModel->checkClientLogin($login);
 
               
$addDscripttion "Add Wholesale Client,  Login: ".$login;
               
$editDescripttion "Edit  Wholesale Client,  Login: ".$login;

               if(
$action=="Add")
               {
                  if(empty(
$login) OR empty($password) OR empty($balance) OR empty($id_rate))
                  
redirect("client/addFormClientsIP/-1""Location");
                    
                  if(
$checkLogin==1)
                  
redirect("client/addFormClientsIP/32""Location");

                  
$this->clientModel->addClientsIP($userID);
                  
$this->generallib->addUserLog($userID,'-1','Insert',$addDscripttion);
                  
redirect("client/clientsIPList/17""Location");
               }
               else
               {
                  if(empty(
$password) OR empty($id_rate))
                  
redirect("client/editFormClientsIP/".$id."/-1""Location");
 
                  
$this->clientModel->editClientsIP($userID);
                  
$this->generallib->addUserLog($userID,'-1','Edit',$editDescripttion);
                  
redirect("client/clientsIPList/16""Location");
               }

            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Edit Form of Wholesale Client
 * @copyright 2011
 */
 

    
function editFormClientsIP($id=0,$errorMesssage 0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('wholeSaleClientCURD');
            if(
$clientCURD == NO_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
$editInfo $this->clientModel->clientsIPEditInfo($id);
                if(
$editInfo==0)
                {
                   
redirect("client/clientsIPList""Location");
                }
                else
                {
                   foreach(
$editInfo as $row)
                   {
                        
$data['id']         = $row->id;
                        
$data['login']         = $row->login;
                        
$data['password']         = $row->password;
                        
$data['calllimit']         = $row->calllimit;
                        
$data['rateList']         = $this->generallib->getTariffList($row->id_rate);
                        
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($row->id_reseller);
                        
$data['balance']         = $row->balance;
                        
$data['tech_prefix']         = $row->tech_prefix;
                        
$data['billing_prefix']         = $row->billing_prefix;
                        
$data['full_name']         = $row->full_name;                    
                        
$data['phone']         = $row->phone;
                        
$data['cell']         = $row->cell;
                        
$data['email']         = $row->email;
                        
$data['countryList']        = $this->generallib->getCountryList($row->country);
                        
$data['address']         = $row->address;
                        
$data['status']         = $row->status;
                   }
                   
$data['action']        = 'edit';
                      if(
$errorMesssage==-3)
                   
$data['titleErrorMessage'] = FROMMESSAGE003;
                   elseif(
$errorMesssage==-1)
                   
$data['titleErrorMessage'] = FROMMESSAGE001;                   
                   elseif(
$errorMesssage==23)
                   
$data['titleErrorMessage'] = FROMMESSAGE023;                   
                   else
                   
$data['titleErrorMessage'] = FROMMESSAGE001;
                   
$data['titleAccountMessage'] = TITLE008;
                   
$data['titlePersonalMessage'] = TITLE009;
                   
$this->load->view('wholesale/edit_form',$data);
                }
            }
        }
        else
        {
            
redirect("logout""Location");
        }
    }



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add/Edit/Delete Form of Wholesale Client's IP Address
 * @copyright 2011
 */

    
function ipAddressFromClientsIP($id=0,$errorMesssage 0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('wholeSaleClientCURD');
            if(
$clientCURD == NO_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
$editInfo $this->clientModel->clientsIPEditInfo($id);
                if(
$editInfo==0)
                {
                   
redirect("client/clientsIPList""Location");
                }
                else
                {
                   foreach(
$editInfo as $row)
                   {
                        
$data['id']         = $row->id;
                        
$data['login']         = $row->login;
                        
$data['password']         = $row->password;
                        
$data['calllimit']         = $row->calllimit;
                        
$data['rateList']         = $this->generallib->getTariffList($row->id_rate);
                        
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($row->id_reseller);
                        
$data['balance']         = $row->balance;
                        
$data['tech_prefix']         = $row->tech_prefix;
                        
$data['billing_prefix']         = $row->billing_prefix;
                        
$data['full_name']         = $row->full_name;                    
                        
$data['phone']         = $row->phone;
                        
$data['cell']         = $row->cell;
                        
$data['email']         = $row->email;
                        
$data['countryList']        = $this->generallib->getCountryList($row->country);
                        
$data['address']         = $row->address;
                        
$data['status']         = $row->status;
                   }
                   
$data['ipAddressInfo'] = $this->clientModel->getIPAddressClinetsIP($id,WHOLESALE_USER);
                   
$data['action']        = 'Add';
                      if(
$errorMesssage==-3)
                   
$data['titleErrorMessage'] = FROMMESSAGE003;
                   elseif(
$errorMesssage==-1)
                   
$data['titleErrorMessage'] = FROMMESSAGE001;                   
                   elseif(
$errorMesssage==23)
                   
$data['titleErrorMessage'] = FROMMESSAGE023;                   
                   elseif(
$errorMesssage==36)
                   
$data['titleErrorMessage'] = FROMMESSAGE036;                   
                   elseif(
$errorMesssage==37)
                   
$data['titleErrorMessage'] = FROMMESSAGE037;                   
                   elseif(
$errorMesssage==38)
                   
$data['titleErrorMessage'] = FROMMESSAGE038;                   
                   else 
                   
$data['titleErrorMessage'] = FROMMESSAGE033;
                   
$data['titleAccountMessage'] = TITLE008;
                   
$data['titlePersonalMessage'] = FROMMESSAGE035;
                   
$this->load->view('wholesale/ip_address_form',$data);
                }
            }
        }
        else
        {
            
redirect("logout""Location");
        }
    }
    


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add Wholesale Client's IP Address
 * @copyright 2011
 */

    
function addClientsIPAddress()
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('wholeSaleClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$id $this->input->post('id');
               
$action $this->input->post('action');
               
$ipAddress $this->input->post('ipAddress');
               
$port $this->input->post('port');
 
               
$checkIPAddress $this->clientModel->checkClientsIPAddress($ipAddress);
 
               
$addDscripttion "Add Wholesale Client,  IP: ".$ipAddress;
               if(
$action=="Add")
               {
                  if(empty(
$ipAddress)  OR empty($port))
                  
redirect("client/ipAddressFromClientsIP/".$id."/-1""Location");
                    
                  if(
$checkIPAddress==1)
                  
redirect("client/ipAddressFromClientsIP/".$id."/36""Location");

                  
$this->clientModel->addClientsIPAddress($userID);
                  
$this->generallib->addUserLog($userID,'-1','Insert',$addDscripttion);
                  
redirect("client/ipAddressFromClientsIP/".$id."/37""Location");
               }

            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }


    

/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Delete Wholesale Client's IP Address
 * @copyright 2011
 */
 

    
function deleteClientsIP($idClient)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('wholeSaleClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$this->clientModel->deleteClientsIP($idClient);
               
redirect("client/clientsIPList/15""Location");
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }
    
        
        

/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Delete Wholesale Client's IP Address
 * @copyright 2011
 */
 
 
    
function deleteClientsIPAddress($idClient,$idIP)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('wholeSaleClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$this->clientModel->deleteClientsIPAddress($idClient,$idIP,WHOLESALE_USER_TYPE);
               
redirect("client/ipAddressFromClientsIP/".$idClient."/38""Location");
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }
    
            
            
    

/**
 ***********************************************************************
 * @Start SIP Client  Section **********************************************
 ***********************************************************************
*/


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Client SIP List
 * @copyright 2011
 */
 

    
function sipClientList($errorMessage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('sipClientCURD');
            if(
$clientCURD == NO_ACCESS)
            
redirect("admin/cpanel/accessDenied""Location");
            
            
$data['login'] = "NULL";
            
$data['password'] = "NULL";
            
$data['rateList'] = $this->generallib->getTariffList($id_rate='NULL');
            
$data['lastname'] = "NULL";
            
$data['startoffset'] = "0";
            
$data['limit'] = LIMIT_PERPAGE;
            
$data['id_rate'] = "NULL";
            
$data['id_reseller'] = "NULL";
            
$data['lot_id'] = "NULL";
            
$data['lotsList'] = $this->generallib->getLotsList($lot_id='NULL',$clientType SIP_USER);
            
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($id_reseller='NULL');
            
            
$data['total'] = $this->clientModel->getTotalnumClientsSIP($login='NULL',$password='NULL',$lot_id='NULL',$id_rate='NULL',$id_reseller='NULL');
            
$data['clientLIst'] = $this->clientModel->SIPclientList($startoffset 0,$limit LIMIT_PERPAGE,$login='NULL',$password='NULL',$lot_id='NULL',$id_rate='NULL',$id_reseller='NULL');
            
$data['titleMessage'] = TITLE017;
            if(
$errorMessage ==1)
            
$data['titleErrorMessage'] = FROMMESSAGE006;
            elseif(
$errorMessage ==21)
            
$data['titleErrorMessage'] = FROMMESSAGE021;
            elseif(
$errorMessage==15)
            
$data['titleErrorMessage'] = FROMMESSAGE006;
            elseif(
$errorMessage==6)
            
$data['titleErrorMessage'] = FROMMESSAGE006;
            else
            
$data['titleErrorMessage'] = "";
            
$this->load->view('client/sip_client_list',$data);
        }
        else
        {
            
redirect("logout""Location");
        }
    }


    


/**
 * @Show Reseller I List Pagination
*/

    
function sipClientListPagination($startoffset,$limit,$id_rate,$login,$password,$lot_id,$id_reseller,$myRandom=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('sipClientCURD');
            
$data['login'] = $login;
            
$data['password'] = $password;
            
//$data['lastname'] = $lastname;
            
$data['startoffset'] = $startoffset;
            
$data['id_rate'] = $id_rate;
            
$data['id_reseller'] = $id_reseller;
            
$data['limit'] = $limit;
            
$data['lot_id'] = $lot_id;
            
$data['total'] = $this->clientModel->getTotalnumClientsSIP($login,$password,$lot_id,$id_rate,$id_reseller);
            
$data['clientLIst'] = $this->clientModel->SIPclientList($startoffset,$limit,$login,$password,$lot_id,$id_rate,$id_reseller);
            
$data['titleMessage'] = TITLE017;
            
$data['titleErrorMessage'] = "";
            
$this->load->view('client/sip_clinet_list_pagi',$data);
        }
        else
        {
            
redirect("login/index""Location");
        }
    }



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Add Form of Clinet
 * @copyright 2011
 */
 

    
function addSIPForm($errorMesssage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('sipClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {            
                
$data['id']        = '';
                
$data['login']        = '';
                
$data['password']        = '';
                
$data['calllimit']        = '1';
                
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($id_reseller='NULL');
                
$data['balance']        = "0.00";
                
$data['rateList']        = $this->generallib->getTariffList($id_rate='NULL');
                
$data['full_name']        = '';
                
$data['limit_fnf']        = '';
                
$data['ivr_allow']        = '1';
                
$data['email']        = '';
                
$data['cell']        = '';
                
$data['phone']        = '';
                
$data['city']        = '';
                
$data['countryList']        = $this->generallib->getCountryList($country='NULL');
                
$data['state']        = '';
                
$data['address']        = '';
                
$data['status']        = '1';
                
$data['action']        = 'Add';
                
$data['titleAccountMessage'] = TITLE008;
                
$data['titlePersonalMessage'] = TITLE009;

                if(
$errorMesssage==0)
                
$data['titleErrorMessage'] = FORMMESSAGE01;
                elseif(
$errorMesssage==-1)
                
$data['titleErrorMessage'] = FORMMESSAGE01;
                elseif(
$errorMesssage==-2)
                
$data['titleErrorMessage'] = FORMMESSAGE15;
                elseif(
$errorMesssage==-3)
                
$data['titleErrorMessage'] = FORMMESSAGE03;
                elseif(
$errorMesssage==9)
                
$data['titleErrorMessage'] = FORMMESSAGE09;
                else
                
$data['titleErrorMessage'] = FORMMESSAGE01;
                
$this->load->view('client/sip_add_form',$data);

            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Add/Edit SIP Clients 
 * @copyright 2011
 */
 
    
function addEditSIPClients()
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('sipClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$id $this->input->post('id');
               
$action $this->input->post('action');
               
$login $this->input->post('login');
               
$password $this->input->post('password');
               
$id_rate $this->input->post('id_rate');
               
$checkClientLoginName $this->clientModel->checkClientLogin($login);
 
               
$addDscripttion "Add Client,  Login: ".$login;
               
$editDescripttion "Edit  Client,  Login: ".$login;

               if(
$action=="Add")
               {
                  
                  if(empty(
$login) OR empty($password) OR empty($id_rate))
                  
redirect("client/addSIPForm/-1""Location");

                  if(
$login==$password)
                  
redirect("client/addSIPForm/-3""Location");
                  
                  if(
$checkClientLoginName==1)
                  
redirect("client/addSIPForm/-2""Location");

                  
$this->clientModel->addSipClient($userID);
                  
$this->generallib->addUserLog($userID,'-1','Insert',$addDscripttion);
                  
redirect("client/sipClientList""Location");
               }
               else
               {
                  if(empty(
$login) OR empty($password) OR empty($id_rate))
                  
redirect("client/addSIPForm/".$id."/-1""Location");
                  if(
$login==$password)
                  
redirect("client/addSIPForm/".$id."/-3""Location");

                  
$this->clientModel->sipEditClient($userID);
                  
$this->generallib->addUserLog($userID,'-1','Edit',$editDescripttion);
                  
redirect("client/sipClientList/21""Location");
               }

            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Edit Form SIP Clients 
 * @copyright 2011
 */
 
    
function sipEditForm($id=0,$errorMesssage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('sipClientCURD');
            if(
$clientCURD == NO_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
$editInfo $this->clientModel->sipClientEditInfo($id);
                if(
$editInfo==0)
                {
                   
redirect("client/sipClientList""Location");
                }
                else
                {
                   foreach(
$editInfo as $row)
                   {
                        
$data['id']        = $row->id;
                     
$data['login']        = $row->login;
                     
$data['password']        = $row->password;
                     
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($row->id_reseller);
                     
$data['balance']        = $row->balance;
                     
$data['rateList']        = $this->generallib->getTariffList($row->id_rate);
                     
$data['calllimit']        = $row->calllimit;
                     
$data['ivr_allow']        = $row->ivr_allow;
                     
$data['full_name']        = $row->full_name;
                     
$data['email']        = $row->email;
                     
$data['cell']        = $row->cell;
                     
$data['phone']        = $row->phone;
                     
$data['city']        = $row->city;
                     
$data['countryList']        = $this->generallib->getCountryList($row->country);
                     
$data['state']        = $row->state;
                     
$data['address']        = $row->address;
                     
$data['status']        = $row->status;
                     
$data['action']        = 'edit';
                   }
                  if(
$errorMesssage==0)
                  
$data['titleErrorMessage'] = FROMMESSAGE001;
                  elseif(
$errorMesssage==-1)
                  
$data['titleErrorMessage'] = FROMMESSAGE001;
                  elseif(
$errorMesssage==-2)
                  
$data['titleErrorMessage'] = FROMMESSAGE002;
                    elseif(
$errorMesssage==-3)
                  
$data['titleErrorMessage'] = FROMMESSAGE003;
                  else
                  
$data['titleErrorMessage'] = FROMMESSAGE001;

                   
$data['titleAccountMessage'] = TITLE008;
                   
$data['titlePersonalMessage'] = TITLE009;
                   
$this->load->view('client/sip_edit_form',$data);
                }
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Delete SIP Clients 
 * @copyright 2011
 */
 
    
function deleteSipClient($idClient)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('sipClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$this->clientModel->deleteSipClient($idClient);
               
redirect("client/sipClientList/6""Location");
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }


    

/**
 ***********************************************************************
 * @Start Calling Card / ANI Section ***********************************
 ***********************************************************************
*/


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show ANI Client List
 * @copyright 2011
 */

    
function aniClientList($errorMessage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD == NO_ACCESS)
            
redirect("admin/cpanel/accessDenied""Location");
            
            
$data['login'] = "NULL";
            
$data['lot_id'] = "NULL";
            
$data['password'] = "NULL";
            
$data['rateList'] = $this->generallib->getTariffList($id_rate='NULL');
            
$data['fullname'] = "NULL";
            
$data['startoffset'] = "0";
            
$data['limit'] = LIMIT_PERPAGE;
            
$data['id_rate'] = "NULL";
            
$data['id_reseller'] = "NULL";
            
$data['phone'] = "NULL";
            
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($id_reseller='NULL');
            
$data['lotsList'] = $this->generallib->getLotsList($lot_id='NULL',$clientType ANI_USER);

            
$data['total'] = $this->clientModel->getTotalnumAniClient($login='NULL',$password='NULL',$fullname='NULL',$id_rate='NULL',$id_reseller='NULL',$lot_id 'NULL',$phone 'NULL');
            
$data['clientLIst'] = $this->clientModel->aniClienttList($startoffset 0,$limit LIMIT_PERPAGE,$login='NULL',$password='NULL',$fullname='NULL',$id_rate='NULL',$id_reseller='NULL',$lot_id 'NULL',$phone 'NULL');
            
$data['titleMessage'] = TITLE017;
            if(
$errorMessage ==1)
            
$data['titleErrorMessage'] = FROMMESSAGE006;
            elseif(
$errorMessage ==11)
            
$data['titleErrorMessage'] = FROMMESSAGE011;
            else
            
$data['titleErrorMessage'] = "";
            
$this->load->view('client/ani_client_list',$data);
        }
        else
        {
            
redirect("logout""Location");
        }
    }
    



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show ANI Client List Pagination
 * @copyright 2011
 */
 

    
function aniClientListPagination($startoffset,$limit,$fullname,$login,$password,$id_rate,$id_reseller,$lot_id,$phone,$myRandom =0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            
$data['login'] = $login;
            
$data['lot_id'] = $lot_id;
            
$data['password'] = $password;
            
$data['fullname'] = $fullname;
            
$data['startoffset'] = $startoffset;
            
$data['limit'] = $limit;
            
$data['id_rate'] = $id_rate;
            
$data['id_reseller'] = $id_reseller;
            
$data['phone'] = $phone;
            
$total $this->clientModel->getTotalnumAniClient($login,$password,$fullname,$id_rate,$id_reseller,$lot_id,$phone);
            
$clientLIst $this->clientModel->aniClienttList($startoffset,$limit,$login,$password,$fullname,$id_rate,$id_reseller,$lot_id,$phone);
            if(
$clientLIst == 0)
            {
                
$data['total'] = 0;
                
$data['clientLIst'] = $this->clientModel->aniNumberClienttList($startoffset,$limit,$login,$password,$fullname,$id_rate,$id_reseller,$lot_id,$phone);
            }
            else
            {
                
$data['total'] = $total;
                
$data['clientLIst'] = $clientLIst;
            }
            
$data['titleMessage'] = TITLE017;
            
$data['titleErrorMessage'] = "";
            
$this->load->view('client/ani_client_list_pagi',$data);
        }
        else
        {
            
redirect("logout""Location");
        }
    }
    
    
    


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Add Form of ANI Clinet
 * @copyright 2011
 */

    
function addANIForm($errorMesssage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
$data['id']        = '';
                
$data['login'] = '';
                
$data['password']        = '';
                
$data['pinnumber']        = '';
                
$data['lotsList'] = $this->generallib->getLotsList($lot_id='NULL');
                
$data['plan_id']        = '';
                
$data['calllimit'] = 1;
                
$data['rateList']        = $this->generallib->getTariffList($id_rate='NULL');
                
$data['balance']        = '0.00';
                
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($id_reseller='NULL');
                
$data['autoani']        = '1';
                
$data['full_name']        = '';
                
$data['email']        = '';
                
$data['cell']        = '';
                
$data['phone']        = '';
                
$data['city']        = '';
                
$data['countryList']        = $this->generallib->getCountryList($country='NULL');
                
$data['state']        = '';
                
$data['address']        = '';
                
$data['status']        = '1';
                
                
$data['action']        = 'Add';
                
$data['titleAccountMessage'] = TITLE008;
                
$data['titlePersonalMessage'] = TITLE009;

                if(
$errorMesssage==0)
                
$data['titleErrorMessage'] = "";
                elseif(
$errorMesssage==-1)
                
$data['titleErrorMessage'] = FROMMESSAGE001;
                elseif(
$errorMesssage==-2)
                
$data['titleErrorMessage'] = FROMMESSAGE007;
                  elseif(
$errorMesssage==8)
                
$data['titleErrorMessage'] = FROMMESSAGE008;
                  elseif(
$errorMesssage==39)
                
$data['titleErrorMessage'] = FROMMESSAGE039;
                else
                
$data['titleErrorMessage'] = "";
                
                
$this->load->view('client/ani_add_form',$data);

            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add/Edit ANI Client
 * @copyright 2011
 */
 
    
function addEditAni()
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$id $this->input->post('id');
               
$action $this->input->post('action');
               
$pinnumber $this->input->post('pinnumber');
               
$login $this->input->post('login');
               
$password $this->input->post('password');
               
$id_rate $this->input->post('id_rate');
               
               
$checkClientLoginName $this->clientModel->checkClientLogin($login);
               
$checkClientPINNumber $this->clientModel->checkAniClientPIN($pinnumber);
 
               
$addDscripttion "Add Client,  Login: ".$login;
               
$editDescripttion "Edit  Client,  Login: ".$login;

               if(
$action=="Add")
               {
                  if(empty(
$login) OR empty($password) OR empty($id_rate))
                  
redirect("client/addANIForm/-1""Location");
                  if(
$login==$password)
                  
redirect("client/addANIForm/-2""Location");
                  
                  if(
$checkClientLoginName==1)
                  
redirect("client/addANIForm/8""Location");

                  if(
$checkClientPINNumber==1)
                  
redirect("client/addANIForm/39""Location");

                  
$this->clientModel->addANIClient($userID);
                  
$this->generallib->addUserLog($userID,'-1','Insert',$addDscripttion);
                  
redirect("client/aniClientList""Location");
               }
               else
               {
                  if(empty(
$login) OR empty($password) OR empty($id_rate))
                  
redirect("client/sipEditForm/".$id."/-1""Location");
                  if(
$login==$password)
                  
redirect("client/sipEditForm/".$id."/-3""Location");

                  
$this->clientModel->editANIClient($userID);
                  
$this->generallib->addUserLog($userID,'-1','Edit',$editDescripttion);
                  
redirect("client/aniClientList/11""Location");
               }

            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Edit Form of ANI Client
 * @copyright 2011
 */
 
    
function aniEditForm($id=0,$errorMesssage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD == NO_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
$editInfo $this->clientModel->aniClientEditInfo($id);
                if(
$editInfo==0)
                {
                   
redirect("client/aniClientList""Location");
                }
                else
                {
                   foreach(
$editInfo as $row)
                   {
                        
$data['id']        = $row->id;
                     
$data['lotsList'] = $this->generallib->getLotsList($row->lot_id);
                     
$data['planList'] = $this->generallib->getPlanList($row->plan_id);
                     
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($row->id_reseller);
                     
$data['pinnumber']        = $row->pinnumber;
                     
$data['id_reseller']        = $row->id_reseller;
                     
$data['login']        = $row->login;
                     
$data['password']        = $row->password;
                     
$data['balance']        = $row->balance;
                     
$data['calllimit']        = $row->calllimit;
                     
$data['rateList']        = $this->generallib->getTariffList($row->id_rate);
                     
$data['autoani']        = $row->autoani;
                     
$data['full_name']        = $row->full_name;
                     
$data['email']        = $row->email;
                     
$data['cell']        = $row->cell;
                     
$data['phone']        = $row->phone;
                     
$data['city']        = $row->city;
                     
$data['countryList']        = $this->generallib->getCountryList($country='NULL');
                     
$data['state']        = $row->state;
                     
$data['address']        = $row->address;
                     
$data['status']        = $row->status;
                     
$data['action']        = 'edit';
                   }
                   
$data['aniNumberHistory'] = $this->clientModel->clientAniNumberHistory($id,$clinetType=2);
                   
$data['speedDialHistory'] = $this->clientModel->clientSpeedDialHistory($id,$clinetType=2);
                   
$data['action']        = 'edit';
                   
                  if(
$errorMesssage==0)
                  
$data['titleErrorMessage'] = FROMMESSAGE001;
                  elseif(
$errorMesssage==-1)
                  
$data['titleErrorMessage'] = FROMMESSAGE001;
                  elseif(
$errorMesssage==-2)
                  
$data['titleErrorMessage'] = FROMMESSAGE002;
                    elseif(
$errorMesssage==-3)
                  
$data['titleErrorMessage'] = FROMMESSAGE003;
                    elseif(
$errorMesssage==10)
                  
$data['titleErrorMessage'] = FROMMESSAGE010;
                   elseif(
$errorMesssage==12)
                  
$data['titleErrorMessage'] = FROMMESSAGE012;
                  elseif(
$errorMesssage==13)
                  
$data['titleErrorMessage'] = FROMMESSAGE013;
                  elseif(
$errorMesssage==40)
                  
$data['titleErrorMessage'] = FROMMESSAGE040;
                  elseif(
$errorMesssage==42)
                  
$data['titleErrorMessage'] = FROMMESSAGE042;
                  elseif(
$errorMesssage==43)
                  
$data['titleErrorMessage'] = FROMMESSAGE043;
                  elseif(
$errorMesssage==44)
                  
$data['titleErrorMessage'] = FROMMESSAGE044;
                  else
                  
$data['titleErrorMessage'] = FROMMESSAGE001;

                   
$data['titleAccountMessage'] = TITLE008;
                   
$data['titlePersonalMessage'] = TITLE050;
                   
$this->load->view('client/ani_edit_form',$data);
                }
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }




/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Delete ANI Client
 * @copyright 2011
 */
 

    
function deleteANIClient($idClient)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$this->clientModel->deleteANIClient($idClient);
               
redirect("client/aniClientList/1""Location");
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }
    
    

/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show ANI Number Form
 * @copyright 2011
 */

    
function showAniNumberForm($idClient,$clinetType=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD == NO_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
//$data['aniNumberHistory'] = $this->clientModel->clientAniNumberHistory($idClient,$clinetType);
                 
$data['id']        = '';
                
$data['id_client']        = $idClient;
                
$data['clienttype'] = $clinetType;
                
$data['aninumber'] = '';
                
$data['creationdate'] = date('Y-m-d H:i:s');
                
$this->load->view('client/ani_number_form',$data);
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add ANI Number Form
 * @copyright 2011
 */
 

    
function addANINumber()
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$idClient $this->input->post('id_client');
               
$clienttype $this->input->post('clienttype');
               
$aninumber $this->input->post('aninumber');
               
$addDscripttion "Add ANI Number,  idClient: ".$idClient." Number:".$aninumber;
               
$checkANINumber $this->clientModel->checkANINumberInfo($idClient,$clienttype,$aninumber);
               if(
$checkANINumber==0)
               {
                    
$this->clientModel->addClientANINumber($userID);
                       
$this->generallib->addUserLog($userID,'-1','Insert',$addDscripttion);
                       if(
$clienttype==SIP_USER)
                       
redirect("client/sipEditForm/".$idClient"Location");
                       if(
$clienttype==ANI_USER)
                       
redirect("client/aniEditForm/".$idClient."/12""Location");
               }
               else
               {
                         if(
$clienttype==SIP_USER)
                       
redirect("client/sipEditForm/".$idClient"Location");
                       if(
$clienttype==ANI_USER)
                       
redirect("client/aniEditForm/".$idClient."/40""Location");                
               }
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Delete ANI Number
 * @copyright 2011
 */

    
function deleteANINumber($id,$idClient)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$this->clientModel->deleteANINumber($id);
               
redirect("client/aniEditForm/".$idClient."/13""Location");
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Speed Dial Form
 * @copyright 2011
 */
 

    
function showSpeedDialForm($idClient,$clinetType=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD == NO_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
//$data['aniNumberHistory'] = $this->clientModel->clientAniNumberHistory($idClient,$clinetType);
                 
$data['id']        = '';
                
$data['id_client']        = $idClient;
                
$data['clienttype'] = $clinetType;
                
$data['name'] = '';
                
$data['phone'] = '';
                
$data['speeddial'] = '';
                
$data['creationdate'] = date('Y-m-d H:i:s');
                
$this->load->view('client/speed_dial_form',$data);
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }
    



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add Speed Dial
 * @copyright 2011
 */
 
 
    
function addSpeedDial()
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$idClient $this->input->post('id_client');
               
$clienttype $this->input->post('clienttype');
               
$phone $this->input->post('phone');
               
$speeddial $this->input->post('speeddial');
               
$addDscripttion "Add Speed Dail Number,  idClient: ".$idClient." Number:".$phone;
               
$checkSpeedDial $this->clientModel->cehckSpeedDialExits($idClient,$clienttype,$phone,$speeddial);
               if(
$checkSpeedDial==0)
               {
                    
$this->clientModel->addClientSpeedDial($userID);
                       
$this->generallib->addUserLog($userID,'-1','Insert',$addDscripttion);
                       if(
$clienttype==SIP_USER)
                       
redirect("client/sipEditForm/".$idClient"Location");
                       if(
$clienttype==ANI_USER)
                       
redirect("client/aniEditForm/".$idClient."/42""Location");
               }
               else
               {
                         if(
$clienttype==SIP_USER)
                       
redirect("client/sipEditForm/".$idClient"Location");
                       if(
$clienttype==ANI_USER)
                       
redirect("client/aniEditForm/".$idClient."/43""Location");                
               }
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }
    


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Delete Speed Dial
 * @copyright 2011
 */

    
function deleteSpeedDial($id,$idClient)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$clientCURD $this->session->userdata('aniClientCURD');
            if(
$clientCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$this->clientModel->deleteSpeedDial($id);
               
redirect("client/aniEditForm/".$idClient."/44""Location");
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }
    
    



        

/**
 ***********************************************************************
 * @Start DID number Section *******************************************
 ***********************************************************************
*/
    

/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show DID Number List
 * @copyright 2011
 */
 

    
function didNumberList($errorMessage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$didCURD $this->session->userdata('didCURD');
            if(
$didCURD == NO_ACCESS)
            
redirect("admin/cpanel/accessDenied""Location");
            
            
$data['IDprovider'] = "NULL";
            
$data['didNumber'] = "NULL";
            
$data['didType'] = 'NULL';
            
$data['location'] = 'NULL';
            
$data['wholeSaleClientList'] = $this->generallib->getClientIPList($IDprovider 'NULL');
            
$data['didTypeList']        = $this->generallib->getDIDTypeList($didType='NULL');
            
$data['startoffset'] = "0";
            
$data['limit'] = LIMIT_PERPAGE;
            
            
$data['total'] = $this->clientModel->getTotalnumDIDNumber($didNumber='NULL',$IDprovider='NULL',$didType='NULL',$location ='NULL');
            
$data['didNumberList'] = $this->clientModel->didNumberList($startoffset 0,$limit LIMIT_PERPAGE,$didNumber='NULL',$IDprovider='NULL',$didType='NULL',$location 'NULL');
            
$data['titleMessage'] = TITLE058;
            if(
$errorMessage ==18)
            
$data['titleErrorMessage'] = FROMMESSAGE018;
            elseif(
$errorMessage ==19)
            
$data['titleErrorMessage'] = FROMMESSAGE019;
            elseif(
$errorMessage==20)
            
$data['titleErrorMessage'] = FROMMESSAGE020;
            else
            
$data['titleErrorMessage'] = "";
            
$this->load->view('wholesale/didnumber_list',$data);
        }
        else
        {
            
redirect("logout""Location");
        }
    }




/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show DID Number List Pagination
 * @copyright 2011
 */
 

    
function didNumberListPagination($startoffset,$limit,$didNumber,$IDprovider,$didType,$location,$myRandom=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$didCURD $this->session->userdata('didCURD');
            
$data['IDprovider'] = $IDprovider;
            
$data['didNumber'] = $didNumber;
            
$data['location'] = $location;
            
$data['didType'] = $didType;
            
$data['startoffset'] = $startoffset;
            
$data['limit'] = $limit;

            
$data['total'] = $this->clientModel->getTotalnumDIDNumber($didNumber,$IDprovider,$didType);
            
$data['didNumberList'] = $this->clientModel->didNumberList($startoffset,$limit,$didNumber,$IDprovider,$didType);
            
$data['titleMessage'] = TITLE058;
            
$errorMessage 0;
            if(
$errorMessage ==18)
            
$data['titleErrorMessage'] = FROMMESSAGE018;
            elseif(
$errorMessage ==19)
            
$data['titleErrorMessage'] = FROMMESSAGE019;
            elseif(
$errorMessage==20)
            
$data['titleErrorMessage'] = FROMMESSAGE020;
            else
            
$data['titleErrorMessage'] = "";
            
$this->load->view('wholesale/didnumber_list_pagi',$data);
        }
        else
        {
            
redirect("logout""Location");
        }
    }
    
    

/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add Form of DID Number
 * @copyright 2011
 */


    
function addFormDIDNumber($errorMesssage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$didCURD $this->session->userdata('didCURD');
            if(
$didCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {

                
$data['id_did']        = '';
                
$data['wholeSaleClientList'] = $this->generallib->getClientIPList($IDprovider 'NULL');
                
$data['didnumber']        = '';
                
$data['location']        = '';
                
$data['didTypeList']        = $this->generallib->getDIDTypeList($didType='NULL');
                
$data['status'] = '1';

                
$data['action']        = 'Add';

                
$data['titleMessage'] = TITLE059;

                if(
$errorMesssage==0)
                
$data['titleErrorMessage'] = FROMMESSAGE001;
                elseif(
$errorMesssage==-1)
                
$data['titleErrorMessage'] = FROMMESSAGE001;
                elseif(
$errorMesssage==-2)
                
$data['titleErrorMessage'] = FROMMESSAGE014;
                elseif(
$errorMesssage==41)
                
$data['titleErrorMessage'] = FROMMESSAGE041;
                else
                
$data['titleErrorMessage'] = "";

                
$this->load->view('wholesale/add_did_form',$data);

            }
        }
        else
        {
            
redirect("logout""Location");
        }
    }


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add/Edit DID Number
 * @copyright 2011
 */

    
function addEditDIDNumber()
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$didCURD $this->session->userdata('didCURD');
            if(
$didCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$id_did $this->input->post('id_did');
               
$action $this->input->post('action');
               
$IDprovider $this->input->post('IDprovider');
               
$didnumber $this->input->post('didnumber');
               

               
$addDscripttion "Add DID number,  DID Number: ".$didnumber;
               
$editDescripttion "Edit DID number,  DID Number: ".$didnumber;

               if(
$action=="Add")
               {
                  if(empty(
$didnumber) OR empty($IDprovider))
                  
redirect("client/addFormDIDNumber/-1""Location");
                  
$checkDIDNumber $this->clientModel->didNumberExits($didnumber);
                  if(
$checkDIDNumber==1)
                  
redirect("client/addFormDIDNumber/41""Location");
                    
$this->clientModel->addDIDNumber();
                  
$this->generallib->addUserLog($userID,'-1','Insert',$addDscripttion);
                  
redirect("client/didNumberList/18""Location");
               }
               else
               {
                  if(empty(
$didnumber) OR empty($IDprovider))
                  
redirect("client/addFormDIDNumber/".$id_did."/-1""Location");
 
                  
$this->clientModel->editDIDNumber($userID);
                  
$this->generallib->addUserLog($userID,'-1','Edit',$editDescripttion);
                  
redirect("client/didNumberList/19""Location");
               }

            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Edit Form of DID Number
 * @copyright 2011
 */

    
function editFormDIDNumber($id=0,$errorMesssage 0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$didCURD $this->session->userdata('didCURD');
            if(
$didCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
$editInfo $this->clientModel->didNumberEditInfo($id);
                if(
$editInfo==0)
                {
                   
redirect("client/didNumberList""Location");
                }
                else
                {
                   foreach(
$editInfo as $row)
                   {
                        
$data['id_did']         = $row->id_did;
                        
$data['wholeSaleClientList'] = $this->generallib->getClientIPList($row->id_client);
                        
$data['didnumber']         = $row->didnumber;
                        
$data['location']         = $row->location;
                        
$data['didTypeList']        = $this->generallib->getDIDTypeList($row->didtype);
                        
$data['status']         = $row->status;
                   }
                   
$data['action']        = 'edit';
                   
$data['titleMessage'] = TITLE059;

                    if(
$errorMesssage==0)
                    
$data['titleErrorMessage'] = FROMMESSAGE001;
                    elseif(
$errorMesssage==-1)
                    
$data['titleErrorMessage'] = FROMMESSAGE001;
                    elseif(
$errorMesssage==-2)
                    
$data['titleErrorMessage'] = FROMMESSAGE014;
                    else
                    
$data['titleErrorMessage'] = "";
                
                   
$this->load->view('wholesale/add_did_form',$data);
                }
            }
        }
        else
        {
            
redirect("logout""Location");
        }
    }


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Delete DID Number
 * @copyright 2011
 */
 

    
function deleteDIDNumber($id)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$didCURD $this->session->userdata('didCURD');
            if(
$didCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
$this->clientModel->deleteDIDNumber($id);
               
redirect("client/didNumberList/20""Location");
            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }



/**
 ***********************************************************************
 * @Start Account Generation Section ***********************************
 ***********************************************************************
*/


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Lots Name List
 * @copyright 2011
 */
 

    
function lotsNameList($errorMessage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$lotsCURD $this->session->userdata('lotsCURD');
            if(
$lotsCURD == NO_ACCESS)
            
redirect("admin/cpanel/accessDenied""Location");
            
            
$data['id_reseller'] = "NULL";
            
$data['description'] = "NULL";
            
$data['clienttype'] = 'NULL';
            
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($id_reseller 'NULL');
            
$data['startoffset'] = "0";
            
$data['limit'] = LIMIT_PERPAGE;
            
            
$data['total'] = $this->clientModel->getTotalnumLotsName($id_reseller='NULL',$description='NULL',$clienttype='NULL');
            
$data['lotsNameList'] = $this->clientModel->lotsNameList($startoffset 0,$limit LIMIT_PERPAGE,$id_reseller='NULL',$description='NULL',$clienttype='NULL');
            
$data['titleMessage'] = TITLE058;
            if(
$errorMessage == 46)
            
$data['titleErrorMessage'] = FROMMESSAGE046;
            elseif(
$errorMessage == 47)
            
$data['titleErrorMessage'] = FROMMESSAGE047;
            elseif(
$errorMessage==48)
            
$data['titleErrorMessage'] = FROMMESSAGE048;
            elseif(
$errorMessage==49)
            
$data['titleErrorMessage'] = FROMMESSAGE049;
            elseif(
$errorMessage==50)
            
$data['titleErrorMessage'] = FROMMESSAGE050;
            else
            
$data['titleErrorMessage'] = "";
            
$this->load->view('client/lots_list',$data);
        }
        else
        {
            
redirect("logout""Location");
        }
    }





/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Show Lots Name List Pagination
 * @copyright 2011
 */
 

    
function lotsNameListPagi($startoffset,$limit,$id_reseller,$description,$clientType,$myRandom=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$lotsCURD $this->session->userdata('lotsCURD');
            
$data['id_reseller'] = $id_reseller;
            
$data['description'] = $description;
            
$data['clienttype'] = $clientType;
            
$data['startoffset'] = $startoffset;
            
$data['limit'] = $limit;
            
            
$data['total'] = $this->clientModel->getTotalnumLotsName($id_reseller,$description,$clientType);
            
$data['lotsNameList'] = $this->clientModel->lotsNameList($startoffset,$limit,$id_reseller,$description,$clientType);
            
$data['titleMessage'] = TITLE058;
            
$data['titleErrorMessage'] = "";
            
$this->load->view('client/lots_list_pagi',$data);
        }
        else
        {
            
redirect("logout""Location");
        }
    }




/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add Form of DID Number
 * @copyright 2011
 */


    
function addFormLotsName($errorMesssage=0)
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$lotsCURD $this->session->userdata('lotsCURD');
            if(
$lotsCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {

                
$data['lot_id']        = '';
                
$data['resellerLevel1List'] = $this->generallib->getResellerLeve1List($id_reseller 'NULL');
                
$data['description']        = '';
                
$data['rateList']        = $this->generallib->getTariffList($id_rate 'NULL');
                
$data['balance'] = LOT_INIT_BALANCE_LIMIT;
                
$data['calllimit'] = 1;
                
$data['status'] = 1;
                
                
$data['action']        = 'Add';
                
$data['titleAccountMessage'] = TITLE066;
                
$data['titlePersonalMessage'] = TITLE067;

                if(
$errorMesssage==0)
                
$data['titleErrorMessage'] = FROMMESSAGE001;
                elseif(
$errorMesssage==-1)
                
$data['titleErrorMessage'] = FROMMESSAGE001;
                elseif(
$errorMesssage==45)
                
$data['titleErrorMessage'] = FROMMESSAGE045;
                elseif(
$errorMesssage==41)
                
$data['titleErrorMessage'] = FROMMESSAGE041;
                else
                
$data['titleErrorMessage'] = "";

                
$this->load->view('client/lots_add_form',$data);

            }
        }
        else
        {
            
redirect("logout""Location");
        }
    }




/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Add Lots Name
 * @copyright 2011
 */

    
function addLotsName()
    {
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$lotsCURD $this->session->userdata('lotsCURD');
            if(
$lotsCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
               
set_time_limit (360000);
               
$description $this->input->post('description');
               
$clientType $this->input->post('clientType');
               
$id_reseller $this->input->post('id_reseller');
               
$balance $this->input->post('balance');
               
$id_rate $this->input->post('id_rate');
               
$calllimit $this->input->post('calllimit');
               
$numClients $this->input->post('numClients');
               
               
$action $this->input->post('action');                              

               
$addDscripttion "Add New lot,  Lot Name: ".$description;

               if(
$action=="Add")
               {
                     if(empty(
$description) OR empty($clientType) OR empty($numClients) OR empty($id_rate) OR empty($numClients))
                     
redirect("client/addFormLotsName/-1""Location");
                     
                     if(empty(
$balance) OR !is_numeric($balance) OR $balance <= 0)
                     
$balance 0;
                     
                     if(empty(
$numClients) OR !is_numeric($numClients) OR $numClients <= 0)
                     
$numClients 0;
                     
                     
$totalBalance $balance*$numClients;
                     
                     if(empty(
$id_reseller) OR !is_numeric($id_reseller) OR $id_reseller <= 0)
                     
$resellerBalanceLimit 100000000;
                     else
                     
$resellerBalanceLimit $this->generallib->getReseller1BalanceLimit($id_reseller);
                     
                     if(
$totalBalance $resellerBalanceLimit)
                     
redirect("client/addFormLotsName/45""Location");
  
                    
$this->clientModel->addClientLotsName($userID);
                  
$this->generallib->addUserLog($userID,'1','Insert',$addDscripttion);
                  
redirect("client/lotsNameList/46""Location");
               }
               else
               {
                    
redirect("client/lotsNameList/-1""Location");
               }

            }
        }
        else
        {
            
redirect("login/index""Location");
        }
    }
    



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Inactive Lot Name
 * @copyright 2011
 */


    
function inactiveLot($idLot 0,$clientType 0)
    {        
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$lotsCURD $this->session->userdata('lotsCURD');
            if(
$lotsCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
                
set_time_limit (360000);

                
$dscripttion "Inactive Lot Name,  Lot ID: ".$idLot;
                if(
$clientType == SIP_USER)
                
$this->clientModel->inactiveClientsSipLot($idLot,$clientType);
                if(
$clientType == ANI_USER)
                
$this->clientModel->inactiveClientsPinLot($idLot);
                
$this->generallib->addUserLog($userID,'-1','Inactive',$dscripttion);
                
                
redirect("client/lotsNameList/47""Location");
                            
            }
        }
        else
        {
            
redirect("logout""Location");
        }
    }



/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Active Lot Name
 * @copyright 2011
 */


    
function activeLot($idLot 0,$clientType 0)
    {        
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$lotsCURD $this->session->userdata('lotsCURD');
            if(
$lotsCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
                
set_time_limit (360000);

                
$dscripttion "Active Lot Name,  Lot ID: ".$idLot;
                if(
$clientType == SIP_USER)
                
$this->clientModel->activeClientsSipLot($idLot,$clientType);
                if(
$clientType == ANI_USER)
                
$this->clientModel->activeClientsPinLot($idLot);
                
$this->generallib->addUserLog($userID,'-1','Active',$dscripttion);
                
                
redirect("client/lotsNameList/48""Location");
                            
            }
        }
        else
        {
            
redirect("logout""Location");
        }
    }


/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Export Lot Name
 * @copyright 2011
 */


    
function exportLot($idLot 0,$clientType 2)
    {        
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$lotsCURD $this->session->userdata('lotsCURD');
            if(
$lotsCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {
                
                
set_time_limit (360000);
                
$clientList $this->clientModel->exportClientsLotsInfo($idLot,$clientType);
                
                if(
$clientType == SIP_USER)
                
$strClients "SL,Login,Password,Balance,Status"."\n";
                if(
$clientType == ANI_USER)
                
$strClients "SL,PIN Number,Password,Balance,Status"."\n";
                
                if(
$clientList == 0)
                
redirect("client/lotsNameList/49""Location");
                else
                {   
$count 1;
                    foreach(
$clientList as $row)
                    {
                        
$login $row->login;
                        
$password $row->password;
                        
$balance $row->balance;
                        
$status  $row->status;
                        if(
$status == 0)
                        
$statusStr "Inactive";
                        else
                        
$statusStr "Active";                        
                        
$strClients .=$count.",".$login.",".$password.",".$balance.",".$statusStr."\n";
                        
$count ++;
                    }                   
                   
header("Content-type: application/vnd.ms-excel");
                     
header("Content-disposition: csv; filename=clients_list_" date("Ymd") .".csv");
                     print 
$strClients;
                     exit;    
                }                            
            }
        }
        else
        {
            
redirect("logout""Location");
        }
    }





/**
 * @author: Md. Golam Rabbany
 * @email: mgrnahid@gmail.com
 * @description: Active Lot Name
 * @copyright 2011
 */


    
function deleteLot($idLot 0,$clientType 0)
    {        
        if(
$this->clogin->is_logged_in())
        {
            
$userID $this->session->userdata('userID');
            
$lotsCURD $this->session->userdata('lotsCURD');
            if(
$lotsCURD != ALL_ACCESS)
            {
              
redirect("admin/cpanel/accessDenied""Location");
            }
            else
            {                
                
set_time_limit (360000);
                
$dscripttion "Delete Lot Name,  Lot ID: ".$idLot;
                if(
$clientType == SIP_USER)
                
$this->clientModel->deleteClientsSipLot($idLot,$clientType);
                if(
$clientType == ANI_USER)
                
$this->clientModel->deleteClientsPinLot($idLot,$clientType);
                
$this->generallib->addUserLog($userID,'-1','Delete',$dscripttion);
                
                
redirect("client/lotsNameList/50""Location");
                            
            }
        }
        else
        {
            
redirect("logout""Location");
        }
    }


    
    
        
            

}
?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0148 ]--