<?php 

include '../../function/connect.php';

 $username =  $_SESSION['username'];


 $que = mysqli_query($koneksi, "SELECT * FROM tb_admin WHERE username = '$username' ");
 $c = mysqli_fetch_array($que);

 $cuk = mysqli_query($koneksi, "SELECT * FROM tb_web");
 $cek_web = mysqli_fetch_array($cuk);
 $urlweb = $cek_web['url'];
 $logo = $cek_web['logo'];
 $icon = $cek_web['icon_web'];
 $title = $cek_web['title'];
 $deskripsi = $cek_web['deskripsi'];
 $keyword = $cek_web['keyword'];

 $pisah = explode('|', $title);
 $judul = trim($pisah[0]);

if($_SESSION['status']!="login"){
    header("location:../index.php?pesan=belum_login");
}

if ($_SESSION['level'] == "user") {
    ?>
    <script type="text/javascript">
        alert('Maaf Anda Tidak Berkepentingan Disini');
        window.location = '../index.php';
    </script>
    <?php
}

// Ambil inisial untuk avatar (huruf pertama nama lengkap, fallback ke username)
 $adminInitial = strtoupper(mb_substr($c['nama_lengkap'], 0, 1, 'UTF-8'));
if (empty($adminInitial)) {
    $adminInitial = strtoupper(mb_substr($username, 0, 1, 'UTF-8'));
}

?>

<!DOCTYPE html>
<html dir="ltr" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="<?php echo $deskripsi ?>">
    <meta name="author" content="<?php echo $urlweb ?>">
    <link rel="icon" type="image/png" sizes="16x16" href="../../assets/img/<?php echo $logo ?>">
    <title><?php echo $title; ?></title>
    <link href="../assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.css?v=2.6.0.0" rel="stylesheet">

<link rel="stylesheet" href="../libs/select2/dist/css/select2.min.css?v=<?= time(); ?>">
<link rel="stylesheet" href="../dist/css/style.css?v=<?= time(); ?>">
<link rel="stylesheet" href="../dist/css/custom_table.css?v=<?= time(); ?>">

<style>
/* ===== Avatar Admin SVG ===== */
.admin-avatar-svg {
    display: block;
    border-radius: 50%;
    flex-shrink: 0;
}
</style>

    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>

