Linux ubuntu 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 x86_64
nginx/1.24.0
: 67.217.245.49 | : 216.73.216.153
Cant Read [ /etc/named.conf ]
8.3.6
www-data
Bypass.pw
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
Backdoor Scanner
Backdoor Create
Alfa Webshell
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
html /
mangacherri /
public_html /
[ HOME SHELL ]
Name
Size
Permission
Action
ads
[ DIR ]
drwxrwxrwx
banner
[ DIR ]
drwxrwxr-x
mangabo
[ DIR ]
drwxrwxrwx
mangas
[ DIR ]
drwxrwxrwx
search
[ DIR ]
drwxrwxr-x
.htaccess
1.48
KB
-r--r--r--
239d244f13.php
6.42
KB
-rwxrwxrwx
404.php
5.44
KB
-rwxrwxrwx
45e452abc6877b2269ba.txt
20
B
-rwxrwxrwx
BingSiteAuth.xml
88
B
-rwxrwxrwx
OS_1.png
431.44
KB
-rwxrwxrwx
OS_2.png
234.1
KB
-rwxrwxrwx
actions.php
2.86
KB
-rwxrwxrwx
ads.txt
175.26
KB
-rwxrwxrwx
android_1.png
201.87
KB
-rwxrwxrwx
android_2.png
218.54
KB
-rwxrwxrwx
api.php
2.67
KB
-rwxrwxrwx
banner_mangacherri.png
255.71
KB
-rwxrwxrwx
boom.php
15.16
KB
-rw-rw-r--
cherribo.zip
5.54
MB
-rw-r--r--
completed.php
9.95
KB
-rwxrwxrwx
datasource.php
3.09
KB
-rw-r--r--
datasource2.php
3.08
KB
-rwxrwxrwx
dbhelper.php
34.51
KB
-rwxrwxrwx
dbhelper2.php
30.76
KB
-rwxrwxrwx
dbhelper_ori.php
27.79
KB
-rwxrwxrwx
default.php
16.17
KB
-rwxrwxrwx
dl_ads.php
125
B
-rw-rw-r--
dl_ads2.php
51
B
-rw-rw-r--
dmca.php
8.97
KB
-rwxrwxrwx
eabccc11b1.php
6.42
KB
-rwxrwxrwx
favicon.ico
67.58
KB
-rwxrwxrwx
favicon.png
16.7
KB
-rwxrwxrwx
favorites.php
90.07
KB
-rwxrwxrwx
festive.php
29
B
-rw-rw-r--
fireworks.php
15.13
KB
-rwxrwxrwx
footer.php
7.99
KB
-rwxrwxrwx
forgot-password.php
6.71
KB
-rwxrwxrwx
genre.php
15.71
KB
-rwxrwxrwx
head.php
596
B
-rwxrwxrwx
header.php
16.5
KB
-rwxrwxrwx
history.php
7.08
KB
-rwxrwxrwx
home.php
45.36
KB
-rwxrwxrwx
home2.php
49.14
KB
-rwxrwxrwx
home_org.php
42.93
KB
-rwxrwxrwx
homex.php
44.32
KB
-rwxrwxrwx
ht_ads1.php
782
B
-rw-rw-r--
ht_ads2.php
640
B
-rw-rw-r--
ht_ads3.php
87.71
KB
-rwxrwxrwx
ht_ads4.php
383
B
-rw-rw-r--
httop_ads1.php
2.99
KB
-rw-rw-r--
icon.ico
148.56
KB
-rwxrwxrwx
icon_snow.png
3.29
KB
-rwxrwxrwx
index.php
22.98
KB
-rwxrwxrwx
index_notice.html
2.42
KB
-rw-rw-r--
install_webapp.php
6.63
KB
-rwxrwxrwx
log.txt
2.95
MB
-rwxrwxrwx
logo.png
43.75
KB
-rwxrwxrwx
logo_dark.7c81824.png
65.63
KB
-rwxrwxrwx
logo_light.d9991b5.png
65.63
KB
-rwxrwxrwx
logo_light.d9991b5_christmas.p...
95.84
KB
-rw-rw-r--
logo_white.f5e6e19.png
65.63
KB
-rwxrwxrwx
manga_og.jpg
79.16
KB
-rwxrwxrwx
mangaberri_banner.png
196.52
KB
-rwxrwxrwx
mangaberri_vid.mp4
6.99
MB
-rwxrwxrwx
mangabg1.png
1.97
MB
-rwxrwxrwx
mangacherri_vid2.mp4
1.02
MB
-rwxrwxrwx
manifest.json
432
B
-rwxrwxrwx
migration_notice.jpg
1.21
MB
-rw-rw-r--
most-viewed.php
10.3
KB
-rwxrwxrwx
new-manga.php
15.38
KB
-rwxrwxrwx
privacy-policy.php
14.08
KB
-rwxrwxrwx
protected.php
669
B
-rwxrwxrwx
pubfuture_script.php
314
B
-rw-rw-r--
read-manga.php
54.17
KB
-rwxrwxrwx
read-manga1.php
49.29
KB
-rwxrwxrwx
read-manga_org.php
51.02
KB
-rwxrwxrwx
reading.php
44.61
KB
-rwxrwxrwx
reading_latest_ori.php
44.53
KB
-rwxrwxrwx
reading_ori.php
29.13
KB
-rwxrwxrwx
register.php
7.63
KB
-rwxrwxrwx
robots.txt
78
B
-rwxrwxrwx
script.php
1.71
KB
-rwxrwxrwx
search.php
15.64
KB
-rwxrwxrwx
seo.php
938
B
-rwxrwxrwx
sign-in.php
6.88
KB
-rwxrwxrwx
simage.php
1.18
KB
-rwxrwxrwx
sitemap-chapters-1.xml
1.4
MB
-rwxrwxrwx
sitemap-chapters-2.xml
780.33
KB
-rwxrwxrwx
sitemap-genre.xml
3.64
KB
-rw-rw-r--
sitemap-manga.xml
48.06
KB
-rw-rw-r--
sitemap-static.xml
1.68
KB
-rw-rw-r--
sitemap_index.xml
873
B
-rw-rw-r--
sitemap_org.xml
1.64
MB
-rwxrwxrwx
snow.php
4.58
KB
-rw-rw-r--
snowflake.php
32
B
-rw-rw-r--
style_css.php
98.25
KB
-rwxrwxrwx
terms-of-service.php
25.38
KB
-rwxrwxrwx
uknown_user.e5ec11a.png
1.25
KB
-rwxrwxrwx
weekly-manga.php
15.39
KB
-rwxrwxrwx
Delete
Unzip
Zip
${this.title}
Close
Code Editor : dbhelper_ori.php
<?php date_default_timezone_set("Asia/Kuching"); class DBHelper { private $db; function __construct() { require_once(__DIR__ . "/datasource.php"); $this->db = new DataSource(); } public function getEncryptionKey() { return 'mangaberri'; } public function log($message) { $myfile = fopen("./log.txt", "a") or die("Unable to open file!"); $txt = $message . "\n"; fwrite($myfile, $txt); fclose($myfile); } function getUserById($user_id) { $result = $this->db->select("SELECT * FROM users WHERE id=:id", ['id' => $user_id]); return $result; } function getUsersCount() { $result = $this->db->select("SELECT * FROM users"); return sizeof($result); } function getClientIP() { $clientIP = $_SERVER['HTTP_CLIENT_IP'] ?? $_SERVER["HTTP_CF_CONNECTING_IP"] # when behind cloudflare ?? $_SERVER['HTTP_X_FORWARDED'] ?? $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['HTTP_FORWARDED'] ?? $_SERVER['HTTP_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0'; return $clientIP; } public function processLogin($username, $password) { $query = "select * FROM users WHERE username = :username AND active=1"; $params = ['username' => $username]; $user = $this->db->select($query, $params); if (!empty($user)) { if (!isset($_SESSION)) { session_start(); } if ($user && password_verify($password, $user[0]['password'])) { $_SESSION["userId"] = $user[0]["id"]; $_SESSION["username"] = $user[0]["username"]; $_SESSION["role"] = $user[0]["role"]; return true; } else { $_SESSION["errorMessage"] = 'Invalid User'; return false; } } else { $_SESSION["errorMessage"] = 'Not Active User'; return false; } } public function addUserActionLog($user_id, $action, $ref_table, $ref_id) { $query = "INSERT INTO user_action_logs (user_id, action, ip, ref_table, ref_id, created) VALUE (:user_id, :action, :ip, :ref_table, :ref_id, :created)"; $params = [ 'user_id' => $user_id, 'action' => $action, 'ip' => $this->getClientIP(), 'ref_table' => $ref_table, 'ref_id' => $ref_id, 'created' => date("Y-m-d H:i:s") ]; $this->db->execute($query, $params); } public function signUp($username, $password) { $passwordHash = password_hash($password, PASSWORD_DEFAULT); $query = "INSERT INTO users (username, password, role, created, modified) VALUE (:username, :password, :role, :created, :modified)"; $params = ['username' => $username, 'password' => $passwordHash, 'role' => 'Super Admin', 'created' => date("Y-m-d H:i:s"), 'modified' => date("Y-m-d H:i:s")]; $user = $this->db->execute($query, $params); if (!empty($user)) { return true; } else { return false; } } public function createManga($title, $author, $description, $genres, $attachment) { $path = ''; $ext = ''; if (!empty($attachment)) { $this->log('Have Attachment'); $path = ''; $ext = ''; $filename = $attachment["name"]; $ext = pathinfo($filename, PATHINFO_EXTENSION); $tempname = $attachment["tmp_name"]; $filename = 'main-' . uniqid() . uniqid() . '.' . $ext; $image_root = '/home/mysenter/public_html/mangapiece.mys-enterprise.com'; $folder_name = 'mangas'; $path = $image_root. '/' . $folder_name . '/' . $filename; $upload_dir = $image_root. '/' . $folder_name . '/'; if (file_exists($upload_dir) && is_writable($upload_dir)) { if (move_uploaded_file($tempname, $path)) { $msg = "Image uploaded successfully"; $query = "INSERT INTO mangas (title, author, description, display_image, genres, created, modified) VALUES (:title, :author, :description, :display_image, :genres, :created, :modified)"; $params = [ 'title' => $title, 'author' => $author, 'description' => $description, 'display_image' => 'https://mangapiece.com/' . $folder_name . '/' . $filename, 'genres' => $genres, 'created' => date("Y-m-d H:i:s"), 'modified' => date("Y-m-d H:i:s") ]; try { $result = $this->db->execute($query, $params); return $result; } catch (Exception $e) { $this->db->log($e); } } else { $msg = "Not uploaded because of error #" . $_FILES["file"]["error"]; $this->db->log($msg); return false; } } $msg = "Not writeable folder"; $this->db->log($msg); return false; } else { $this->log('No Attachement'); $query = "INSERT INTO mangas (title, author, description, display_image, genres, created, modified) VALUES (:title, :author, :description, :display_image, :genres, :created, :modified)"; $params = [ 'title' => $title, 'author' => $author, 'description' => $description, 'display_image' => null, 'genres' => $genres, 'created' => date("Y-m-d H:i:s"), 'modified' => date("Y-m-d H:i:s") ]; $this->log(json_encode($params)); try { $result = $this->db->execute($query, $params); return $result; } catch (Exception $e) { $this->db->log($e); } } } public function updateManga($manga_id, $title, $author, $description, $genres, $rating, $attachment) { $path = ''; $ext = ''; if (!empty($attachment['name'])) { $this->log('Have Attachment'); $path = ''; $ext = ''; $filename = $attachment["name"]; $ext = pathinfo($filename, PATHINFO_EXTENSION); $tempname = $attachment["tmp_name"]; $filename = 'main-' . uniqid() . uniqid() . '.' . $ext; $image_root = '/home/mysenter/public_html/mangapiece.mys-enterprise.com'; $folder_name = 'mangas'; $path = $image_root. '/' . $folder_name . '/' . $filename; $upload_dir = $image_root. '/' . $folder_name . '/'; if (file_exists($upload_dir) && is_writable($upload_dir)) { if (move_uploaded_file($tempname, $path)) { $msg = "Image uploaded successfully"; $query = "UPDATE mangas SET title=:title, author=:author, description=:description, display_image=:display_image, genres=:genres, rating=:rating, modified=:modified where id = :id"; $params = [ 'title' => $title, 'author' => $author, 'description' => $description, 'display_image' => 'https://mangapiece.com/' . $folder_name . '/' . $filename, 'genres' => $genres, 'rating' => $rating, 'modified' => date("Y-m-d H:i:s"), 'id' => $manga_id ]; try { $result = $this->db->execute($query, $params); return $result; } catch (Exception $e) { $this->db->log($e); } } else { $msg = "Not uploaded because of error #" . $_FILES["file"]["error"]; $this->db->log($msg); return false; } } $msg = "Not writeable folder"; $this->db->log($msg); return false; } else { $query = "UPDATE mangas SET title=:title, author=:author, description=:description, genres=:genres, rating=:rating, modified=:modified where id = :id"; $params = [ 'title' => $title, 'author' => $author, 'description' => $description, 'genres' => $genres, 'rating' => $rating, 'modified' => date("Y-m-d H:i:s"), 'id' => $manga_id ]; try { $result = $this->db->execute($query, $params); return $result; } catch (Exception $e) { $this->db->log($e); } } } function uploadToMangaPiece($transfer_type, $files) { $url = 'https://mangapiece.com/mangabo/transfer_image.php?rnd=' . time(); $curl = curl_init(); $params = (object)array(); $params->transfer_type = $transfer_type; $this->db->log('Attachment TMP : ' . $files['tmp_name']); if (function_exists('curl_file_create')) { $params->attachment = curl_file_create($files['tmp_name'], $files['type'], $files['name']); } else { $params->attachment = '@' . $files['tmp_name']; } curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $params )); $this->db->log('Params : ' . json_encode($params)); $response = curl_exec($curl); $this->db->log('Reponse : ' . json_encode($response)); curl_close($curl); return $response; } function getAllMangas() { //$query = "SELECT m.*, (select name from chapters where manga_id = m.id order by id desc limit 1) as latest_chapter, (select id from chapters where manga_id = m.id order by id desc limit 1) as latest_chapter_id FROM `mangas` as m"; $query = "select k.* from (select m.*, count(r.id) as total_rating, (sum(r.rating) / count(r.id)) as average_rating, (select name from chapters where manga_id = m.id order by id desc limit 1) as latest_chapter, (select id from chapters where manga_id = m.id order by id desc limit 1) as latest_chapter_id FROM ratings as r join mangas as m on (m.id = r.manga_id) group by r.manga_id) as k ORDER BY `k`.`average_rating` DESC limit 10"; return $this->db->select($query); } function getManga($id) { $query = "select m.*, sum(c.view) as chapter_view from mangas as m join chapters as c on (c.manga_id = m.id) where m.id = :id"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function getMangaByTitle($title) { $query = "select m.*, sum(c.view) as chapter_view from mangas as m join chapters as c on (c.manga_id = m.id) where REGEXP_REPLACE(REPLACE(LOWER(m.title), ' ', '-'), '[^a-z0-9-]', '') = :title"; $params = ['title'=> $title]; return $this->db->select($query, $params); } function getMangaChapters($id) { $query = "select * FROM chapters where manga_id = :id order by id desc"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function addMangaChapter($manga_id, $chapter_name, $attachments) { $query = "INSERT INTO chapters (manga_id, name, created, modified) VALUES (:manga_id, :name, :created, :modified)"; $params = [ 'manga_id' => $manga_id, 'name' => $chapter_name, 'created' => date("Y-m-d H:i:s"), 'modified' => date("Y-m-d H:i:s") ]; try { $chapter_id = $this->db->executeReturnID($query, $params); $total = count($attachments['name']); for( $i=0 ; $i < $total ; $i++ ) { $tmpFilePath = $attachments['tmp_name'][$i]; $filename = $attachments['name'][$i]; $this->addMangaChapterImage($manga_id, $chapter_id, $filename, $tmpFilePath); } return true; } catch (Exception $e) { $this->db->log($e); } } function updateMangaImages($chapter_id, $chapter_name, $attachments) { $query = "UPDATE chapters SET name=:name, modified=:modified where id=:id"; $params = [ 'id' => $chapter_id, 'name' => $chapter_name, 'modified' => date("Y-m-d H:i:s") ]; try { $result = $this->db->execute($query, $params); $total = count($attachments['name']); for( $i=0 ; $i < $total ; $i++ ) { $tmpFilePath = $attachments['tmp_name'][$i]; $filename = $attachments['name'][$i]; $this->addMangaChapterImage($result[0]['manga_id'], $chapter_id, $filename, $tmpFilePath); } return true; } catch (Exception $e) { $this->db->log($e); return false; } } function addMangaChapterImage($manga_id, $chapter_id, $filename, $tempname) { $ext = pathinfo($filename, PATHINFO_EXTENSION); //$filename = 'chap-' . uniqid() . uniqid() . '.' . $ext; $image_root = '/home/mysenter/public_html/mangapiece.mys-enterprise.com'; $folder_name = 'mangas/' . $manga_id . '/' . $chapter_id; $path = $image_root. '/' . $folder_name . '/' . $filename; $upload_dir = $image_root. '/' . $folder_name . '/'; if (!file_exists($upload_dir)) { mkdir($upload_dir, 0777, true); } if (file_exists($upload_dir) && is_writable($upload_dir)) { if (move_uploaded_file($tempname, $path)) { $query = "INSERT INTO chapter_images (chapter_id, path, filename, created, modified) VALUES (:chapter_id, :path, :filename, :created, :modified)"; $params = [ 'chapter_id' => $chapter_id, 'path' => 'https://mangapiece.com/' . $folder_name . '/' . $filename, 'filename' => $filename, 'created' => date("Y-m-d H:i:s"), 'modified' => date("Y-m-d H:i:s") ]; try { $result = $this->db->execute($query, $params); return $result; } catch (Exception $e) { $this->db->log($e); } } } } function getMangaInfoByChapterId($id) { $query = "select m.* FROM chapters as c join mangas as m on (m.id = c.manga_id) where c.id = :id"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function getChapterInfo($id) { $query = "select * FROM chapters where id = :id"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function getMangaChapterImages($id) { $this->updateMangaChapterView($id); $this->updateMangaChapterViewLog($id); $query = "select * FROM chapter_images where chapter_id = :id"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function updateMangaChapterView($id) { $query = "Update chapters set view=view+1 where id = :id"; $params = ['id'=> $id]; return $this->db->execute($query, $params); } function updateMangaChapterViewLog($id) { $chapter = $this->getChapterInfo($id)[0]; $manga = $this->getMangaInfoByChapterId($id)[0]; $query = "INSERT INTO chapter_views (manga_id, chapter_id, ip, source, created, modified) VALUES (:manga_id, :chapter_id, :ip, :source, :created, :modified)"; $params = [ 'manga_id' => $manga['id'], 'chapter_id' => $id, 'ip' => $this->getClientIP(), 'source' => 'mangaberri.com', 'created' => date("Y-m-d H:i:s"), 'modified' => date("Y-m-d H:i:s") ]; try { return $this->db->execute($query, $params); } catch (Exception $e) { $this->db->log($e); } } function deleteChapterImage($id) { $query = "DELETE FROM chapter_images where id = :id"; $params = ['id'=> $id]; return $this->db->execute($query, $params); } function deleteChapter($id) { $query = "DELETE FROM chapters where id = :id"; $params = ['id'=> $id]; return $this->db->execute($query, $params); } function deleteManga($id) { $query = "DELETE FROM mangas where id = :id"; $params = ['id'=> $id]; return $this->db->execute($query, $params); } function getGenres() { $query = "select * FROM genres order by name"; return $this->db->select($query); } function getActiveGenres() { $query = "select * from ( SELECT g.name, ( SELECT COUNT(m.id) FROM mangas AS m WHERE m.genres LIKE CONCAT('%', g.name, '%') ) AS total FROM genres AS g) as k where k.total > 0 order by name"; return $this->db->select($query); } function getGenreMangas($keyword) { $query = "select k.* from (select m.*, (select name from chapters where manga_id = m.id order by id desc limit 1) as latest_chapter, (select id from chapters where manga_id = m.id order by id desc limit 1) as latest_chapter_id FROM mangas as m where genres like '%". $keyword ."%') as k where latest_chapter_id > 0"; return $this->db->select($query); } function getKeywordMangas($keyword) { $query = "select k.* from (select m.*, (select name from chapters where manga_id = m.id order by id desc limit 1) as latest_chapter, (select id from chapters where manga_id = m.id order by id desc limit 1) as latest_chapter_id FROM mangas as m where m.title like '%". $keyword ."%') as k where latest_chapter_id > 0"; return $this->db->select($query); } function addGenre($name) { $query = "INSERT INTO genres (name, created, modified) VALUES (:name, :created, :modified)"; $params = [ 'name' => $name, 'created' => date("Y-m-d H:i:s"), 'modified' => date("Y-m-d H:i:s") ]; try { $result = $this->db->execute($query, $params); return $result; } catch (Exception $e) { $this->db->log($e); } } function deleteGenre($id) { $query = "DELETE FROM genres where id = :id"; $params = ['id'=> $id]; return $this->db->execute($query, $params); } function getLatestUpdateChapter() { $query = "select max(c.id) as chapter_id, m.* from chapters as c join mangas as m on (m.id = c.manga_id) group by m.id order by chapter_id desc limit 10"; return $this->db->select($query); } function getLatestChapter($id) { $query = "select * FROM chapters where manga_id = :id order by created desc limit 1;"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function getRelatedMangas($id) { $target = $this->getManga($id)[0]; $genres = explode(", ", $target['genres']); $filter = ''; $counter = 0; if(sizeof($genres) > 0) { $filter = "AND ("; foreach($genres as $g) { if($counter == 0) { $filter .= "genres like '%" . $g . "%'"; } else { $filter .= " OR genres like '%" . $g . "%'"; } $counter += 1; } $filter .= ")"; } $query = "select m.*, (select name from chapters where manga_id = m.id order by id desc limit 1) as latest_chapter, (select id from chapters where manga_id = m.id order by id desc limit 1) as latest_chapter_id FROM mangas as m where m.id !=:id " . $filter . " ORDER BY RAND() limit 10"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function getMangaComments($id) { $query = "select * FROM comments where manga_id = :id order by created desc;"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function addMangaComments($manga_id, $comment) { $query = "INSERT INTO comments (manga_id, comment, ip, name, created, modified) VALUES (:manga_id, :comment, :ip, :name, :created, :modified)"; $params = [ 'manga_id' => $manga_id, 'comment' => $comment, 'ip' => $this->getClientIP(), 'name' => uniqid(), 'created' => date("Y-m-d H:i:s"), 'modified' => date("Y-m-d H:i:s") ]; try { return $this->db->select($query, $params); } catch (Exception $e) { $this->db->log($e); } } function addMangaRating($manga_id, $rating) { $query = "INSERT INTO ratings (manga_id, rating, ip, created, modified) VALUES (:manga_id, :rating, :ip, :created, :modified)"; $params = [ 'manga_id' => $manga_id, 'rating' => $rating, 'ip' => $this->getClientIP(), 'created' => date("Y-m-d H:i:s"), 'modified' => date("Y-m-d H:i:s") ]; try { return $this->db->select($query, $params); } catch (Exception $e) { $this->db->log($e); } } function getMangaRatings($id) { $query = "select count(id) as total_rating, (sum(rating) / count(id)) as average_rating FROM ratings where manga_id = :id order by created desc;"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function getAllTimeMangaViewRanking() { $query = "SELECT sum(view) as total_view, m.* FROM chapters as c join mangas as m on (m.id = c.manga_id) group by manga_id ORDER BY sum(view) DESC"; return $this->db->select($query); } function getMangaGenreMostView($id) { $target = $this->getManga($id)[0]; $genres = explode(", ", $target['genres']); $filter = ''; $counter = 0; if(sizeof($genres) > 0) { $filter = "AND ("; foreach($genres as $g) { if($counter == 0) { $filter .= "m.genres like '%" . $g . "%'"; } else { $filter .= " OR m.genres like '%" . $g . "%'"; } $counter += 1; } $filter .= ")"; } $query = "SELECT sum(view) as total_view, m.* FROM chapters as c join mangas as m on (m.id = c.manga_id) ". $filter ." group by manga_id ORDER BY sum(view) DESC"; return $this->db->select($query); } function getMangaGenreMostViewByTitle($title) { $target = $this->getMangaByTitle($title)[0]; $genres = explode(", ", $target['genres']); $filter = ''; $counter = 0; if(sizeof($genres) > 0) { $filter = "AND ("; foreach($genres as $g) { if($counter == 0) { $filter .= "m.genres like '%" . $g . "%'"; } else { $filter .= " OR m.genres like '%" . $g . "%'"; } $counter += 1; } $filter .= ")"; } $query = "SELECT sum(view) as total_view, m.* FROM chapters as c join mangas as m on (m.id = c.manga_id) ". $filter ." group by manga_id ORDER BY sum(view) DESC"; return $this->db->select($query); } function getGenreMostView($keyword) { $query = "SELECT sum(view) as total_view, m.* FROM chapters as c join mangas as m on (m.id = c.manga_id) where m.genres like '%". $keyword ."%' group by manga_id ORDER BY sum(view) DESC"; return $this->db->select($query); } function addMangaRequest($title, $reference_link, $description) { $query = "INSERT INTO request_inboxs (title, reference_link, description, ip, created, modified) VALUES (:title, :reference_link, :description, :ip, :created, :modified)"; $params = [ 'title' => $title, 'reference_link' => $reference_link, 'description' => $description, 'ip' => $this->getClientIP(), 'created' => date("Y-m-d H:i:s"), 'modified' => date("Y-m-d H:i:s") ]; try { return $this->db->select($query, $params); } catch (Exception $e) { $this->db->log($e); } } function getLatestWeekNewManga() { $query = "SELECT sum(view) as total_view, m.* FROM chapters as c join mangas as m on (m.id = c.manga_id) WHERE m.created >= DATE_SUB(CURDATE(), INTERVAL 2 MONTH) group by manga_id ORDER BY m.created desc;"; return $this->db->select($query); } function getLatestWeekHotManga() { $query = "SELECT count(cv.id) as total_view, m.* FROM chapter_views as cv join mangas as m on (m.id = cv.manga_id) WHERE DATE(cv.created) >= CURDATE() - INTERVAL WEEKDAY(CURDATE()) DAY AND DATE(cv.created) < CURDATE() - INTERVAL WEEKDAY(CURDATE()) - 7 DAY group by m.id order by total_view desc"; return $this->db->select($query); } }
Close