<!-- Content Header (Page header) -->
                <section class="content-header"><?php
      function is_connected($url,$port)
      {
       
        if(!$sock = @fsockopen($url, $port))
        {
           return false;
        }
        else
        {
            return true;
        }

      }
//include "inc/config.php";
  //    foreach ($dtb as $isi) {

?>
                    <h1>
                        Manage Config Akun Feeder
                    </h1>
                       <ol class="breadcrumb">
                        <li><a href="<?=base_index();?>"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li><a href="<?=base_index();?>config-akun-feeder">Config Akun Feeder</a></li>
                        <li class="active">Akun Feeder</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-header">
                                  <h3 class="box-title">Config Akun Feeder</h3>
                                </div><!-- /.box-header -->
                                <div class="box-body table-responsive">
                                    <table class="table table-bordered table-striped">
                                   <thead>
                                     <tr>
                          <th>Username Feeder</th>
                          <th>URL Feeder</th>
                          <th>Kode PT</th>
                          <th>Status</th>
                          
                          <th>Action</th>
                         
                        </tr>
                                      </thead>
                                        <tbody>
                                         <?php 
      $isi=$db->fetch_custom_single("select protokol,config_user.username,config_user.password,config_user.url,config_user.port,config_user.kode_pt,config_user.live,config_user.id from config_user ");

      //dump($isi);

      $i=1;


      //http://116.193.191.167:3003/ws/live2.php
      //$token = check_token();
      $config = get_config_user();

      $data = array(
        'act' => 'GetToken',
        'username' => dec_data($config->username),
        'password' => dec_data($config->password)
      );
      $result = service_request($data);
      if (isset($result->data)) {
         $token = $result->data->token;
         $array_return = array(
          'status' => 1,'error' => '','token' => $token);

      } else {
        if ($result->error) {
            $array_return = array(
                'status' => 0,'error' => 'Pastikan Neo Feeder Dalam Kondisi Aktif/Bisa Diakses','token' => '');
        } else {
            $array_return = array(
                'status' => 0,'error' => $result->error_desc,'token' => '');
        }
          
      }


        if ($array_return['status']=='1') {
            $status = '<button type="button" class="btn btn-success btn-sm">Connected</button>';
        } else {
          $status = '<button type="button" class="btn btn-danger btn-sm">'.$array_return['error'].'</button>';
        }

           
        ?><tr id="line_<?=$isi->id;?>">
        <td><?=dec_data($isi->username);?></td>
<td><a target="_blank" href="<?=$isi->protokol.'://'.$isi->url.':'.$isi->port;?>"><?=$isi->protokol.'://'.$isi->url.':'.$isi->port;?></a></td>
<td><?=$isi->kode_pt;?></td>
<td> <?=$status;?></td>

        <td>
        <?=($role_act["up_act"]=="Y")?'<a href="'.base_index().'config-akun-feeder/edit/'.$isi->id.'" class="btn btn-primary btn-flat btn-sm"><i class="fa fa-pencil"></i> Edit</a>':"";?>  
        </td>
        </tr>
        <?php
        $i++;
      

      ?>
                                        </tbody>
                                    </table>
                                </div><!-- /.box-body -->
                            </div><!-- /.box -->
                        </div>
                    </div>
                </section><!-- /.content -->
        
