<?php
//ini_set('session.gc_maxlifetime', 86400);

//session_set_cookie_params(86400);
session_start();
include_once('../config/#Config.php');
if(!$_SESSION['UserName']){
die('<script>window.location.href=\''.$config['site']['url'].'index.php\';</script>');
}
$get_AD = mysqli_query($conn, "Select * From config_admin WHERE Account = '".$_SESSION['UserName']."'");
if(!mysqli_num_rows($get_AD)){
	die('Không đủ quyền.');
}
mysqli_query($conn, "UPDATE config_admin Set TimerOnline = '".date('d/m/Y H:i:s')."' WHERE Account = '".$_SESSION['UserName']."'");
?>
<!doctype html>
<html lang="en">


<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Language" content="en">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Quản Lý Máy Chủ - <?=$config['site']['Domain']?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no" />
    <meta name="description" content="This is an example dashboard created using build-in elements and components.">
    <meta name="msapplication-tap-highlight" content="no">
    <!--
    =========================================================
    * ArchitectUI HTML Theme Dashboard - v1.0.0
    =========================================================
    * Product Page: https://dashboardpack.com
    * Copyright 2019 DashboardPack (https://dashboardpack.com)
    * Licensed under MIT (https://github.com/DashboardPack/architectui-html-theme-free/blob/master/LICENSE)
    =========================================================
    * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
    -->
    <script src="https://code.jquery.com/jquery-1.9.1.js"></script>

<link href="main.css" rel="stylesheet"></head>
<body>
    <div class="app-container app-theme-white body-tabs-shadow fixed-sidebar fixed-header">
        <div class="app-header header-shadow">
            <div class="app-header__logo">
                <div class="logo-src"></div>
                <div class="header__pane ml-auto">
                    <div>
                        <button type="button" class="hamburger close-sidebar-btn hamburger--elastic" data-class="closed-sidebar">
                            <span class="hamburger-box">
                                <span class="hamburger-inner"></span>
                            </span>
                        </button>
                    </div>
                </div>
            </div>
            <div class="app-header__mobile-menu">
                <div>
                    <button type="button" class="hamburger hamburger--elastic mobile-toggle-nav">
                        <span class="hamburger-box">
                            <span class="hamburger-inner"></span>
                        </span>
                    </button>
                </div>
            </div>
            <div class="app-header__menu">
                <span>
                    <button type="button" class="btn-icon btn-icon-only btn btn-primary btn-sm mobile-toggle-header-nav">
                        <span class="btn-icon-wrapper">
                            <i class="fa fa-ellipsis-v fa-w-6"></i>
                        </span>
                    </button>
                </span>
            </div>    <div class="app-header__content">
                <div class="app-header-left">
                    <div class="search-wrapper">
                        <div class="input-holder">
                            <input type="text" class="search-input" placeholder="Type to search">
                            <button class="search-icon"><span></span></button>
                        </div>
                        <button class="close"></button>
                    </div>
                    <ul class="header-menu nav">
                        <li class="nav-item">
                            <a href="javascript:void(0);" class="nav-link">
                                <i class="nav-link-icon fa fa-database"> </i>
                                Statistics
                            </a>
                        </li>
                        <li class="btn-group nav-item">
                            <a href="javascript:void(0);" class="nav-link">
                                <i class="nav-link-icon fa fa-edit"></i>
                                Projects
                            </a>
                        </li>
                        <li class="dropdown nav-item">
                            <a href="javascript:void(0);" class="nav-link">
                                <i class="nav-link-icon fa fa-cog"></i>
                                Settings
                            </a>
                        </li>
                    </ul>        </div>
                <div class="app-header-right">
                    <div class="header-btn-lg pr-0">
                        <div class="widget-content p-0">
                            <div class="widget-content-wrapper">
                                <div class="widget-content-right header-user-info ml-3">
                                    <button type="button" class="btn-shadow p-1 btn btn-primary btn-sm show-toastr-example">
                                        <i class="fa text-white fa-calendar pr-1 pl-1"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>        </div>
            </div>
        </div>        <div class="ui-theme-settings">
            <button type="button" id="TooltipDemo" class="btn-open-options btn btn-warning">
                <i class="fa fa-cog fa-w-16 fa-spin fa-2x"></i>
            </button>
<?php include_once('temp_setting.php');?>
        </div>
        <div class="app-main">
                <div class="app-sidebar sidebar-shadow">
                    <div class="app-header__logo">
                        <div class="logo-src"></div>
                        <div class="header__pane ml-auto">
                            <div>
                                <button type="button" class="hamburger close-sidebar-btn hamburger--elastic" data-class="closed-sidebar">
                                    <span class="hamburger-box">
                                        <span class="hamburger-inner"></span>
                                    </span>
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="app-header__mobile-menu">
                        <div>
                            <button type="button" class="hamburger hamburger--elastic mobile-toggle-nav">
                                <span class="hamburger-box">
                                    <span class="hamburger-inner"></span>
                                </span>
                            </button>
                        </div>
                    </div>
                    <div class="app-header__menu">
                        <span>
                            <button type="button" class="btn-icon btn-icon-only btn btn-primary btn-sm mobile-toggle-header-nav">
                                <span class="btn-icon-wrapper">
                                    <i class="fa fa-ellipsis-v fa-w-6"></i>
                                </span>
                            </button>
                        </span>
                    </div>
                    <div class="scrollbar-sidebar">
                        <div class="app-sidebar__inner">
                           <?php include_once('temp_menu.php'); ?>
                        </div>
                    </div>
                </div>
                <div class="app-main__outer">
                <div class="app-main__inner">
                        <div class="app-page-title">
                            <div class="page-title-wrapper">
                                <div class="page-title-heading">
                                    <div class="page-title-icon">
                                        <i class="pe-7s-phone icon-gradient bg-premium-dark">
                                        </i>
                                    </div>
                                    <div>
                                        Quản Lý Máy Chủ
                                        <div class="page-title-subheading">Hãy chú ý trước khi sử dụng bất kỳ Chức Năng nào.
                                        </div>
                                    </div>
                                </div>
                                <div class="page-title-actions">
                                    <button type="button" data-toggle="tooltip" title="" data-placement="bottom" class="btn-shadow mr-3 btn btn-dark" data-original-title="Example Tooltip">
                                        <i class="fa fa-star"></i>
                                    </button>
                                    <div class="d-inline-block dropdown">
                                        <button type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn-shadow dropdown-toggle btn btn-info">
                                            <span class="btn-icon-wrapper pr-2 opacity-7">
                                                <i class="fa fa-business-time fa-w-20"></i>
                                            </span>
                                            Buttons
                                        </button>
                                        <div tabindex="-1" role="menu" aria-hidden="true" class="dropdown-menu dropdown-menu-right">
                                            <ul class="nav flex-column">
                                                <li class="nav-item">
                                                    <a href="javascript:void(0);" class="nav-link">
                                                        <i class="nav-link-icon lnr-inbox"></i>
                                                        <span>
                                                            Inbox
                                                        </span>
                                                        <div class="ml-auto badge badge-pill badge-secondary">86</div>
                                                    </a>
                                                </li>
                                                <li class="nav-item">
                                                    <a href="javascript:void(0);" class="nav-link">
                                                        <i class="nav-link-icon lnr-book"></i>
                                                        <span>
                                                            Book
                                                        </span>
                                                        <div class="ml-auto badge badge-pill badge-danger">5</div>
                                                    </a>
                                                </li>
                                                <li class="nav-item">
                                                    <a href="javascript:void(0);" class="nav-link">
                                                        <i class="nav-link-icon lnr-picture"></i>
                                                        <span>
                                                            Picture
                                                        </span>
                                                    </a>
                                                </li>
                                                <li class="nav-item">
                                                    <a disabled="" href="javascript:void(0);" class="nav-link disabled">
                                                        <i class="nav-link-icon lnr-file-empty"></i>
                                                        <span>
                                                            File Disabled
                                                        </span>
                                                    </a>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>                      
                        <div class="row">
                            <div class="col-md-12">
                                <div class="main-card mb-3 card">
                                    <div class="card-body">
                                 		  <div class="col-12 stretch-card">
				  <button type="button" class="btn btn-outline-primary" style="float:right" onClick="$('#addADMIN').modal();">Thêm Máy Chủ</button>
				  <br/><br/>
                  <div class="table-responsive">
                    <table class="table table-dark">
                      <thead>
                        <tr>
                          <th>
                            #
                          </th>
                          <th>
                            Server ID
                          </th>
                          <th>
                            Tên Máy Chủ
                          </th>
                          <th>
                            IP Data
                          </th>
						  <th>
                            Tên Data
                          </th>
						  <th>
                            IP GATE
                          </th>
						  <th>
                           Port Gojxhttp
                          </th>
						  <th>
                           Quản lý
                          </th>
                        </tr>
                      </thead>
                      <tbody>
					  <?php
					  $gpp_CON = mysqli_query($conn, "Select * From config_server");
					  
					  if(mysqli_num_rows($gpp_CON)){
						  $i=0;
						  while($row = mysqli_fetch_array($gpp_CON, MYSQLI_ASSOC)){
							  $i++;
							  echo '<tr>
                          <td>
                            '.$i.'
                          </td>
                          <td>
                           '.$row['ServerID'].'
                          </td>
                          <td>
                           '.$row['ServerName'].'
                          </td>
						  <td>
                           '.$row['IPdata'].'
                          </td>
                          <td>
                          '.$row['Databases'].'
                          </td>
                          <td>
                          '.$row['IpJson'].'
                          </td>
						  <td>
                          '.$row['PortJson'].'
                          </td>		
                          <td>
						  <a href="javascript:loadinfomaychu(\''.$row['ID'].'\');"><label class="badge badge-success">Sửa</label></a>
                          <a href="javascript:del_maychu(\''.$row['ID'].'\');"><label class="badge badge-danger">Xóa</label></a>
                          </td>						  
                        </tr>';
						  }
					  }
					  ?>


                      </tbody>
                    </table>
                </div>
                    </div>					
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="app-wrapper-footer">
                        <div class="app-footer">
                            <div class="app-footer__inner">
                                <div class="app-footer-left">
                                    <ul class="nav">
                                        <li class="nav-item">
                                            <a href="javascript:void(0);" class="nav-link">
                                                Footer Link 1
                                            </a>
                                        </li>
                                        <li class="nav-item">
                                            <a href="javascript:void(0);" class="nav-link">
                                                Footer Link 2
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                                <div class="app-footer-right">
                                    <ul class="nav">
                                        <li class="nav-item">
                                            <a href="javascript:void(0);" class="nav-link">
                                                Footer Link 3
                                            </a>
                                        </li>
                                        <li class="nav-item">
                                            <a href="javascript:void(0);" class="nav-link">
                                                <div class="badge badge-success mr-1 ml-0">
                                                    <small>NEW</small>
                                                </div>
                                                Footer Link 4
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>    </div>
        </div>
    </div>
 <!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>   
<script type="text/javascript" src="assets/scripts/main.js"></script>
<link href="assets/scripts/toastr.css" rel="stylesheet" />
<script src="assets/scripts/toastr.js"></script>
<script src="assets/scripts/script.js"></script> 
<script type="text/javascript">
function loadinfomaychu(id) {
    $.post('from/load_edit_maychu.php', { id: id }, function(data) {
        $('.modal-content').html(data);
        $('#popupuserweb').modal();
    });
}

function edit_maychu(id) {
    $.post('ajax/edit_maychu.php', { a: $('#edit_mc_a').val(), b: $('#edit_mc_b').val(), c: $('#edit_mc_c').val(), d: $('#edit_mc_d').val(), e: $('#edit_mc_e').val(), id: id }, function(data) {
toastr.info(data, 'Chú ý', {timeOut: 5000});
    });
}

function del_maychu(id) {
    $.post('ajax/del_maychu.php', { id: id }, function(data) {
toastr.info(data, 'Chú ý', {timeOut: 5000});
    });
}

function add_maychu() {
    $.post('ajax/add_maychu.php', { a: $('#add_mc_a').val(), b: $('#add_mc_b').val(), c: $('#add_mc_c').val(), d: $('#add_mc_d').val(), e: $('#add_mc_e').val(), f: $('#add_mc_daa').val() }, function(data) {
toastr.info(data, 'Chú ý', {timeOut: 5000});
    });
}
</script>
				<script>
				function SaveSettingNapThe() {
    $.post('ajax/setting_nap.php', { enableAutoCharge:$('#enableAutoCharge').val(),sett__nap_start: $('#sett__nap_start').val(), sett__nap_end: $('#sett__nap_end').val(), sett__nap_km: $('#sett__nap_km').val() }, function(data) {
toastr.info(data, 'Chú ý', {timeOut: 5000});
    });
}
</script>
<style>
    .modal-fullscreen{
  width: 100%;
  height: 100%;
  margin: 0;
  top: 0;
  left: 0;
}
</style>
<div class="modal" id="popupuserweb" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
        </div>
    </div>
</div>

<div class="modal" id="addADMIN" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
<div class="modal-body">
			<label>Server ID</label>
            <div class="form-group pass_show"> 
                <input type="text" id="add_mc_a" class="form-control"> 
            </div> 
			<label>Tên Máy Chủ</label>
            <div class="form-group pass_show"> 
                <input type="text"  id="add_mc_b" class="form-control"> 
            </div> 
			<label>IP Data</label>
            <div class="form-group pass_show"> 
                <input type="text"  id="add_mc_daa" class="form-control"> 
            </div> 
			<label>Tên Data</label>
            <div class="form-group pass_show"> 
                <input type="text"  id="add_mc_c" class="form-control"> 
            </div> 
			<label>IP Gate</label>
            <div class="form-group pass_show"> 
                <input type="text" id="add_mc_d" class="form-control"> 
            </div> 
			<label>Port Gojxhttp</label>
            <div class="form-group pass_show"> 
                <input type="text" id="add_mc_e" class="form-control"> 
            </div> 
        </div>	
        <div class="modal-footer">
          <button type="button" class="btn btn-danger" onClick="add_maychu();">Thêm Ngay</button>
        </div>			
      </div>
    </div>
</div>
</body>
</html>