<body data-theme="dark">
    
    <div class="preloader">
        <div class="lds-ripple">
            <div class="lds-pos"></div>
            <div class="lds-pos"></div>
        </div>
    </div>
    <div id="main-wrapper">
        <header class="topbar">
            <nav class="navbar top-navbar navbar-expand-md navbar-dark">
                <div class="navbar-header">
                    <a class="nav-toggler waves-effect waves-light d-block d-md-none" href="javascript:void(0)">
                        <i class="ti-menu ti-close"></i>
                    </a>
                    <div class="navbar-brand">
                        <a href="index.php" class="logo">
                            <b class="logo-icon">
                                <img style="width: 200px" src="../../assets/img/<?php echo $logo ?>" alt="<?php echo $judul ?>" class="light-logo container-fluid" />
                            </b>
                            <a class="sidebartoggler d-none d-md-block" href="javascript:void(0)" data-sidebartype="mini-sidebar">
                                <i class="mdi mdi-toggle-switch mdi-toggle-switch-off font-20"></i>
                            </a>
                        </div>
                        <a class="topbartoggler d-block d-md-none waves-effect waves-light" href="javascript:void(0)" data-toggle="collapse" data-target="#navbarSupportedContent"
                        aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                        <i class="ti-more"></i>
                    </a>
                </div>

                <div class="navbar-collapse collapse" id="navbarSupportedContent">

                    <ul class="navbar-nav float-left mr-auto">
                     <li class="nav-item d-none d-md-block">
                            <a class="nav-link sidebartoggler waves-effect waves-light" href="javascript:void(0)" data-sidebartype="mini-sidebar">
                                <i class="mdi mdi-menu font-24"></i>
                            </a>
                        </li>
                    </ul>

                    <ul class="navbar-nav float-right">

                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle waves-effect waves-dark pro-pic" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                <svg class="admin-avatar-svg" width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
                                    <rect width="40" height="40" rx="20" fill="#1e1b4b"/>
                                    <rect x="0.5" y="0.5" width="39" height="39" rx="19.5" fill="none" stroke="#312e81" stroke-width="1"/>
                                    <circle cx="20" cy="15" r="6" fill="#6366f1"/>
                                    <ellipse cx="20" cy="33" rx="11" ry="8" fill="#6366f1"/>
                                    <text x="20" y="24" text-anchor="middle" font-family="Arial,sans-serif" font-weight="700" font-size="11" fill="#e0e7ff"><?php echo $adminInitial; ?></text>
                                </svg>
                                <span class="m-l-5 font-medium d-none d-sm-inline-block"><?php echo $username; ?> <i class="mdi mdi-chevron-down"></i></span>
                            </a>
                            <div class="dropdown-menu dropdown-menu-right user-dd animated flipInY">
                                <span class="with-arrow">
                                    <span class="bg-primary"></span>
                                </span>
                                <div class="d-flex no-block align-items-center p-15 bg-primary text-white m-b-10">
                                    <div class="">
                                        <svg class="admin-avatar-svg" width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg">
                                            <rect width="60" height="60" rx="30" fill="#1e1b4b"/>
                                            <rect x="0.5" y="0.5" width="59" height="59" rx="29.5" fill="none" stroke="#4338ca" stroke-width="1"/>
                                            <circle cx="30" cy="22" r="9" fill="#6366f1"/>
                                            <ellipse cx="30" cy="50" rx="17" ry="12" fill="#6366f1"/>
                                            <text x="30" y="36" text-anchor="middle" font-family="Arial,sans-serif" font-weight="800" font-size="18" fill="#e0e7ff"><?php echo $adminInitial; ?></text>
                                        </svg>
                                    </div>
                                    <div class="m-l-10">
                                        <h4 class="m-b-0"><?php echo $c['nama_lengkap']; ?></h4>
                                        <p class=" m-b-0">Level : <?php echo $c['level']; ?></p>
                                    </div>
                                </div>
                                <div class="profile-dis scrollable">

                                    <a class="dropdown-item" href="?page=admin">
                                        <i class="fa fa-user m-r-5 m-l-5"></i> Profil Admin</a>

                                    <a class="dropdown-item" href="../function/logout.php">
                                        <i class="fa fa-power-off m-r-5 m-l-5"></i> Logout</a>

                                        </li>
                                    </ul>
                                </div>
                            </nav>
                        </header>



