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

uwuzu v1.4.12 Funium

This commit is contained in:
Daichimarukana
2025-01-12 20:01:08 +09:00
parent 79328e826c
commit a8b9ad0333
119 changed files with 1656 additions and 4598 deletions
+10 -61
View File
@@ -18,9 +18,6 @@ $res = null;
$option = null;
$error_message = array();
$row["userid"] = array();
$row["password"] = array();
$ruserid = array();
$rpassword = array();
@@ -47,54 +44,17 @@ try {
$userid = $_SESSION['userid'];
$options = array(
// SQL実行失敗時に例外をスルー
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
// デフォルトフェッチモードを連想配列形式に設定
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
// バッファードクエリを使う(一度に結果セットを全て取得し、サーバー負荷を軽減)
// SELECTで得た結果に対してもrowCountメソッドを使えるようにする
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
);
$dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
$result = $dbh->prepare("SELECT userid, username, profile, role FROM account WHERE userid = :userid");
$result->bindValue(':userid', $userid);
// SQL実行
$result->execute();
$row = $result->fetch(); // ここでデータベースから取得した値を $row に代入する
$username = $row["username"];
$role = $row["role"];
//--------------------------------------
$userQuery = $dbh->prepare("SELECT username, userid, loginid, profile, role, iconname FROM account WHERE userid = :userid");
$userQuery->bindValue(':userid', $userid);
$userQuery->execute();
$userData = $userQuery->fetch();
$userData = getUserData($pdo, $userid);
$roles = explode(',', $userData["role"]); // カンマで区切られたロールを配列に分割
$roleDataArray = array();
foreach ($roles as $roleId) {
$rerole = $dbh->prepare("SELECT rolename, roleauth, rolecolor, roleeffect FROM role WHERE roleidname = :role");
$rerole = $pdo->prepare("SELECT rolename, roleauth, rolecolor, roleeffect FROM role WHERE roleidname = :role");
$rerole->bindValue(':role', $roleId);
$rerole->execute();
$roleDataArray[$roleId] = $rerole->fetch();
}
} catch(PDOException $e) {
// 接続エラーのときエラー内容を取得する
@@ -192,13 +152,6 @@ if( !empty($_POST['btn_submit']) ) {
}
}
setcookie('userid', $userid,[
'expires' => time() + 60 * 60 * 24 * 28,
'path' => '/',
'samesite' => 'lax',
'secure' => true,
'httponly' => true,
]);
setcookie('loginid', $userData["loginid"],[
'expires' => time() + 60 * 60 * 24 * 28,
'path' => '/',
@@ -206,14 +159,10 @@ if( !empty($_POST['btn_submit']) ) {
'secure' => true,
'httponly' => true,
]);
setcookie('username', $username,[
'expires' => time() + 60 * 60 * 24 * 28,
'path' => '/',
'samesite' => 'lax',
'secure' => true,
'httponly' => true,
]);
setcookie('admin_login', true,[
$userEncKey = GenUserEnckey($userData["datetime"]);
$userLoginKey = hash_hmac('sha256', $userData["loginid"], $userEncKey);
setcookie('loginkey', $userLoginKey,[
'expires' => time() + 60 * 60 * 24 * 28,
'path' => '/',
'samesite' => 'lax',
@@ -221,9 +170,9 @@ if( !empty($_POST['btn_submit']) ) {
'httponly' => true,
]);
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['loginid'] = $userData["loginid"];
$_SESSION['loginkey'] = $userLoginKey;
$_SESSION['username'] = $username;
$_SESSION['password'] = null;
@@ -285,7 +234,7 @@ $pdo = null;
<div class="textbox">
<h1>確認</h1>
<p>あなたは <?php if( !empty($row["username"]) ){ echo replaceProfileEmojiImages(safetext( $row["username"])); } ?> ですか?</p>
<p>あなたは <?php if( !empty($userData["username"]) ){ echo replaceProfileEmojiImages(safetext( $userData["username"])); } ?> ですか?</p>
<?php if( !empty($error_message) ): ?>
<ul class="errmsg">
@@ -298,7 +247,7 @@ $pdo = null;
<div class="myarea">
<img src="<?php echo safetext($userData['iconname']); ?>">
<p>ユーザー名</p>
<h2><?php if( !empty($row["username"]) ){ echo replaceProfileEmojiImages(safetext( $row["username"])); } ?></h2>
<h2><?php if( !empty($userData["username"]) ){ echo replaceProfileEmojiImages(safetext( $userData["username"])); } ?></h2>
<div class="roleboxes">
<?php foreach ($roles as $roleId): ?>
<?php $roleData = $roleDataArray[$roleId]; ?>
@@ -322,7 +271,7 @@ $pdo = null;
</div>
<hr>
<p>プロフィール</p>
<h3><?php if( !empty($row["profile"]) ){ echo safetext( $row["profile"]); } ?></h3>
<h3><?php if( !empty($userData["profile"]) ){ echo safetext( $userData["profile"]); } ?></h3>
</div>