ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() 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/okanime.top/ |
<?php ini_set("display_errors", true); set_time_limit(0); 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(); require ROOT_PATH."lib/class_functions.php"; $func = new FUNC; $CORE->input = $func->get_input(); require ROOT_PATH."lib/class_db.php"; $DB = new db_driver; $DB->connect($INFO); require ROOT_PATH."include/functions/index.php"; //check option $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://1stkissmanga.me'; $content = get_content_page_chap($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('ul.version-chap > *')); foreach($html->find('ul.version-chap li') 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{ 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($url_chap, $referer); $html = str_get_html($content_chap); $j = 1; foreach ($html->find('div.reading-content div.page-break') as $val) { $url_img = trim($val->find('img', 0)->src); $content_img = get_content_page_chap($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(); $text_show = $chap_name . " with " . $row_count_img['total'] . " images updated from url chap: $url_chap !<br/>"; echo $text_show; doFlush(); }else{ $i++; ob_start(); $text_show = $chap_name . " with " . $row_chuong['chuong_number_img'] . " images already update !<br/>"; echo $text_show; doFlush(); } //update chuong $q_img = $DB->query("SELECT url_dir,file_name FROM tb_chuong_img WHERE chuong_id='" . $chuong_id . "' ORDER BY chuong_img_pos ASC"); $arr_url_img = array(); while($r_img = $DB->fetch_row($q_img)){ $arr_url_img[] = $r_img['url_dir'] . '/' . $r_img['file_name']; } if(isset($arr_url_img) and !empty($arr_url_img)){ $txt_url_img = json_encode($arr_url_img); $arr_insert_chuongimg = array('chuong_id'=>$chuong_id,'chuong_img_show'=>$txt_url_img); $row_check_chuongimg = $DB->fetch_row($DB->query("SELECT * FROM tb_chuong_imgshow WHERE chuong_id='$chuong_id' ")); if(!$row_check_chuongimg){ $DB->do_insert('tb_chuong_imgshow',$arr_insert_chuongimg); }else{ $DB->do_update('tb_chuong_imgshow',$arr_insert_chuongimg, " WHERE chuong_id='$chuong_id' "); } } } } 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')."' 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!'; ?>