<aside class="left-sidebar">
  <div class="scroll-sidebar">
    <nav class="sidebar-nav">
      <ul id="sidebarnav">

        <li class="nav-small-cap">
          <i class="fas fa-home" style="font-size:12px"></i>
          <span class="hide-menu" style="font-size:12px">Main Menus</span>
        </li>
        <li class="sidebar-item">
          <a class="sidebar-link waves-effect waves-dark" href="?page=dashboard">
            <i class="fas fa-tachometer-alt" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Dashboard</span>
          </a>
        </li>

        <li class="sidebar-item">
          <a class="sidebar-link has-arrow waves-effect waves-dark" href="javascript:void(0)">
            <i class="fas fa-arrow-down" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Deposit</span>
          </a>
          <ul class="collapse first-level">
            <li class="sidebar-item">
              <a href="?page=permintaan_deposit" class="sidebar-link">
                <i class="fas fa-inbox" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Requests</span>
              </a>
            </li>
            <li class="sidebar-item">
              <a href="?page=daftar_deposit" class="sidebar-link">
                <i class="fas fa-history" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">History</span>
              </a>
            </li>
          </ul>
        </li>

        <li class="sidebar-item">
          <a class="sidebar-link has-arrow waves-effect waves-dark" href="javascript:void(0)">
            <i class="fas fa-arrow-up" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Withdraw</span>
          </a>
          <ul class="collapse first-level">
            <li class="sidebar-item">
              <a href="?page=permintaan_withdraw" class="sidebar-link">
                <i class="fas fa-inbox" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Requests</span>
              </a>
            </li>
            <li class="sidebar-item">
              <a href="?page=daftar_withdraw" class="sidebar-link">
                <i class="fas fa-clock" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">History</span>
              </a>
            </li>
          </ul>
        </li>

        <li class="sidebar-item">
          <a class="sidebar-link has-arrow waves-effect waves-dark" href="javascript:void(0)">
            <i class="fas fa-users" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Manage Users</span>
          </a>
          <ul class="collapse first-level">
              
             <li class="sidebar-item">
              <a href="?page=users_online" class="sidebar-link">
                <i class="fas fa-user" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Online Users</span>
              </a>
            </li>
              
            <li class="sidebar-item">
              <a href="?page=user" class="sidebar-link">
                <i class="fas fa-user" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Users</span>
              </a>
            </li>
            <li class="sidebar-item">
              <a href="?page=saldo_member" class="sidebar-link">
                <i class="fas fa-dollar-sign" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Balances</span>
              </a>
            </li>
            

            <?php if ($c['level'] == "superadmin") { ?>
            <li class="sidebar-item">
              <a href="?page=administrator" class="sidebar-link">
                <i class="fas fa-shield-alt" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Admins</span>
              </a>
            </li>
            <?php } ?>
          </ul>
        </li>

        <?php if ($c['level'] == "superadmin") { ?>

        
         <li class="sidebar-item">
          <a class="sidebar-link has-arrow waves-effect waves-dark" href="javascript:void(0)">
            <i class="fas fa-gift" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Bonuses</span>
          </a>
          <ul class="collapse first-level">
            <li class="sidebar-item">
              <a href="?page=bonus" class="sidebar-link">
                <i class="fas fa-box-open" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Bonus List</span>
              </a>
            </li>
            <li class="sidebar-item">
              <a href="?page=daftar_permintaan_bonus" class="sidebar-link">
                <i class="fas fa-inbox" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Bonus Requests</span>
              </a>
            </li>
            <li class="sidebar-item">
              <a href="?page=roda_hadiah" class="sidebar-link">
                <i class="fas fa-sync-alt" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Daily Spin</span>
              </a>
            </li>
            
         <li class="sidebar-item">
          <a class="sidebar-link waves-effect waves-dark" href="?page=promosi">
            <i class="fas fa-tags" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Promotions</span>
          </a>
        </li>
          </ul>
        </li>
        
                 <li class="sidebar-item">
          <a class="sidebar-link has-arrow waves-effect waves-dark" href="javascript:void(0)">
            <i class="fas fa-gift" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Scater</span>
          </a>
          <ul class="collapse first-level">
            <li class="sidebar-item">
              <a href="?page=daftar_claim_scater" class="sidebar-link">
                <i class="fas fa-box-open" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Scater List</span>
              </a>
            </li>
            <li class="sidebar-item">
              <a href="?page=permintaan_claim_scater" class="sidebar-link">
                <i class="fas fa-inbox" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Scater Requests</span>
              </a>
            </li>
          </ul>
        </li>



        <li class="sidebar-item">
          <a class="sidebar-link has-arrow waves-effect waves-dark" href="javascript:void(0)">
            <i class="fas fa-sliders-h" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Extra Settings</span>
          </a>
          
          
          <ul class="collapse first-level">
              

              
                      <li class="sidebar-item">
          <a class="sidebar-link waves-effect waves-dark" href="?page=jackpot">
            <i class="fas fa-fire" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Jackpot</span>
          </a>
        </li>
        
             <li class="sidebar-item">
          <a class="sidebar-link waves-effect waves-dark" href="?page=pemberitahuan">
            <i class="fas fa-bell" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Notifications</span>
          </a>
        </li>

        <li class="sidebar-item">
          <a href="?page=popup" class="sidebar-link">
            <i class="fas fa-comment-dots" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Popup</span>
          </a>
        </li>

        <li class="sidebar-item">
          <a href="?page=popular" class="sidebar-link">
            <i class="fas fa-star" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Popular Games</span>
          </a>
        </li>


            <li class="sidebar-item">
              <a href="?page=banner" class="sidebar-link">
                <i class="fas fa-images" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Banners</span>
              </a>
            </li>
            <li class="sidebar-item">
              <a href="?page=website" class="sidebar-link">
                <i class="fas fa-globe" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">SEO & Logo</span>
              </a>
            </li>
            <li class="sidebar-item">
              <a href="?page=contact" class="sidebar-link">
                <i class="fab fa-whatsapp" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Live Chat</span>
              </a>
            </li>
            <li class="sidebar-item">
              <a href="?page=warna" class="sidebar-link">
                <i class="fas fa-circle" style="font-size:12px"></i>
                <span class="hide-menu" style="font-size:12px">Site Theme</span>
              </a>
            </li>
            
            
          </ul>
          
                                <li class="sidebar-item">
          <a href="?page=api" class="sidebar-link">
            <i class="fas fa-cog" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Game Provider</span>
          </a>
        </li>
          
                  <li class="sidebar-item">
          <a class="sidebar-link waves-effect waves-dark" href="?page=bank">
            <i class="fas fa-university" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Bank Accounts</span>
          </a>
        </li>

        <li class="sidebar-item">
          <a class="sidebar-link waves-effect waves-dark" href="?page=depowd">
            <i class="fas fa-dollar-sign" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Minimum Deposit</span>
          </a>
        </li>

        <li class="sidebar-item">
          <a class="sidebar-link waves-effect waves-dark" href="?page=payment">
            <i class="fas fa-credit-card" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">Payment Gateway</span>
          </a>
        </li>

        <li class="sidebar-item">
          <a class="sidebar-link waves-effect waves-dark" href="?page=goldslot&sub=config">
            <i class="fas fa-gamepad" style="font-size:12px"></i>
            <span class="hide-menu" style="font-size:12px">GoldSlotPalace</span>
          </a>
        </li>

        </li>
        

        <?php } ?>

      </ul>
    </nav>
  </div>
