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

uwuzu v1.6.12 Hapuego

This commit is contained in:
だいちまる
2026-04-22 01:24:23 +09:00
parent f439bd171f
commit b39307b651
36 changed files with 2851 additions and 2584 deletions
+51 -48
View File
@@ -15,55 +15,58 @@ if (safetext(isset($_POST['get_account'])) && safetext(isset($_POST['userid']))
if ($is_login === false) {
echo json_encode(['success' => false, 'error' => '認証に失敗しました。(AUTH_INVALID)']);
exit;
}
// データベースに接続
try {
$option = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
);
$pdo = new PDO('mysql:charset=utf8mb4;dbname=' . DB_NAME . ';host=' . DB_HOST, DB_USER, DB_PASS, $option);
} catch (PDOException $e) {
// 接続エラーのときエラー内容を取得する
$error_message[] = $e->getMessage();
}
if (!empty($pdo)) {
// カンマ区切りまたは1つのユーザーID文字列を処理
$usernames = array_unique(array_filter(explode(',', $get_account)));
$lower_usernames = array_map('mb_strtolower', $usernames);
$results = [];
if (count($lower_usernames) > 0) {
$placeholders = implode(',', array_fill(0, count($lower_usernames), '?'));
$stmt = $pdo->prepare("SELECT userid, username FROM account WHERE LOWER(userid) IN ($placeholders)");
$stmt->execute($lower_usernames);
$fetched = [];
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$fetched[mb_strtolower($row['userid'])] = [
'userid' => $row['userid'],
'username' => $row['username']
];
}
foreach ($usernames as $name) {
$lower = mb_strtolower($name);
$results[$name] = $fetched[$lower] ?? null;
}
}elseif(is_sameUserid($userId, $is_login["userid"]) === true){
// データベースに接続
try {
$option = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
);
$pdo = new PDO('mysql:charset=utf8mb4;dbname=' . DB_NAME . ';host=' . DB_HOST, DB_USER, DB_PASS, $option);
} catch (PDOException $e) {
// 接続エラーのときエラー内容を取得する
$error_message[] = $e->getMessage();
}
echo json_encode([
"success" => true,
"users" => $results
], JSON_UNESCAPED_UNICODE);
} else {
echo json_encode([
"success" => false,
"users" => null
], JSON_UNESCAPED_UNICODE);
if (!empty($pdo)) {
// カンマ区切りまたは1つのユーザーID文字列を処理
$usernames = array_unique(array_filter(explode(',', $get_account)));
$lower_usernames = array_map('mb_strtolower', $usernames);
$results = [];
if (count($lower_usernames) > 0) {
$placeholders = implode(',', array_fill(0, count($lower_usernames), '?'));
$stmt = $pdo->prepare("SELECT userid, username FROM account WHERE LOWER(userid) IN ($placeholders)");
$stmt->execute($lower_usernames);
$fetched = [];
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$fetched[mb_strtolower($row['userid'])] = [
'userid' => $row['userid'],
'username' => $row['username']
];
}
foreach ($usernames as $name) {
$lower = mb_strtolower($name);
$results[$name] = $fetched[$lower] ?? null;
}
}
echo json_encode([
"success" => true,
"users" => $results
], JSON_UNESCAPED_UNICODE);
} else {
echo json_encode([
"success" => false,
"users" => null
], JSON_UNESCAPED_UNICODE);
}
}else{
echo json_encode(['success' => false, 'error' => '認証に失敗しました。(AUTH_INVALID)']);
exit;
}
}else{
$item = array(