function check_payment_login($url_redirect)
{
    /* ----------------------- check login first ------------------------ */
    if (getVarClean("p_user_loket_id", "str", "") == "" or getVarClean("user_name", "str", "") == "" or getVarClean("password", "str", "") == "") {
        echo '<script>
                loadContentWithParams("pay_process-payment_login.php",{
                    url_redirect : "' . $url_redirect . '"
                });
            </script>';
        exit;
    } else {
        /* re-check login */
        $user_name = getVarClean("user_name", "str", "");
        $password = getVarClean("password", "str", "");
        $data = file_get_contents(PAYMENT_WS_URL . 'ws.php?type=json&module=paymentccbs&class=p_user_loket&method=valid_login&user_name=' . $user_name . '&password='******'rows'];
        if ($p_user_loket_id < 0) {
            echo '<script>
                loadContentWithParams("pay_process-payment_login.php",{
                    url_redirect : "' . $url_redirect . '"
                });
            </script>';
            exit;
        }
    }
    /* ----------------------- end check login ------------------------ */
}
 function set_app_module()
 {
     $ci =& get_instance();
     $module_id = getVarClean('module_id', 'str', '');
     $data = array('items' => array(), 'success' => false, 'message' => '');
     try {
         check_login(true);
         $userdata = array('p_user_id' => $ci->session->userdata('p_user_id'), 'user_name' => $ci->session->userdata('user_name'), 'full_name' => $ci->session->userdata('full_name'), 'email_address' => $ci->session->userdata('email_address'), 'logged_in' => true, 'module_id' => $module_id);
         $ci->session->set_userdata($userdata);
         $data['success'] = true;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
     }
     return $data;
 }
                            </br>
                              <input type="hidden" class="form-control" id="form_summary_subscriber_id">
                              <input type="hidden" class="form-control" id="form_client_ip_address" value="<?php 
echo get_ip_address();
?>
">
                              <input type="hidden" class="form-control" id="form_p_user_loket_id" value="<?php 
echo getVarClean("p_user_loket_id", "str", "");
?>
">
                              <input type="hidden" class="form-control" id="form_user_name" value="<?php 
echo getVarClean("user_name", "str", "");
?>
">
                              <input type="hidden" class="form-control" id="form_password" value="<?php 
echo getVarClean("password", "str", "");
?>
">
                    		  <button id="btnPembatalan" class="btn btn-primary btn-sm">Cancel Payment</button>
                		  </div>

            		  </div>
            	 </div>
            </div>
        </div>
    </div>
</div>


<script>
var responseError = false;
					<button class="btn btn-white btn-success btn-round" id="payment_penalty_btn_add">
						<i class="ace-icon glyphicon glyphicon-plus bigger-120 green"></i>
					    Add
					</button>

					<button class="btn btn-white btn-danger btn-round" id="payment_penalty_btn_delete">
						<i class="ace-icon glyphicon glyphicon-trash bigger-120 red"></i>
						Delete
					</button>
					
					<input id="form_p_penalty_group_id" type="hidden" placeholder="ID Penalty Group" value="<?php 
echo getVarClean('p_penalty_group_id', 'int', 0);
?>
">
					<input id="form_p_penalty_group_code" type="hidden" placeholder="Code Penalty Group" value="<?php 
echo getVarClean('p_penalty_group_code', 'str', '');
?>
">
				</p>
                
		        <table id="payment_penalty_grid_selection" class="table table-striped table-bordered table-hover">
                <thead>
                  <tr>
                    <th data-identifier="true" data-visible="false" data-header-align="center" data-align="center" data-column-id="p_payment_penalty_id"> ID Payment Penalty</th>
                     <th data-header-align="center" data-align="center" data-formatter="opt-edit" data-sortable="false" data-width="100">Options</th>
                     <th data-column-id="month_late" data-formatter="month_late" data-width="190" data-header-align="center" data-align="right">Month Late</th>
                     <th data-column-id="day_low_limit" data-formatter="day_low_limit" data-header-align="center" data-align="right"> Day Low Limit</th>
                     <th data-column-id="day_up_limit" data-formatter="day_up_limit" data-header-align="center" data-align="right"> Day Up Limit </th>
                     <th data-column-id="penalty_amount" data-formatter="penalty_amount" data-header-align="center" data-align="right"> Penalty Amount </th>
                     <th data-column-id="penalty_pct" data-formatter="penalty_pct" data-header-align="center" data-align="right"> Penalty Pct </th>
                     <th data-column-id="added_amount" data-formatter="added_amount" data-header-align="center" data-align="right"> Added Amount </th>