</aside>

                                <div class="page-wrapper">
                                    
                                    <?php
                                    // Variabel penanda terpisah
                                    $playNotifDeposit = false;
                                    $playNotifWithdraw = false;
                                    
                                    // CEK DEPOSIT
                                    $query = mysqli_query($koneksi, "SELECT * FROM tb_transaksi WHERE status = 'Pending' AND transaksi = 'Top Up' ORDER BY id DESC LIMIT 1 ");
                                    while ($data = mysqli_fetch_array($query)) {
                                        $id_user = $data['id_user'];
                                        $cek_user = mysqli_query($koneksi, "SELECT * FROM tb_user WHERE extplayer = '$id_user' ");
                                        $liat_user = mysqli_fetch_array($cek_user);

                                        if ($data['transaksi'] == "Top Up") {
                                            $playNotifDeposit = true;
                                            ?>
                                            <div class="alert alert-success"> 
                                                <i class="ti-user"></i>  
                                                <?php echo  $liat_user['username']; ?> Melakukan Top Up Saldo Senilai Rp. <?php echo number_format($data['total']); ?> <a href="?page=permintaan_deposit">Klik Disini</a> Untuk Konfirmasi
                                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">&times;</span> </button>
                                            </div>
                                            <?php
                                        }
                                    }
                                    ?>

                                    <?php
                                    // CEK WITHDRAW
                                    $query = mysqli_query($koneksi, "SELECT * FROM tb_transaksi WHERE status = 'Pending' AND transaksi = 'Withdraw' ORDER BY id DESC LIMIT 1 ");
                                    while ($data = mysqli_fetch_array($query)) {
                                        $id_user = $data['id_user'];
                                        $cek_user = mysqli_query($koneksi, "SELECT * FROM tb_user WHERE extplayer = '$id_user' ");
                                        $liat_user = mysqli_fetch_array($cek_user);

                                        if ($data['transaksi'] == 'Withdraw') {
                                            $playNotifWithdraw = true;
                                            ?>
                                            <div class="alert alert-danger"> 
                                                <i class="ti-user"></i>  
                                                <?php echo  $liat_user['username']; ?> Melakukan Penarikan Saldo Senilai Rp. <?php echo number_format($data['total']); ?> <a href="?page=permintaan_withdraw">Klik Disini</a> Untuk Konfirmasi
                                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">&times;</span> </button>
                                            </div>
                                            <?php
                                        }

                                    }
                                    
                                    // MUNCULKAN AUDIO HANYA JIKA ADA NOTIF (ANTI DOUBLE)
                                    if($playNotifDeposit == true || $playNotifWithdraw == true) {
                                        echo '
                                        <!-- Audio Player -->
                                        <audio id="lagu" src="/dash/effect/effect2.mp3" autoplay loop></audio>';
                                    }
                                    ?>

                                    <?php
                                    if ($_GET['page'] == "dashboard") {
                                      include 'page/dashboard/dashboard.php';
                                  }else if ($_GET['page'] == "bank") {
                                      include 'page/bank/bank.php';
                                  }

                                  else if ($_GET['page'] == "banner") {
                                      include 'page/banner/banner.php';
                                  }else if ($_GET['page'] == "tambah_banner") {
                                      include 'page/banner/tambah_banner.php';
                                  }else if ($_GET['page'] == "hapus_banner") {
                                      include 'page/banner/hapus_banner.php';
                                  }else if ($_GET['page'] == "edit_banner") {
                                      include 'page/banner/edit_banner.php';
                                  }else if ($_GET['page'] == "proses_edit_banner") {
                                      include 'page/banner/proses_edit_banner.php';
                                  }      

                                  else if ($_GET['page'] == "user") {
                                      include 'page/user/user.php';
                                  }else if ($_GET['page'] == "lihat_profil") {
                                      include 'page/user/lihat_profil.php';
                                  }else if ($_GET['page'] == "update_user") {
                                      include 'page/user/update_user.php';
                                  }else if ($_GET['page'] == "suspend_member") {
                                      include 'page/user/suspend_member.php';
                                  }else if ($_GET['page'] == "active_member") {
                                      include 'page/user/active_member.php';
                                  }else if ($_GET['page'] == "ongame") {
                                      include 'page/user/ongame.php';
                                  }else if ($_GET['page'] == "offgame") {
                                      include 'page/user/offgame.php';
                                  }else if ($_GET['page'] == "hapus_user") {
                                      include 'page/user/hapus.php';
                                  }

                                  else if ($_GET['page'] == "admin") {
                                      include 'page/admin/admin.php';
                                  }else if ($_GET['page'] == "update_admin") {
                                      include 'page/admin/update_admin.php';
                                  }

                                  else if ($_GET['page'] == "administrator") {
                                    include 'page/administrator/administrator.php';
                                }else if ($_GET['page'] == "update_administrator") {
                                    include 'page/administrator/update_administrator.php';
                                }else if ($_GET['page'] == "tambah_administrator") {
                                    include 'page/administrator/tambah_administrator.php';
                                }else if ($_GET['page'] == "proses_tambah_admin") {
                                    include 'page/administrator/proses_tambah_admin.php';
                                }else if ($_GET['page'] == "hapus_administrator") {
                                    include 'page/administrator/hapus_administrator.php';
                                    
                                }else if ($_GET['page'] == "edit_administrator") {
                                    include 'page/administrator/edit_administrator.php';
                                    
                                }
                                else if ($_GET['page'] == "promosi") {
                                  include 'page/promosi/promosi.php';
                              }else if ($_GET['page'] == "tambah_promosi") {
                                  include 'page/promosi/tambah_promosi.php';
                              }else if ($_GET['page'] == "proses_tambah_promosi") {
                                  include 'page/promosi/proses_tambah_promosi.php';
                              }else if ($_GET['page'] == "edit_promosi") {
                                  include 'page/promosi/edit_promosi.php';
                              }else if ($_GET['page'] == "proses_edit_promosi") {
                                  include 'page/promosi/proses_edit_promosi.php';
                              }else if ($_GET['page'] == "hapus_promosi") {
                                  include 'page/promosi/hapus_promosi.php';
                              }

                              else if ($_GET['page'] == "permintaan_deposit") {
                                  include 'page/deposit/permintaan_deposit.php';
                              }

                              else if ($_GET['page'] == "bonus") {
                                  include 'page/bonus/bonus.php';
                                  
                              }
                              else if ($_GET['page'] == "daftar_permintaan_bonus") {
                                  include 'page/bonus/daftar_permintaan_bonus.php';
                                        }
                                        
                              else if ($_GET['page'] == "batalkan_bonus") {
                                  include 'page/bonus/batalkan_bonus.php';
                              }
                              else if ($_GET['page'] == "konfirmasi_bonus") {
                                  include 'page/bonus/konfirmasi_bonus.php';
                              }                              
                              
                              else if ($_GET['page'] == "jackpot") {
                                  include 'page/jackpot/jackpot.php';
                              }   
                              
                              else if ($_GET['page'] == "tambah_jackpot") {
                                  include 'page/jackpot/tambah_jackpot.php';
                              }         
                              
                              else if ($_GET['page'] == "hapus_jackpot") {
                                  include 'page/jackpot/hapus_jackpot.php';
                              }   
                              else if ($_GET['page'] == "edit_jackpot") {
                                  include 'page/jackpot/edit_jackpot.php';
                              }                                               
                              else if ($_GET['page'] == "proses_edit_jackpot") {
                                  include 'page/jackpot/proses_edit_jackpot.php';
                              }          

                              else if ($_GET['page'] == "popular") {
                                  include 'page/popular/popular.php';
                              }          
                                else if ($_GET['page'] == "tambah_popular") {
                                  include 'page/popular/tambah_popular.php';
                              }          
                              else if ($_GET['page'] == "edit_popular") {
                                  include 'page/popular/edit_popular.php';
                              }    
                              else if ($_GET['page'] == "hapus_popular") {
                                  include 'page/popular/hapus_popular.php';
                              }                         
                              
                              else if ($_GET['page'] == "proses_edit_popular") {
                                  include 'page/popular/proses_edit_popular.php';
                              }                                        
                              else if ($_GET['page'] == "website") {
                                  include 'page/website/website.php';
                              }else if ($_GET['page'] == "edit_website") {
                                  include 'page/website/edit_website.php';
                              }

                              else if ($_GET['page'] == "popup") {
                                  include 'page/popup/popup.php';
                              }
                              else if ($_GET['page'] == "edit_popup") {
                                  include 'page/popup/edit_popup.php';
                              }
                              
                              else if ($_GET['page'] == "daftar_claim_scater") {
                                  include 'page/scater/daftar_claim_scater.php';
                              }
                              
                              else if ($_GET['page'] == "permintaan_claim_scater") {
                                  include 'page/scater/permintaan_claim_scater.php';
                              }
                              
                              else if ($_GET['page'] == "proses_claim_scater") {
                                  include 'page/scater/proses_claim_scater.php';
                              }
                              
                              else if ($_GET['page'] == "proses_reject_claim_scater") {
                                  include 'page/scater/proses_reject_claim_scater.php';
                              }
                              
                              else if ($_GET['page'] == "roda_hadiah") {
                                  include 'page/roda/roda_hadiah.php';
                              }
                              else if ($_GET['page'] == "edit_roda_hadiah") {
                                  include 'page/roda/edit_roda_hadiah.php';
                              }
                              else if ($_GET['page'] == "proses_edit_roda_hadiah") {
                                  include 'page/roda/proses_edit_roda_hadiah.php';
                              }
                              else if ($_GET['page'] == "proses_update_all_roda_hadiah") {
                                  include 'page/roda/proses_update_all_roda_hadiah.php';
                              }
                              
                              
                             else if ($_GET['page'] == "pemberitahuan") {
                                  include 'page/pemberitahuan/pemberitahuan.php';
                              }   
                             else if ($_GET['page'] == "tambah_pemberitahuan") {
                                  include 'page/pemberitahuan/tambah_pemberitahuan.php';
                              }          
                             else if ($_GET['page'] == "hapus_pemberitahuan") {
                                  include 'page/pemberitahuan/hapus_pemberitahuan.php';
                              }                                 
                              else if ($_GET['page'] == "api") {
                                  include 'page/api/api.php';
                              }
                                else if ($_GET['page'] == "update_api") {
                                  include 'page/api/update_api.php';
                              }
                                                        
                              
                              
                              else if ($_GET['page'] == "permintaan_withdraw") {
                                  include 'page/withdraw/permintaan_withdraw.php';
                              }else if ($_GET['page'] == "proses_withdraw") {
                                  include 'page/withdraw/proses_withdraw.php';
                              }else if ($_GET['page'] == "daftar_withdraw") {
                                  include 'page/withdraw/daftar_withdraw.php';
                              }else if ($_GET['page'] == "proses_batal_withdraw") {
                                  include 'page/withdraw/proses_batal_withdraw.php';
                              }

                              else if ($_GET['page'] == "daftar_deposit") {
                                  include 'page/deposit/daftar_deposit.php';
                              }else if ($_GET['page'] == "proses_deposit") {
                                  include 'page/deposit/proses_deposit.php';
                              }else if ($_GET['page'] == "proses_batal_deposit") {
                                  include 'page/deposit/proses_batal_deposit.php';
                              }

                              else if ($_GET['page'] == "tambah_bank") {
                                  include 'page/bank/tambah_bank.php';
                              }else if ($_GET['page'] == "hapus_bank") {
                                  include 'page/bank/hapus_bank.php';
                              }else if ($_GET['page'] == "edit_bank") {
                                  include 'page/bank/edit_bank.php';
                              }else if ($_GET['page'] == "proses_edit_bank") {
                                  include 'page/bank/proses_edit_bank.php';
                              }

                              else if ($_GET['page'] == "saldo_member") {
                                  include 'page/saldo_member/saldo_member.php';
                              }else if ($_GET['page'] == "tambah_saldo") {
                                  include 'page/saldo_member/tambah_saldo.php';
                              }

                              else if ($_GET['page'] == "contact") {
                                  include 'page/contact/contact.php';
                              }else if ($_GET['page'] == "update_contact") {
                                  include 'page/contact/update_contact.php';
                              }

                              else if ($_GET['page'] == "depowd") {
                                  include 'page/depowd/depowd.php';
                              }else if ($_GET['page'] == "update_depowd") {
                                  include 'page/depowd/update_depowd.php';
                              }
                              
                              else if ($_GET['page'] == "users_online") {
                                  include 'page/users_online/users_online.php';
                              }

                              else if ($_GET['page'] == "warna") {
                                  include 'page/warna/warna.php';
                              }
                              
                              else if ($_GET['page'] == "update_warna") {
                                  include 'page/warna/update_warna.php';
                              }

                              else if ($_GET['page'] == "payment") {
                                  include 'page/payment/payment.php';
                              }
                              else if ($_GET['page'] == "update_payment") {
                                  include 'page/payment/update_payment.php';
                              }

                              // =====================================================
                              // GOLDSLOT PALACE ROUTING
                              // =====================================================
                              else if ($_GET['page'] == "goldslot") {
                                  // Sub-routing untuk GoldSlotPalace
                                  $sub = $_GET['sub'] ?? 'config';
                                  $subMap = [
                                      'config'         => 'page/goldslot/config_goldslot.php',
                                      'update_config'  => 'page/goldslot/action_update_config.php',
                                      'sync_providers' => 'page/goldslot/action_sync_providers.php',
                                      'agent_info'     => 'page/goldslot/action_agent_info.php',
                                      'test_connection'=> 'page/goldslot/action_test_connection.php',
                                  ];
                                  
                                  if (isset($subMap[$sub])) {
                                      include $subMap[$sub];
                                  } else {
                                      include 'page/goldslot/config_goldslot.php';
                                  }
                              }


                              else{
                                include 'page/dashboard/dashboard.php';
                            }
                            ?>



                            <footer class="footer text-center">
                                All Rights Reserved by <?php echo $judul; ?>. Designed and Developed by <?php echo $judul; ?>.
                            </footer>
                        </div>

                    </div>



                    <script src="../assets/libs/jquery/dist/jquery.min.js"></script>
                    <script src="../assets/libs/popper.js/dist/umd/popper.min.js"></script>
                    <script src="../assets/libs/bootstrap/dist/js/bootstrap.min.js"></script>
                    <script src="../dist/js/app.min.js"></script>
                    <script src="../dist/js/app.init.js"></script>
                    <script src="../dist/js/app-style-switcher.js"></script>
                    <script src="../assets/libs/perfect-scrollbar/dist/perfect-scrollbar.jquery.min.js"></script>
                    <script src="../assets/extra-libs/sparkline/sparkline.js"></script>
                    <script src="../dist/js/waves.js"></script>
                    <script src="../dist/js/sidebarmenu.js"></script>
                    <script src="../dist/js/custom.min.js"></script>
                    <script src="../assets/libs/toastr/build/toastr.min.js"></script>
                    <script src="../assets/extra-libs/toastr/toastr-init.js"></script>
                    <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
                    <script src="../assets/libs/select2/dist/js/select2.full.min.js"></script>
                    <script src="../assets/libs/select2/dist/js/select2.min.js"></script>
                    <script src="../dist/js/pages/forms/select2/select2.init.js"></script>

                    <script src="../assets/extra-libs/DataTables/datatables.min.js"></script>
                    <script src="../dist/js/pages/datatable/datatable-basic.init.js"></script>

                    <!-- Fix for Mobile Audio Autoplay & Anti-Delay -->
                    <script>
                      document.addEventListener('DOMContentLoaded', function () {
                        var audio = document.getElementById('lagu');
                        
                        // Kalau tag audio ada di halaman (berarti ada notif DP/WD)
                        if(audio) {
                          
                          // 1. Coba langsung play (kalau browser udah pernah di-klik sebelumnya, ini langsung bunyi tanpa delay)
                          try { audio.play(); } catch(e) {}
                          
                          // 2. Fungsi jebakan: kalau browser blokir, nunggu gerakan apapun
                          var playAudio = () => {
                            audio.play().catch(() => {});
                            // Lepas semua jebakan biar ga bunyi 2 kali
                            document.removeEventListener('click', playAudio);
                            document.removeEventListener('scroll', playAudio);
                            document.removeEventListener('keydown', playAudio);
                            document.removeEventListener('mousemove', playAudio);
                            document.removeEventListener('touchstart', playAudio);
                          };
                          
                          // 3. Pasang jebakan di semua aktivitas (Klik, Scroll, Mouse Gerak, Keyboard, Touch HP)
                          document.addEventListener('click', playAudio);
                          document.addEventListener('scroll', playAudio);
                          document.addEventListener('keydown', playAudio);
                          document.addEventListener('mousemove', playAudio);
                          document.addEventListener('touchstart', playAudio);
                        }
                      });
                    </script>
                </body>

                </html>