1
0
mirror of https://github.com/Daichimarukana/uwuzu.git synced 2026-06-04 19:14:41 +00:00

uwuzu v1.4.11 Funium

This commit is contained in:
Daichimarukana
2024-12-29 17:21:14 +09:00
parent b6069366d1
commit 79328e826c
49 changed files with 648 additions and 717 deletions
+2 -12
View File
@@ -2,8 +2,7 @@
require('../../db.php');
require("../../function/function.php");
header("Content-Type: application/json");
header("charset=utf-8");
header("Content-Type: application/json; charset=utf-8");
header("Access-Control-Allow-Origin: *");
if (safetext(isset($_POST['code'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id']))){
@@ -22,14 +21,7 @@ if (safetext(isset($_POST['code'])) && safetext(isset($_POST['userid'])) && safe
$error_message[] = $e->getMessage();
}
// データベース接続の設定
$dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
));
$query = $dbh->prepare('SELECT * FROM account WHERE userid = :userid limit 1');
$query = $pdo->prepare('SELECT * FROM account WHERE userid = :userid limit 1');
$query->execute(array(':userid' => $postUserid));
@@ -38,8 +30,6 @@ if (safetext(isset($_POST['code'])) && safetext(isset($_POST['userid'])) && safe
if($result2["loginid"] === $loginid){
if($result2["admin"] === "yes"){
try {
$pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS);
// 削除クエリを実行
$deleteQuery = $pdo->prepare("DELETE FROM invitation WHERE code = :code");
$deleteQuery->bindValue(':code', $postCode, PDO::PARAM_STR);
+2 -10
View File
@@ -2,8 +2,7 @@
require('../../db.php');
require("../../function/function.php");
header("Content-Type: application/json");
header("charset=utf-8");
header("Content-Type: application/json; charset=utf-8");
header("Access-Control-Allow-Origin: *");
if (isset($_FILES['update_zip']) && isset($_POST['userid']) && isset($_POST['account_id'])){
@@ -22,14 +21,7 @@ if (isset($_FILES['update_zip']) && isset($_POST['userid']) && isset($_POST['acc
$error_message[] = $e->getMessage();
}
// データベース接続の設定
$dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
));
$query = $dbh->prepare('SELECT * FROM account WHERE userid = :userid limit 1');
$query = $pdo->prepare('SELECT * FROM account WHERE userid = :userid limit 1');
$query->execute(array(':userid' => $postUserid));
+48 -13
View File
@@ -217,22 +217,56 @@ if(!empty($pdo)){
//DB_Data
try {
$dbname = DB_NAME;
$query = "
SELECT
table_name AS `Table`,
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS `Size`
FROM
information_schema.TABLES
WHERE
table_schema = :database
ORDER BY
`Size` DESC;
";
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// データベース内の全テーブル名を取得
$query = "SELECT table_name FROM information_schema.tables WHERE table_schema = :database";
$stmt = $pdo->prepare($query);
$stmt->bindParam(':database', $dbname);
$stmt->execute();
$db_results = $stmt->fetchAll(PDO::FETCH_ASSOC);
$tables = $stmt->fetchAll(PDO::FETCH_COLUMN);
// 各テーブルの正確な行数を取得
$db_results = [];
foreach ($tables as $table) {
// 行数を取得
$rowQuery = "SELECT COUNT(*) as count FROM `$table`";
$rowStmt = $pdo->query($rowQuery);
$rowCount = (int)$rowStmt->fetchColumn();
// テーブルサイズを取得
$sizeQuery = "
SELECT
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS `Size`
FROM
information_schema.TABLES
WHERE
table_schema = :database AND table_name = :table;
";
$sizeStmt = $pdo->prepare($sizeQuery);
$sizeStmt->execute([':database' => $dbname, ':table' => $table]);
$size = (float)$sizeStmt->fetchColumn();
// 結果を格納
$db_results[] = [
'Table' => $table,
'Rows' => $rowCount,
'Size' => $size,
];
}
// サイズで並び替え
usort($db_results, function ($a, $b) {
return $b['Size'] <=> $a['Size'];
});
// 行数を最大桁数に揃えて0埋め
$maxRows = max(array_column($db_results, 'Rows'));
foreach ($db_results as &$table) {
$table['Rows'] = str_pad($table['Rows'], strlen($maxRows), '0', STR_PAD_LEFT);
}
unset($table); // 参照を解除
} catch (PDOException $e) {
$db_results = null;
}
@@ -405,6 +439,7 @@ require('../logout/logout.php');
echo "<tr>";
echo "<td>".$value['Table']."</td>";
echo "<td>".$value['Size']." MB</td>";
echo "<td>".$value['Rows']." Records</td>";
echo "</tr>";
}
}