<div class="row" style="display:none;" id="role_menu_form_add_edit">
    <div class="col-xs-12">
        <div class="well well-sm">
		    <div class="inline middle blue bigger-150" id="role_menu_form_title"> Add/Edit Menu Role </div>
		</div>
        <form class="form-horizontal" role_menu="form" id="role_menu_form">

            <?php 
$ci =& get_instance();
$sql = "SELECT * FROM v_p_menu_tree WHERE p_application_id = " . getVarClean('p_application_id', 'int', 0) . "\r\n                        AND p_menu_id NOT IN (SELECT p_menu_id FROM p_role_menu WHERE p_role_id = " . getVarClean('p_role_id', 'int', 0) . ")";
$query = $ci->db->query($sql);
$itemsMenu = $query->result_array();
?>
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right"> Menu *</label>
                <input id="form_p_role_menu_id" type="text" style="display:none;">
                <div class="col-sm-9">
                    <select id="form_p_menu_id" class="col-xs-10 col-sm-5 required">
                        <option value=""> -- Please Select Menu -- </option>
            		    <?php 
foreach ($itemsMenu as $item) {
    ?>
            		    <option value="<?php 
    echo $item['p_menu_id'];
    ?>
"> <?php 
    echo $item['code'];
    ?>
 </option>
            		    <?php 
}
 function login_payment()
 {
     $data = array('items' => array(), 'success' => false, 'message' => '');
     $user_name = getVarClean('user_name', 'str', '');
     $password = getVarClean('password', 'str', '');
     try {
         $data = file_get_contents(PAYMENT_WS_URL . 'ws.php?type=json&module=paymentccbs&class=p_user_loket&method=valid_login&user_name=' . $user_name . '&password='******'rows'];
         if ($p_user_loket_id < 0 and $p_user_loket_id == -11) {
             $data['success'] = false;
             throw new Exception("Your password has been expired. Please contact Your administrators.");
         } else {
             if ($p_user_loket_id < 0 or empty($p_user_loket_id)) {
                 $data['success'] = false;
                 throw new Exception("Your username or password is incorrect");
             }
         }
         $data['success'] = true;
         $data['items'] = $p_user_loket_id;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
         $data['total'] = 0;
     }
     return $data;
 }
    }
}

function menu_show_tree_menu() {
    if(!($("#right-tree-menu").data('bs.modal') || {isShown: false}).isShown) {
        $("#right-tree-menu").modal("show");     
    }        
}

