<div class="row">
        <div class="col-md-12">
                <div class="card border border-danger">
                    <form method="POST" action="config/add-admin.php" class="form-horizontal">
                        <div class="card-body">
                            <h4 class="card-title"><i class="mdi mdi-plus-circle"></i> Tambah Admin</h4>
                        
                            <div class="form-group row">
                                <label class="col-sm-3 text-right control-label col-form-label">Username :</label>

                                    <div class="col-sm-3">
                                        <input type="text" name="username" placeholder="Masukkan Username Admin Baru" onkeyup="this.value = this.value.replace(/[^a-z0-9]/g, '')" maxlength="10" class="form-control" required>
                                    </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-3 text-right control-label col-form-label">Password :</label>

                                    <div class="col-sm-3">
                                        <input type="password" name="passadmin" placeholder="Masukkan Password Admin baru" class="form-control" required>
                                    </div>
                            </div>

                            
                            <div class="card-body my-3">
                                <button type="submit" class="btn float-right btn-primary"><i class="mdi mdi-plus-circle"></i> Tambahkan Result</button>
                            </div>
                    </form>
                </div>
        </div>

        <div class="col-xl-12">
        <div class="card border border-info">
        <div class="card-body">
                                <h5 class="card-title m-b-0"><i class="mdi mdi-dice-d20"></i> Semua Admin Terdaftar</h5>
                            </div>
                            <table class="table font-weight-bold">
                                  <thead>
                                    <tr>
                                      <th scope="col">#</th>
                                      <th scope="col">Username</th>
                                      <th scope="col">Pass Baru</th>
                                      <th scope="col">Tanggal</th>
                                      <th scope="col">Action</th>
                                    </tr>
                                  </thead>
                                  <tbody>

                                  <?php

                                    $results_per_page = 100;
                                    $sql='SELECT * FROM lomba_credential';
                                    $result = mysqli_query($data, $sql);
                                    $number_of_results = mysqli_num_rows($result);

                                    $number_of_pages = ceil($number_of_results/$results_per_page);

                                    if (!isset($_GET['no'])) {
                                    $page = 1;
                                    } else {
                                    $page = $_GET['no'];
                                    }

                                    $this_page_first_result = ($page-1)*$results_per_page;
                                    $spre = "SELECT * FROM lomba_credential ORDER BY tgl_daftar DESC LIMIT ".$this_page_first_result." ,".$results_per_page;
                                    $qpre = mysqli_query($data, $spre);

                                        if(mysqli_num_rows($qpre) > 0) {
                                            $n = 1;
                                            while($fpre = mysqli_fetch_assoc($qpre)) {
                                                $pasaranpre = $fpre['nama_pengguna'];
                                                $tglpre = $fpre['tgl_daftar'];
                                                $idpre = $fpre['id'];

                                                echo '
                                                <tr>
                                                <th scope="row">'.$n++.'</th>
                                                <td class="text-uppercase">'.$pasaranpre.'</td>
                                                <form method="post" action="config/update-passadmin.php?row='.$idpre.'">
                                                <td class="text-capitalize"><input type="password" class="form-control" name="updpass" /></td>
                                                <td> '.date("d M Y | H:i:s", strtotime($tglpre)).'</td>
                                                <td><button type="submit" class="btn btn-primary"><i class="fas fa-check"></i> Edit</button> <a href="config/deladmin.php?row='.$idpre.'" class="btn btn-danger"><i class="fas fa-times"></i> Hapus</a></td>
                                                </form>
                                                </tr>
                                                ';

                                            }

                                        } else {

                                        }

                                    ?>


                                    

                                  </tbody>
                            </table>

         </div>

         <div class="col-12">
                <div>
                    <nav>
                        <ul class="pagination" style="display: flex; flex-wrap: wrap;">
                            <?php 
                            // display the links to the pages
                                for ($page=1;$page<=$number_of_pages;$page++) {
                                echo ' <li class="page-item"><a class="page-link font-weight-bold" href="?hal=result&no=' . $page . '">' . $page . '</a></li>';
                                }

                            ?>
                            
                        </ul>
                    </nav>
                </div>
        </div>

         
</div>