diff --git a/abi/addabi.php b/abi/addabi.php index aa6c6b2..65aba87 100644 --- a/abi/addabi.php +++ b/abi/addabi.php @@ -4,8 +4,37 @@ require('../db.php'); if (htmlentities(isset($_POST['uniqid'])) && htmlentities(isset($_POST['abitext']))) { $postUniqid = htmlentities($_POST['uniqid']); $abitext = htmlentities($_POST['abitext']); + $username = htmlentities($_POST['username']); $abidate = date("Y-m-d H:i:s"); + //------------------------------------------- + function get_mentions_userid($postText) { + // @useridを検出する + $usernamePattern = '/@(\w+)/'; + $mentionedUsers = []; + + preg_replace_callback($usernamePattern, function($matches) use (&$mentionedUsers) { + $mention_username = $matches[1]; + + $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, + )); + + $mention_userQuery = $dbh->prepare("SELECT username, userid FROM account WHERE userid = :userid"); + $mention_userQuery->bindValue(':userid', $mention_username); + $mention_userQuery->execute(); + $mention_userData = $mention_userQuery->fetch(); + + if (!empty($mention_userData)) { + $mentionedUsers[] = $mention_username; + } + }, $postText); + + return $mentionedUsers; + } + try { $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS); @@ -22,6 +51,56 @@ if (htmlentities(isset($_POST['uniqid'])) && htmlentities(isset($_POST['abitext' // コミット $pdo->commit(); + $mentionedUsers = get_mentions_userid($abitext); + + foreach ($mentionedUsers as $mentionedUser) { + + $pdo->beginTransaction(); + + try { + $touserid = $mentionedUser; + $datetime = date("Y-m-d H:i:s"); + $msg = "" . $abitext . ""; + $title = "" . $username . "さんにメンションされました!"; + $url = "/!" . $uniqid . "~" . $userid . ""; + $userchk = 'none'; + + // 通知用SQL作成 + $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); + + + $stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR); + $stmt->bindParam(':msg', $msg, PDO::PARAM_STR); + $stmt->bindParam(':url', $url, PDO::PARAM_STR); + $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR); + $stmt->bindParam(':title', $title, PDO::PARAM_STR); + + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + + // SQLクエリの実行 + $res2 = $stmt->execute(); + + // コミット + $res2 = $pdo->commit(); + + } catch(Exception $e) { + + // エラーが発生した時はロールバック + $pdo->rollBack(); + } + + if ($res2) { + header('Content-Type: application/json'); + echo json_encode(['success' => true]); + exit; + } else { + header('Content-Type: application/json'); + echo json_encode(['success' => false, 'error' => '追加に失敗しました。']); + exit; + } + + } + if ($res) { header('Content-Type: application/json'); echo json_encode(['success' => true]); diff --git a/addauthcode.php b/addauthcode.php index 28dd3ac..fa3365e 100644 --- a/addauthcode.php +++ b/addauthcode.php @@ -21,7 +21,9 @@ $servernamefile = "server/servername.txt"; $onlyuserfile = "server/onlyuser.txt"; $onlyuser = file_get_contents($onlyuserfile); +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); // 変数の初期化 $current_date = null; diff --git a/authcodechk.php b/authcodechk.php index 1628865..90a5985 100644 --- a/authcodechk.php +++ b/authcodechk.php @@ -16,7 +16,9 @@ $servernamefile = "server/servername.txt"; $onlyuserfile = "server/onlyuser.txt"; $onlyuser = file_get_contents($onlyuserfile); +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); // 変数の初期化 $current_date = null; diff --git a/authlogin.php b/authlogin.php index b7a79f7..c38956a 100644 --- a/authlogin.php +++ b/authlogin.php @@ -21,7 +21,9 @@ $ruserid = ""; $rpassword = ""; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); $userid = $_SESSION['userid']; diff --git a/check.php b/check.php index add773a..15fdd0e 100644 --- a/check.php +++ b/check.php @@ -21,7 +21,9 @@ $row["password"] = array(); $ruserid = array(); $rpassword = array(); +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); // データベースに接続 try { diff --git a/css/home.css b/css/home.css index feefccf..2938029 100644 --- a/css/home.css +++ b/css/home.css @@ -1020,8 +1020,19 @@ main h1{ color:#999; font-family: 'BIZ UDPGothic', sans-serif; } +.ueuse .photo1 a{ + width: 48%; + margin-left: auto; + margin-right: auto; +} +.ueuse .photo2 a{ + width: 48%; + margin-left: auto; + margin-right: auto; +} -.ueuse .photo1 img{ + +.ueuse .photo1 a img{ object-fit: cover; border-radius: 10px; margin-top: 12px; @@ -1036,13 +1047,13 @@ main h1{ display: flex; } -.ueuse .photo2 img{ +.ueuse .photo2 a img{ object-fit: cover; border-radius: 10px; margin-top: 12px; margin-left: auto; margin-right: auto; - width: 47%; + width: 100%; height: 350px; border: 1px solid #EEE; } @@ -2870,6 +2881,60 @@ hr{ border-bottom: 1px solid #FFC832; } +.hny{ + border-radius: 10px; + overflow: hidden; + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05) inset; + margin: 12px; + border: 1px solid #EEE; +} +.hny .top{ + background-color: #CB4042; + padding-left: 24px; + padding-right: 24px; + padding-top: 8px; + padding-bottom: 8px; + color:#FCFAF2; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: bold; +} +.hny .textmain{ + background-color: #EEE; + padding-top: 8px; + padding-bottom: 8px; + padding-left: 24px; + padding-right: 24px; +} +.hny .textmain h1{ + background-color: #FFC832; + text-align: left; + color:#FCFAF2; + font-family: 'BIZ UDPGothic', sans-serif; + word-wrap: break-word; + font-size: 32px; + line-height: 32px; + padding: 12px; + border-radius: 7px; +} +.hny .textmain p{ + text-align: left; + color:#252525; + font-family: 'BIZ UDPGothic', sans-serif; + word-wrap: break-word; + font-size: 16px; + line-height: 22px; + font-weight: bold; +} +.hny .textmain .rp{ + text-align: right; + color:#252525; + font-family: 'BIZ UDPGothic', sans-serif; + word-wrap: break-word; + font-size: 14px; + line-height: 22px; + font-weight: normal; + margin-bottom: 6px; +} /*------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------スマホ向け--------------------------------------------------*/ /*--------------------------------------------------ここから--------------------------------------------------*/ @@ -3922,6 +3987,69 @@ hr{ margin-bottom: 12px; font-size: 20px; } + + .hny{ + position: absolute; + animation: slideDownhny 5.0s ease-in-out forwards; + border-radius: 10px; + overflow: hidden; + box-shadow:0 0px 32px 0 rgba(0, 0, 0, .15); + margin: 12px; + border: 1px solid #EEE; + } + @keyframes slideDownhny { + 0%, 100% { transform: translateY(-40dvh); } + 20%, 90% { transform: translateY(0px); } + } + .hny .top{ + background-color: #CB4042; + padding-left: 24px; + padding-right: 24px; + padding-top: 8px; + padding-bottom: 8px; + color:#FCFAF2; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: bold; + } + .hny .textmain{ + background-color: #EEE; + padding-top: 8px; + padding-bottom: 8px; + padding-left: 24px; + padding-right: 24px; + } + .hny .textmain h1{ + background-color: transparent; + text-align: left; + color:#252525; + font-family: 'BIZ UDPGothic', sans-serif; + word-wrap: break-word; + font-size: 22px; + line-height: 32px; + padding: 0px; + border-radius: 7px; + } + .hny .textmain p{ + margin: 0px; + text-align: left; + color:#252525; + font-family: 'BIZ UDPGothic', sans-serif; + word-wrap: break-word; + font-size: 16px; + line-height: 22px; + font-weight: bold; + } + .hny .textmain .rp{ + margin-top: 6px; + text-align: right; + color:#252525; + font-family: 'BIZ UDPGothic', sans-serif; + word-wrap: break-word; + font-size: 14px; + line-height: 22px; + font-weight: normal; + margin-bottom: 6px; + } } /*------------------------------------------------------------------------------------------------------------*/ diff --git a/emoji/addemoji.php b/emoji/addemoji.php index 985cbbb..3930ce7 100644 --- a/emoji/addemoji.php +++ b/emoji/addemoji.php @@ -23,7 +23,9 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); $userid = htmlentities($_SESSION['userid']); $username = htmlentities($_SESSION['username']); @@ -59,10 +61,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -86,10 +104,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; diff --git a/emoji/emojiimage.php b/emoji/emojiimage.php index 7475c7d..2a0b5a9 100644 --- a/emoji/emojiimage.php +++ b/emoji/emojiimage.php @@ -21,7 +21,9 @@ $rpassword = array(); $emojiname = null; $_SESSION["emojiname"]=""; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); $option = array( diff --git a/emoji/index.php b/emoji/index.php index 8788fe3..e6c1cc9 100644 --- a/emoji/index.php +++ b/emoji/index.php @@ -22,6 +22,7 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); session_regenerate_id(true); @@ -58,10 +59,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -85,10 +102,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; diff --git a/home/ftl.php b/home/ftl.php index 611ad5f..a83247c 100644 --- a/home/ftl.php +++ b/home/ftl.php @@ -22,7 +22,9 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); //------------------------------------------ // データベースに接続 @@ -57,10 +59,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -84,10 +102,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -679,55 +713,56 @@ $(document).ready(function() { $(document).on('click', '.addabi', function (event) { - abimodal.style.display = 'block'; - modalMain.addClass("slideUp"); - modalMain.removeClass("slideDown"); + abimodal.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); - var uniqid2 = $(this).attr('data-uniqid2'); - var postAbiElement = $(this).closest('.addabi'); + var uniqid2 = $(this).attr('data-uniqid2'); + var postAbiElement = $(this).closest('.addabi'); - AbiCancelButton.addEventListener('click', () => { + AbiCancelButton.addEventListener('click', () => { + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + abimodal.style.display = 'none'; + }, 150); + }); + + $('#AbiForm').off('submit').on('submit', function (event) { + + event.preventDefault(); + + var abitext = document.getElementById("abitexts").value; + var username = ""; + + if(abitext == ""){ modalMain.removeClass("slideUp"); - modalMain.addClass("slideDown"); + modalMain.addClass("slideDown"); window.setTimeout(function(){ abimodal.style.display = 'none'; }, 150); - }); + }else{ + $.ajax({ + url: '../abi/addabi.php', + method: 'POST', + data: { uniqid: uniqid2, abitext: abitext, username: username}, + dataType: 'json', + success: function (response) { + console.log(response); // レスポンス内容をコンソールに表示 + if (response.success) { + abimodal.style.display = 'none'; + postAbiElement.remove(); - $('#AbiForm').off('submit').on('submit', function (event) { - - event.preventDefault(); - - var abitext = document.getElementById("abitexts").value; - - if(abitext == ""){ - modalMain.removeClass("slideUp"); - modalMain.addClass("slideDown"); - window.setTimeout(function(){ - abimodal.style.display = 'none'; - }, 150); - }else{ - $.ajax({ - url: '../abi/addabi.php', - method: 'POST', - data: { uniqid: uniqid2, abitext: abitext}, - dataType: 'json', - success: function (response) { - console.log(response); // レスポンス内容をコンソールに表示 - if (response.success) { - abimodal.style.display = 'none'; - postAbiElement.remove(); - - } else { - - } - }, - error: function (xhr, status, error) { + } else { } - }); - } - }); + }, + error: function (xhr, status, error) { + + } + }); + } + }); }); }); diff --git a/home/index.php b/home/index.php index 86583e6..358b52c 100644 --- a/home/index.php +++ b/home/index.php @@ -22,7 +22,9 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); //------------------------------------------ // データベースに接続 @@ -57,10 +59,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid, [ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -84,10 +102,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -373,6 +407,12 @@ require('../logout/logout.php'); // データベースの接続を閉じる $pdo = null; +if(isset($_GET['text'])){ + $ueuse = $_GET['text']; +}else{ + $ueuse = ""; +} + ?> @@ -402,6 +442,33 @@ if ("serviceWorker" in navigator) {
+ +
+
Happy New Year !!!
+
+

あけましておめでとうございます!

+

あけましておめでとうございます
今日からですね~!
今年もどうぞuwuzuをよろしくお願いいたします!

+

+
+ +
+
+ +
LTL FTL @@ -415,7 +482,7 @@ if ("serviceWorker" in navigator) {
- +

画像のEXIF情報(位置情報など)は削除されません。
情報漏洩に気をつけてくださいね…

'; @@ -132,12 +138,12 @@ class MessageDisplay { if (!empty($this->value['photo2']) && $this->value['photo2'] !== 'none') { echo '
'; - echo ' 画像'; - echo ' 画像'; + echo ' 画像1'; + echo ' 画像2'; echo '
'; } elseif (!empty($this->value['photo1']) && $this->value['photo1'] !== 'none') { echo '
'; - echo ' 画像'; + echo ' 画像1'; echo '
'; } if (!empty($this->value['video1']) && $this->value['video1'] !== 'none') { diff --git a/notice/addnotice.php b/notice/addnotice.php index 5372d51..d6119f9 100644 --- a/notice/addnotice.php +++ b/notice/addnotice.php @@ -23,7 +23,9 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); $userid = htmlentities($_SESSION['userid']); $username = htmlentities($_SESSION['username']); @@ -59,10 +61,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -86,10 +104,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; diff --git a/notice/notice.php b/notice/notice.php index 6dbb324..6aaddc0 100644 --- a/notice/notice.php +++ b/notice/notice.php @@ -24,17 +24,4 @@ while ($row = $notice_array->fetch(PDO::FETCH_ASSOC)) { $notices[] = $row; } -if(!empty($notices)){ - foreach ($notices as $value) { - $uneinoticenote = htmlentities($value['note']); - $uneinoticetitle = htmlentities($value['title']); - $uneinoticeaccount = htmlentities($value['account']); - $uneinoticedatetime = htmlentities($value['datetime']); - } -}else{ - $uneinoticenote = ""; - $uneinoticetitle = "おしらせはありません"; - $uneinoticeaccount = "uwuzu"; - $uneinoticedatetime = ""; -} ?> diff --git a/notification/index.php b/notification/index.php index 28ce70d..63744d2 100644 --- a/notification/index.php +++ b/notification/index.php @@ -24,7 +24,9 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); $userid = htmlentities($_SESSION['userid']); $username = htmlentities($_SESSION['username']); @@ -61,10 +63,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -88,10 +106,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; diff --git a/others/index.php b/others/index.php index ddb5340..68bdb07 100644 --- a/others/index.php +++ b/others/index.php @@ -28,7 +28,9 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); $userid = htmlentities($_SESSION['userid']); $username = htmlentities($_SESSION['username']); @@ -72,10 +74,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -99,10 +117,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; diff --git a/others/token.php b/others/token.php index dfc92ee..423f942 100644 --- a/others/token.php +++ b/others/token.php @@ -8,7 +8,9 @@ require('../db.php'); $onlyuserfile = "../server/onlyuser.txt"; $onlyuser = file_get_contents($onlyuserfile); +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); // 変数の初期化 $current_date = null; @@ -56,10 +58,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -83,10 +101,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; diff --git a/passrecovery/index.php b/passrecovery/index.php index 7c048d7..ea5ad58 100644 --- a/passrecovery/index.php +++ b/passrecovery/index.php @@ -26,8 +26,9 @@ $_SESSION["userid"]=""; $password = null; $_SESSION["password"]=""; - +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); // データベースに接続 try { diff --git a/passrecovery/startrecovery.php b/passrecovery/startrecovery.php index 0be93ee..f5ff96e 100644 --- a/passrecovery/startrecovery.php +++ b/passrecovery/startrecovery.php @@ -26,8 +26,9 @@ $_SESSION["userid"]=""; $password = null; $_SESSION["password"]=""; - +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); $userid = $_SESSION['userid']; try { diff --git a/require/rightbox.php b/require/rightbox.php index a5ab56b..d12b00d 100644 --- a/require/rightbox.php +++ b/require/rightbox.php @@ -21,14 +21,22 @@ ?>

お知らせ

- + +
+

なし

+

おしらせないよ~

+

編集者 : @uwuzu

+

いま

+
+ +
-

-

-

編集者 : @

-

+

+

+

編集者 : @

+

- +

サーバー情報

diff --git a/search/index.php b/search/index.php index 72e7b90..d361a9e 100644 --- a/search/index.php +++ b/search/index.php @@ -22,7 +22,9 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); //------------------------------------------ // データベースに接続 @@ -57,10 +59,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -84,10 +102,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -299,19 +333,27 @@ $(document).ready(function() { + var modal = document.getElementById('myDelModal'); var deleteButton = document.getElementById('deleteButton'); var cancelButton = document.getElementById('cancelButton'); // 追加 + var modalMain = $('.modal-content'); $(document).on('click', '.delbtn', function (event) { modal.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); var uniqid2 = $(this).attr('data-uniqid2'); var postElement = $(this).closest('.ueuse'); deleteButton.addEventListener('click', () => { - modal.style.display = 'none'; + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + modal.style.display = 'none'; + }, 150); $.ajax({ url: '../delete/delete.php', @@ -332,25 +374,54 @@ $(document).ready(function() { }); cancelButton.addEventListener('click', () => { // 追加 - modal.style.display = 'none'; + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + modal.style.display = 'none'; + }, 150); }); }); + var more_modal = document.getElementById('myMoreModal'); + var m_cancelButton = document.getElementById('m_c_button'); // 追加 + var modalMain = $('.modal-content'); + + $(document).on('click', '.more_btn', function (event) { + more_modal.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); + + m_cancelButton.addEventListener('click', () => { + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + more_modal.style.display = 'none'; + }, 150); + }); + }); + var abimodal = document.getElementById('myAbiModal'); var AbiAddButton = document.getElementById('AbiAddButton'); var AbiCancelButton = document.getElementById('AbiCancelButton'); + var modalMain = $('.modal-content'); $(document).on('click', '.addabi', function (event) { abimodal.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); var uniqid2 = $(this).attr('data-uniqid2'); var postAbiElement = $(this).closest('.addabi'); AbiCancelButton.addEventListener('click', () => { - abimodal.style.display = 'none'; + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + abimodal.style.display = 'none'; + }, 150); }); $('#AbiForm').off('submit').on('submit', function (event) { @@ -358,27 +429,35 @@ $(document).ready(function() { event.preventDefault(); var abitext = document.getElementById("abitexts").value; + var usernames = ''; if(abitext == ""){ - abimodal.style.display = 'none'; + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + abimodal.style.display = 'none'; + }, 150); }else{ $.ajax({ url: '../abi/addabi.php', method: 'POST', - data: { uniqid: uniqid2, abitext: abitext}, + data: { uniqid: uniqid2, abitext: abitext, username: usernames }, dataType: 'json', success: function (response) { console.log(response); // レスポンス内容をコンソールに表示 if (response.success) { abimodal.style.display = 'none'; postAbiElement.remove(); - + console.log(response); } else { - + abimodal.style.display = 'none'; + postAbiElement.remove(); } }, error: function (xhr, status, error) { - + console.log(error); + abimodal.style.display = 'none'; + postAbiElement.remove(); } }); } diff --git a/server/uwuzuinfo.txt b/server/uwuzuinfo.txt index 1b5ec7d..8389c48 100644 --- a/server/uwuzuinfo.txt +++ b/server/uwuzuinfo.txt @@ -1,4 +1,4 @@ uwuzu -1.2.13 -2023/08/29 +1.2.14 +2023/09/03 daichimarukana,putonfps \ No newline at end of file diff --git a/server/uwuzurelease.txt b/server/uwuzurelease.txt index 3701a4c..980dd42 100644 --- a/server/uwuzurelease.txt +++ b/server/uwuzurelease.txt @@ -1,6 +1,16 @@ ## リリースノートだぜぇぇぇぇぇぇい!!!!!!! ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...) +## Version 1.2.14 +リリース日:2023/09/03 +お知らせ表示部で編集者が正しく反映されない問題を修正しました。 +FTLで投稿の順番がおかしくなるバグを修正しました。 +ちょっとうれしくてもしかしたらちょっとうざいかもしれない機能を実装しました() +画像をクリックすることで画像が新しいタブで開かれるようにしました。 +ホーム画面のURLに「?text=投稿欄に入れたい文字列」とすることによりリンクより共有などをできるようにしました! +フォロー通知を送信するようにしました! +セキュリティを強化しました! + ## Version 1.2.13 リリース日:2023/08/29 致命的なバグを修正しました。 diff --git a/settings/addauthcode.php b/settings/addauthcode.php index 45b5568..80273a7 100644 --- a/settings/addauthcode.php +++ b/settings/addauthcode.php @@ -21,7 +21,9 @@ $servernamefile = "../server/servername.txt"; $onlyuserfile = "../server/onlyuser.txt"; $onlyuser = file_get_contents($onlyuserfile); +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); // 変数の初期化 $current_date = null; @@ -69,10 +71,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -96,10 +114,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; diff --git a/settings/index.php b/settings/index.php index 18b084f..e508f8f 100644 --- a/settings/index.php +++ b/settings/index.php @@ -23,7 +23,9 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); $userid = htmlentities($_SESSION['userid']); $username = htmlentities($_SESSION['username']); @@ -59,10 +61,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -86,10 +104,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; diff --git a/settings/success.php b/settings/success.php index 0e8696f..ad26bb8 100644 --- a/settings/success.php +++ b/settings/success.php @@ -8,7 +8,9 @@ require('../db.php'); $onlyuserfile = "../server/onlyuser.txt"; $onlyuser = file_get_contents($onlyuserfile); +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); // 変数の初期化 $current_date = null; @@ -56,10 +58,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -83,10 +101,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; diff --git a/ueuse/index.php b/ueuse/index.php index 0e09a3c..aafd1d8 100644 --- a/ueuse/index.php +++ b/ueuse/index.php @@ -26,7 +26,9 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); $userid = htmlentities($_SESSION['userid']); $username = htmlentities($_SESSION['username']); @@ -62,10 +64,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -89,10 +107,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -317,7 +351,7 @@ if( !empty($_POST['btn_submit']) ) { $pdo->beginTransaction(); $msg = ''.$ueuse.''; - $title = ''.$userid.'さんが返信しました!'; + $title = ''.$username.'さんが返信しました!'; $url = $_SERVER['REQUEST_URI']; $userchk = 'none'; // 通知用SQL作成 @@ -669,45 +703,56 @@ $(document).ready(function() { $(document).on('click', '.addabi', function (event) { - abimodal.style.display = 'block'; + abimodal.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); - var uniqid2 = $(this).attr('data-uniqid2'); - var postAbiElement = $(this).closest('.addabi'); + var uniqid2 = $(this).attr('data-uniqid2'); + var postAbiElement = $(this).closest('.addabi'); - AbiCancelButton.addEventListener('click', () => { + AbiCancelButton.addEventListener('click', () => { + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ abimodal.style.display = 'none'; - }); + }, 150); + }); - $('#AbiForm').off('submit').on('submit', function (event) { + $('#AbiForm').off('submit').on('submit', function (event) { - event.preventDefault(); + event.preventDefault(); - var abitext = document.getElementById("abitexts").value; + var abitext = document.getElementById("abitexts").value; + var username = ""; - if(abitext == ""){ + if(abitext == ""){ + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ abimodal.style.display = 'none'; - }else{ - $.ajax({ - url: '../abi/addabi.php', - method: 'POST', - data: { uniqid: uniqid2, abitext: abitext}, - dataType: 'json', - success: function (response) { - console.log(response); // レスポンス内容をコンソールに表示 - if (response.success) { - abimodal.style.display = 'none'; - postAbiElement.remove(); + }, 150); + }else{ + $.ajax({ + url: '../abi/addabi.php', + method: 'POST', + data: { uniqid: uniqid2, abitext: abitext, username: username}, + dataType: 'json', + success: function (response) { + console.log(response); // レスポンス内容をコンソールに表示 + if (response.success) { + abimodal.style.display = 'none'; + postAbiElement.remove(); - } else { - - } - }, - error: function (xhr, status, error) { + } else { } - }); - } - }); + }, + error: function (xhr, status, error) { + + } + }); + } + }); }); }); diff --git a/user/index.php b/user/index.php index 658c8df..3f9f695 100644 --- a/user/index.php +++ b/user/index.php @@ -24,12 +24,13 @@ $stmt = null; $res = null; $option = null; +session_name('uwuzu_s_id'); session_start(); +session_regenerate_id(true); $userid = htmlentities($_SESSION['userid']); $username = htmlentities($_SESSION['username']); - try { $option = array( @@ -61,10 +62,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -88,10 +105,26 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; $_SESSION['loginid'] = $res["loginid"]; - setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); - setcookie('username', $username, time() + 60 * 60 * 24 * 14); - setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); - setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + ]); }else{ header("Location: ../login.php"); exit; @@ -275,17 +308,51 @@ if (!empty($_POST['follow'])) { $updateQuery->bindValue(':follow', $userData["userid"], PDO::PARAM_STR); $updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR); $res_follow = $updateQuery->execute(); + + $datetime = date("Y-m-d H:i:s"); + $pdo->beginTransaction(); - if ($res && $res_follow) { + try { + $touserid = $userData["userid"]; + $datetime = date("Y-m-d H:i:s"); + $msg = "".$userid."さんにフォローされました。"; + $title = "🎉".$userid."さんにフォローされました!🎉"; + $url = "/@" . $userid . ""; + $userchk = 'none'; + + // 通知用SQL作成 + $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); + + + $stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR); + $stmt->bindParam(':msg', $msg, PDO::PARAM_STR); + $stmt->bindParam(':url', $url, PDO::PARAM_STR); + $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR); + $stmt->bindParam(':title', $title, PDO::PARAM_STR); + + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + + } catch(Exception $e) { + + // エラーが発生した時はロールバック + $pdo->rollBack(); + } + + if ($res && $res_follow) { $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; header("Location:" . $url); exit; } else { $error_message[] = '更新に失敗しました。'; } + } - $stmt = null; - } } elseif (!empty($_POST['unfollow'])) { // フォロー解除ボタンが押された場合の処理 $followerList = explode(',', $userdata['follower']); @@ -592,28 +659,43 @@ $(document).ready(function() { const modal1 = document.getElementById('myModal'); const openModalButton = document.getElementById('openModalButton'); const closeButton = document.getElementById('closeModal'); + var modalMain = $('.modal-content'); openModalButton.addEventListener('click', () => { modal1.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); }); closeButton.addEventListener('click', () => { - modal1.style.display = 'none'; + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + modal1.style.display = 'none'; + }, 150); }); + var modal = document.getElementById('myDelModal'); var deleteButton = document.getElementById('deleteButton'); var cancelButton = document.getElementById('cancelButton'); // 追加 + var modalMain = $('.modal-content'); $(document).on('click', '.delbtn', function (event) { modal.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); var uniqid2 = $(this).attr('data-uniqid2'); var postElement = $(this).closest('.ueuse'); deleteButton.addEventListener('click', () => { - modal.style.display = 'none'; + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + modal.style.display = 'none'; + }, 150); $.ajax({ url: '../delete/delete.php', @@ -634,25 +716,54 @@ $(document).ready(function() { }); cancelButton.addEventListener('click', () => { // 追加 - modal.style.display = 'none'; + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + modal.style.display = 'none'; + }, 150); }); }); + var more_modal = document.getElementById('myMoreModal'); + var m_cancelButton = document.getElementById('m_c_button'); // 追加 + var modalMain = $('.modal-content'); + + $(document).on('click', '.more_btn', function (event) { + more_modal.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); + + m_cancelButton.addEventListener('click', () => { + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + more_modal.style.display = 'none'; + }, 150); + }); + }); + var abimodal = document.getElementById('myAbiModal'); var AbiAddButton = document.getElementById('AbiAddButton'); var AbiCancelButton = document.getElementById('AbiCancelButton'); + var modalMain = $('.modal-content'); $(document).on('click', '.addabi', function (event) { abimodal.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); var uniqid2 = $(this).attr('data-uniqid2'); var postAbiElement = $(this).closest('.addabi'); AbiCancelButton.addEventListener('click', () => { - abimodal.style.display = 'none'; + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + abimodal.style.display = 'none'; + }, 150); }); $('#AbiForm').off('submit').on('submit', function (event) { @@ -660,27 +771,35 @@ $(document).ready(function() { event.preventDefault(); var abitext = document.getElementById("abitexts").value; + var usernames = ''; if(abitext == ""){ - abimodal.style.display = 'none'; + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + abimodal.style.display = 'none'; + }, 150); }else{ $.ajax({ url: '../abi/addabi.php', method: 'POST', - data: { uniqid: uniqid2, abitext: abitext}, + data: { uniqid: uniqid2, abitext: abitext, username: usernames }, dataType: 'json', success: function (response) { console.log(response); // レスポンス内容をコンソールに表示 if (response.success) { abimodal.style.display = 'none'; postAbiElement.remove(); - + console.log(response); } else { - + abimodal.style.display = 'none'; + postAbiElement.remove(); } }, error: function (xhr, status, error) { - + console.log(error); + abimodal.style.display = 'none'; + postAbiElement.remove(); } }); }