jQuery(function($) {
    $("#right-tree-menu").ace_aside();
    
    var data = [
        <?php 
$ci =& get_instance();
$p_application_id = getVarClean("p_application_id", "int", 0);
/*$sql = "select p_menu_id, parent_id, menu, file_name as path_file_name,  description
  from ifl.f_display_menu_tree ($p_application_id)";*/
$sql = "SELECT p_menu_id p_menu_id, NVL (parent_id, 0) parent_id, menu, path_file_name, description " . "FROM (SELECT   p_menu_id, parent_id, code menu, NVL (file_name, '0') path_file_name, description, " . "listing_no FROM p_menu WHERE is_active = 'Y' AND p_application_id = " . $p_application_id . " " . "ORDER BY NVL (parent_id, 0), listing_no) x START WITH nvl(parent_id,0) = 0 " . "CONNECT BY PRIOR x.p_menu_id = x.parent_id ORDER SIBLINGS BY NVL (listing_no, 9999)";
$query = $ci->db->query($sql);
$items = $query->result_array();
$ci->load->model('adm_sistem/p_application');
$itemApp = $ci->p_application->get($p_application_id);
/*
    structure
    [{ "id": "2",
      "parentid": "0",
      "text": "Hot Chocolate"
    }]
*/
$total = count($items);
					<button class="btn btn-white btn-success btn-round" id="application_role_btn_add">
						<i class="ace-icon glyphicon glyphicon-plus bigger-120 green"></i>
					    Add
					</button>

					<button class="btn btn-white btn-danger btn-round" id="application_role_btn_delete">
						<i class="ace-icon glyphicon glyphicon-trash bigger-120 red"></i>
						Delete
					</button>
					
					<input id="form_p_role_id" type="hidden" placeholder="ID Role" value="<?php 
echo getVarClean('p_role_id', 'int', 0);
?>
">
					<input id="form_role_code" type="hidden" placeholder="Role Code" value="<?php 
echo getVarClean('role_code', 'str', '');
?>
">
				</p>

		        <table id="application_role_grid_selection" class="table table-striped table-bordered table-hover">
                <thead>
                  <tr>
                    <th data-identifier="true" data-visible="false" data-header-align="center" data-align="center" data-column-id="p_application_role_id"> ID Role</th>
                     <th data-header-align="center" data-align="center" data-formatter="opt-edit" data-sortable="false" data-width="100">Options</th>
                     <th data-column-id="application_code" data-width="190">Module Code</th>
                  </tr>
                </thead>
              </table>
		    </div>
	    </div>
 function updateInfo()
 {
     $user_password1 = trim(getVarClean('user_password1', 'str', ''));
     $user_password2 = trim(getVarClean('user_password2', 'str', ''));
     $user_email = trim(getVarClean('user_email', 'str', ''));
     $user_realname = trim(getVarClean('user_realname', 'str', ''));
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $ci =& get_instance();
     $uid = (int) $ci->session->userdata('p_user_id');
     try {
         if (empty($uid)) {
             throw new Exception('Bad Params : Empty UserID');
         }
         $ci->load->model('adm_sistem/p_user');
         $table = $ci->p_user;
         $table->actionType = 'UPDATE';
         $record = array('p_user_id' => $uid, 'email_address' => $user_email, 'full_name' => $user_realname);
         if (!empty($user_password1)) {
             if (strcmp($user_password1, $user_password2) != 0) {
                 throw new Exception("Your password does not match. Please check again.");
             }
             if (strlen($user_password1) < 5) {
                 throw new Exception("Mininum password length is 5 characters");
             }
             $record['user_pwd'] = $user_password1;
         }
         if (!empty($user_email)) {
             if (!isValidEmail($user_email)) {
                 throw new Exception("Your email address format is incorrect");
             }
         }
         $table->setRecord($record);
         $table->update();
         $userdata = array('p_user_id' => $record['p_user_id'], 'user_name' => $ci->session->userdata('user_name'), 'full_name' => $record['full_name'], 'email_address' => $record['email_address'], 'logged_in' => true);
         $ci->session->set_userdata($userdata);
         $data['success'] = true;
         $data['message'] = 'Update Profile Success';
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
     }
     return $data;
 }
					<button class="btn btn-white btn-success btn-round" id="stamp_btn_add">
						<i class="ace-icon glyphicon glyphicon-plus bigger-120 green"></i>
					    Add
					</button>

					<button class="btn btn-white btn-danger btn-round" id="stamp_btn_delete">
						<i class="ace-icon glyphicon glyphicon-trash bigger-120 red"></i>
						Delete
					</button>
					
					<input id="form_p_stamp_group_id" type="hidden" placeholder="ID Stamp Group" value="<?php 
echo getVarClean('p_stamp_group_id', 'int', 0);
?>
">
					<input id="form_p_stamp_group_code" type="hidden" placeholder="Code Stamp Group" value="<?php 
echo getVarClean('p_stamp_group_code', 'str', '');
?>
">
				</p>
                
		        <table id="stamp_grid_selection" class="table table-striped table-bordered table-hover">
                <thead>
                  <tr>
                    <th data-identifier="true" data-visible="false" data-header-align="center" data-align="center" data-column-id="p_stamp_id"> ID Stamp</th>
                     <th data-header-align="center" data-align="center" data-formatter="opt-edit" data-sortable="false" data-width="100">Options</th>
                     <th data-column-id="amt_low_limit" data-formatter="amt_low_limit" data-width="190" data-header-align="center" data-align="right">Low Limit Amount</th>
                     <th data-column-id="amt_up_limit" data-formatter="amt_up_limit" data-header-align="center" data-align="right"> Up Limit Amount</th>
                     <th data-column-id="stamp_amount" data-formatter="stamp_amount" data-header-align="center" data-align="right"> Stamp Amount </th>
                  </tr>
                </thead>
              </table>
<div class="row" style="display:none;" id="application_role_form_add_edit">
    <div class="col-xs-12">
        <div class="well well-sm">
		    <div class="inline middle blue bigger-150" id="application_role_form_title"> Add/Edit Module Role </div>
		</div>
        <form class="form-horizontal" application_role="form" id="application_role_form">

            <?php 
$ci =& get_instance();
$ci->load->model('adm_sistem/p_application');
$table = $ci->p_application;
$table->setCriteria(" p_application_id NOT IN (SELECT p_application_id FROM p_application_role WHERE p_role_id = " . getVarClean('p_role_id', 'int', 0) . ") ");
$itemsModule = $table->getAll(0, -1, "p_application_id", "ASC");
?>
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right"> Module *</label>
                <input id="form_p_application_role_id" type="text" style="display:none;">
                <div class="col-sm-9">
                    <select id="form_p_application_id" class="col-xs-10 col-sm-5 required">
                        <option value=""> -- Please Select Module -- </option>
            		    <?php 
foreach ($itemsModule as $item) {
    ?>
            		    <option value="<?php 
    echo $item['p_application_id'];
    ?>
"> <?php 
    echo $item['code'];
    ?>
 </option>
            		    <?php 
					<button class="btn btn-white btn-success btn-round" id="user_role_btn_add">
						<i class="ace-icon glyphicon glyphicon-plus bigger-120 green"></i>
					    Add
					</button>

					<button class="btn btn-white btn-danger btn-round" id="user_role_btn_delete">
						<i class="ace-icon glyphicon glyphicon-trash bigger-120 red"></i>
						Delete
					</button>
					
					<input id="form_p_user_id" type="hidden" placeholder="ID User" value="<?php 
echo getVarClean('p_user_id', 'int', 0);
?>
">
					<input id="form_user_name" type="hidden" placeholder="Username" value="<?php 
echo getVarClean('user_name', 'str', '');
?>
">
				</p>

		        <table id="user_role_grid_selection" class="table table-striped table-bordered table-hover">
                <thead>
                  <tr>
                    <th data-identifier="true" data-visible="false" data-header-align="center" data-align="center" data-column-id="p_user_role_id"> ID Role</th>
                     <th data-header-align="center" data-align="center" data-formatter="opt-edit" data-sortable="false" data-width="100">Options</th>
                     <th data-column-id="role_code" data-width="190">Role Code</th>
                  </tr>
                </thead>
              </table>
		    </div>
	    </div>
						<i class="ace-icon glyphicon glyphicon-list-alt bigger-120"></i>
						<i class="ace-icon fa fa-exchange bigger-120"></i>
					</button>
					-->
					
					<input id="form_p_application_id" type="hidden" placeholder="ID Module" value="<?php 
echo getVarClean('p_application_id', 'int', 0);
?>
">
					<input id="form_application_code" type="hidden" placeholder="Module Name" value="<?php 
echo getVarClean('application_code', 'str', '');
?>
">
					
					<input id="form_parent_id" type="hidden" placeholder="ID Parent" value="<?php 
echo getVarClean('parent_id', 'int', 0);
?>
">
					<input id="form_parent_code" type="hidden" placeholder="Code Parent">
				</p>
                
    		     <table id="menu_grid_selection" class="table table-striped table-bordered table-hover">
                 <thead>
                   <tr>
                     <th data-identifier="true" data-visible="false" data-header-align="center" data-align="center" data-column-id="p_menu_id"> ID Menu</th>
                      <th data-header-align="center" data-align="center" data-formatter="opt-edit" data-sortable="false" data-width="100">Options</th>
                      <th data-column-id="code" data-width="190">Menu Code</th>
                      <th data-column-id="file_name">File Name</th>
                      <th data-column-id="listing_no">Listing Number</th>
                      <th data-column-id="is_active" data-formatter="is_active">Active</th>
                   </tr>
					
					<input id="form_p_role_id" type="hidden" placeholder="ID Role" value="<?php 
echo getVarClean('p_role_id', 'int', 0);
?>
">
					<input id="form_role_code" type="hidden" placeholder="Role Code" value="<?php 
echo getVarClean('role_code', 'str', '');
?>
">
					
					<input id="form_p_application_id" type="hidden" placeholder="ID Application" value="<?php 
echo getVarClean('p_application_id', 'int', 0);
?>
">
					<input id="form_application_code" type="hidden" placeholder="Application Code" value="<?php 
echo getVarClean('application_code', 'str', '');
?>
">
				</p>

		        <table id="role_menu_grid_selection" class="table table-striped table-bordered table-hover">
                <thead>
                  <tr>
                    <th data-identifier="true" data-visible="false" data-header-align="center" data-align="center" data-column-id="p_role_menu_id"> ID Role Menu</th>
                     <th data-header-align="center" data-align="center" data-formatter="opt-edit" data-sortable="false" data-width="100">Options</th>
                     <th data-column-id="menu_code" data-width="190">Menu Code</th>
                  </tr>
                </thead>
              </table>
		    </div>
	    </div>
<div class="row" style="display:none;" id="user_role_form_add_edit">
    <div class="col-xs-12">
        <div class="well well-sm">
		    <div class="inline middle blue bigger-150" id="user_role_form_title"> Add/Edit User Role </div>
		</div>
        <form class="form-horizontal" user_role="form" id="user_role_form">
            
            <?php 
$ci =& get_instance();
$ci->load->model('adm_sistem/p_role');
$table = $ci->p_role;
$table->setCriteria("role.p_role_id NOT IN (SELECT p_role_id FROM p_user_role WHERE p_user_id = " . getVarClean('p_user_id', 'int', 0) . ")");
$itemsRole = $table->getAll(0, -1, "p_role_id", "DESC");
?>
           
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right"> Role *</label>
                <input id="form_p_user_role_id" type="text" style="display:none;">
                <div class="col-sm-9">
                    <select id="form_p_role_id" class="col-xs-10 col-sm-5 required">
                        <option value=""> -- Please Select Role -- </option>
            		    <?php 
foreach ($itemsRole as $item) {
    ?>
            		    <option value="<?php 
    echo $item['p_role_id'];
    ?>
"> <?php 
    echo $item['code'];
    ?>
 </option>
					<button class="btn btn-white btn-success btn-round" id="loket_btn_add">
						<i class="ace-icon glyphicon glyphicon-plus bigger-120 green"></i>
					    Add
					</button>

					<button class="btn btn-white btn-danger btn-round" id="loket_btn_delete">
						<i class="ace-icon glyphicon glyphicon-trash bigger-120 red"></i>
						Delete
					</button>
					
					<input id="form_p_bank_id" type="hidden" placeholder="ID Bank" value="<?php 
echo getVarClean('p_bank_id', 'int', 0);
?>
">
					<input id="form_p_bank_code" type="hidden" placeholder="Code Bank" value="<?php 
echo getVarClean('p_bank_code', 'str', '');
?>
">
				</p>
                
		        <table id="loket_grid_selection" class="table table-striped table-bordered table-hover">
                <thead>
                  <tr>
                    <th data-identifier="true" data-visible="false" data-header-align="center" data-align="center" data-column-id="p_bank_branch_id"> ID Counter</th>
                     <th data-header-align="center" data-align="center" data-formatter="opt-edit" data-sortable="false" data-width="100">Options</th>
                     <th data-column-id="code" data-width="190">Counter Code</th>
                     <th data-column-id="bank_code"> Group Counter</th>
                     <th data-column-id="bank_area_code"> Area </th>
                     <th data-column-id="address"> Address </th>
                     <th data-column-id="loket_no"> No. Counter </th>
                     <th data-column-id="loket_type" data-header-align="center" data-align="center" data-formatter="loket_type">Counter Type</th>
 function destroy()
 {
     $ci =& get_instance();
     $ci->load->model('pay_param/p_stamp');
     $table = $ci->p_stamp;
     $data = array('items' => array(), 'success' => false, 'message' => '');
     $jsonItems = getVarClean('items', 'str', '');
     $items = jsonDecode($jsonItems);
     try {
         $table->db->trans_begin();
         //Begin Trans
         $total = 0;
         if (is_array($items)) {
             foreach ($items as $key => $value) {
                 if (empty($value)) {
                     throw new Exception('Empty parameter');
                 }
                 $table->remove($value);
                 $data['items'][] = array($table->pkey => $value);
                 $total++;
             }
         } else {
             $items = (int) $items;
             if (empty($items)) {
                 throw new Exception('Empty parameter');
             }
             $table->remove($items);
             $data['items'][] = array($table->pkey => $items);
             $data['total'] = $total = 1;
         }
         $data['success'] = true;
         $data['message'] = $total . ' Data deleted successfully';
         $table->db->trans_commit();
         //Commit Trans
     } catch (Exception $e) {
         $table->db->trans_rollback();
         //Rollback Trans
         $data['message'] = $e->getMessage();
         $data['items'] = array();
         $data['total'] = 0;
     }
     return $data;
 }
		<div class="login-container">
		    <div class="widget-box">
		        <div class="widget-header widget-header-flat">
					<h4 class="smaller">
    				    <i class="ace-icon fa fa-credit-card green"></i>
    				    Please Enter Your Information
					</h4>
				</div>
    		    <div class="widget-body">
                    <div class="widget-main">
                        <form class="form-horizontal" role="form">
                			<div class="form-group">
                			    <div class="col-sm-12">
                                    <span class="block input-icon input-icon-right">
                                        <input type="hidden" id="form_url_redirect" value="<?php 
echo getVarClean("url_redirect", "str", "");
?>
">
                    					<input type="text" id="form_user_name" placeholder="Username" class="form-control">
                    					<i class="ace-icon fa fa-user"></i>
                    				</span>
                			    </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-12">
                                    <span class="block input-icon input-icon-right">
                    					<input type="password" id="form_password" placeholder="Password" class="form-control">
                    					<i class="ace-icon fa fa-lock"></i>
                    				</span>
                			    </div>