1
0
mirror of https://github.com/Daichimarukana/uwuzu.git synced 2026-06-05 03:24:41 +00:00

Add files via upload

This commit is contained in:
だいちまる
2023-08-21 13:57:56 +09:00
committed by GitHub
parent 965d7b903c
commit 76cf76475c
21 changed files with 453 additions and 181 deletions
+2 -2
View File
@@ -98,7 +98,7 @@ class PHPGangsta_GoogleAuthenticator
* *
* @return string * @return string
*/ */
public function getQRCodeGoogleUrl($name, $secret, $title = null, $params = array()) public function getQRCodeUrl($name, $secret, $title = null, $params = array())
{ {
$width = !empty($params['width']) && (int) $params['width'] > 0 ? (int) $params['width'] : 200; $width = !empty($params['width']) && (int) $params['width'] > 0 ? (int) $params['width'] : 200;
$height = !empty($params['height']) && (int) $params['height'] > 0 ? (int) $params['height'] : 200; $height = !empty($params['height']) && (int) $params['height'] > 0 ? (int) $params['height'] : 200;
@@ -109,7 +109,7 @@ class PHPGangsta_GoogleAuthenticator
$urlencoded .= urlencode('&issuer='.urlencode($title)); $urlencoded .= urlencode('&issuer='.urlencode($title));
} }
return "https://api.qrserver.com/v1/create-qr-code/?data=$urlencoded&size=${width}x${height}&ecc=$level"; return "$urlencoded";
} }
/** /**
+11
View File
@@ -0,0 +1,11 @@
Copyright (c) 2012, Michael Kliewe All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1.Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2.Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
なお、このフォルダにあるコードは改変させていただいでおります。
+294
View File
@@ -2312,6 +2312,103 @@ label>input {
} }
.notification2{
animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards;
margin: 12px;
border-radius: 10px;
padding-left: 24px;
padding-right: 24px;
padding-top: 16px;
padding-bottom: 16px;
background-color: #FFFAE6;
border: 1px solid #EEE;
width: auto;
}
.notification2 .flebox{
display: flex;
}
.notification2 .flebox a{
margin-top: auto;
margin-bottom: auto;
margin-left: 12px;
font-size: 18px;
color:#252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification2 .flebox .idbox{
margin-top: auto;
margin-bottom: auto;
margin-left: 6px;
border-radius: 10px;
background-color: #FFF;
border: 1px solid #EEE;
}
.notification2 .flebox .idbox a{
margin-top: 6px;
margin-bottom: 6px;
margin-left: 8px;
margin-right: 8px;
text-align: center;
font-size: 12px;
color:#999;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
}
.notification2 p{
line-height: 20px;
overflow-wrap: break-word;
margin-top: auto;
margin-bottom: auto;
margin-left: 12px;
font-size: 16px;
color:#252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification2 h3{
overflow-wrap: break-word;
margin-top: auto;
margin-bottom: 6px;
margin-left: 12px;
font-size: 24px;
color:#252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification2 .flebox .time{
margin-top: auto;
margin-bottom: auto;
margin-left: auto;
margin-right: 12px;
text-align: right;
font-size: 12px;
color:#999;
font-family: 'BIZ UDPGothic', sans-serif;
}
.notification2 a{
overflow-wrap: break-word;
margin-top: 24px;
margin-bottom: auto;
margin-left: 12px;
font-size: 16px;
color:#4e4428;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification{ .notification{
animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards; animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards;
@@ -2373,6 +2470,7 @@ label>input {
} }
.notification p{ .notification p{
line-height: 20px;
overflow-wrap: break-word; overflow-wrap: break-word;
margin-top: auto; margin-top: auto;
margin-bottom: auto; margin-bottom: auto;
@@ -3141,6 +3239,168 @@ hr{
border: 1px solid #EEE; border: 1px solid #EEE;
} }
.notification .flebox a{
margin-top: auto;
margin-bottom: auto;
margin-left: 12px;
font-size: 18px;
color:#252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification .flebox .idbox{
margin-top: auto;
margin-bottom: auto;
margin-left: 6px;
border-radius: 10px;
background-color: #FFF;
border: 1px solid #EEE;
}
.notification .flebox .idbox a{
margin-top: 6px;
margin-bottom: 6px;
margin-left: 8px;
margin-right: 8px;
text-align: center;
font-size: 12px;
color:#999;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
}
.notification p{
line-height: 20px;
overflow-wrap: break-word;
margin-top: auto;
margin-bottom: auto;
margin-left: -6px;
font-size: 16px;
color:#252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification h3{
overflow-wrap: break-word;
margin-top: 12px;
margin-bottom: 6px;
margin-left: -6px;
font-size: 18px;
color:#252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification .flebox .time{
margin-top: auto;
margin-bottom: auto;
margin-left: auto;
margin-right: -6px;
text-align: right;
font-size: 12px;
color:#999;
font-family: 'BIZ UDPGothic', sans-serif;
}
.notification a{
overflow-wrap: break-word;
margin-top: 32px;
margin-bottom: auto;
margin-left: -6px;
font-size: 16px;
color:#4e4428;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification2 .flebox a{
margin-top: auto;
margin-bottom: auto;
margin-left: 12px;
font-size: 18px;
color:#252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification2 .flebox .idbox{
margin-top: auto;
margin-bottom: auto;
margin-left: 6px;
border-radius: 10px;
background-color: #FFF;
border: 1px solid #EEE;
}
.notification2 .flebox .idbox a{
margin-top: 6px;
margin-bottom: 6px;
margin-left: 8px;
margin-right: 8px;
text-align: center;
font-size: 12px;
color:#999;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
}
.notification2 p{
line-height: 20px;
overflow-wrap: break-word;
margin-top: auto;
margin-bottom: auto;
margin-left: -6px;
font-size: 16px;
color:#252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification2 h3{
overflow-wrap: break-word;
margin-top: 12px;
margin-bottom: 6px;
margin-left: -6px;
font-size: 18px;
color:#252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.notification2 .flebox .time{
margin-top: auto;
margin-bottom: auto;
margin-left: auto;
margin-right: -6px;
text-align: right;
font-size: 12px;
color:#999;
font-family: 'BIZ UDPGothic', sans-serif;
}
.notification2 a{
overflow-wrap: break-word;
margin-top: 32px;
margin-bottom: auto;
margin-left: -6px;
font-size: 16px;
color:#4e4428;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
} }
/*------------------------------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------------------------------*/
@@ -3506,6 +3766,12 @@ hr{
color: #FFFAE6; color: #FFFAE6;
} }
.btmbutton_on{
background-color: #FFC832;
color:#FF4444;
}
.terms{ .terms{
background-color: #0c0c0c; background-color: #0c0c0c;
@@ -3559,6 +3825,34 @@ hr{
color: #FFF; color: #FFF;
} }
.notification2{
background-color: #3a3333;
border: none;
}
.notification2 .flebox a{
color:#CCC5;
}
.notification2 p{
color:#FFF;
}
.notification2 h3{
color:#CCC;
}
.notification2 .flebox .time{
color:#CCC;
}
.notification2 a{
color:#FFC832;
}
.notification{ .notification{
background-color: #181616; background-color: #181616;
border: none; border: none;
+1 -17
View File
@@ -259,23 +259,7 @@ if( !empty($_POST['btn_submit']) ) {
} }
if( !empty($_POST['logout']) ) { require('../logout/logout.php');
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
// リダイレクト先のURLへ転送する
$url = '../index.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
+1 -19
View File
@@ -125,25 +125,7 @@ if (!empty($pdo)) {
} }
} }
if( !empty($_POST['logout']) ) { require('../logout/logout.php');
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
// リダイレクト先のURLへ転送する
$url = '../index.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
// データベースの接続を閉じる // データベースの接続を閉じる
+1 -18
View File
@@ -300,24 +300,7 @@ if( !empty($_POST['btn_submit']) ) {
if( !empty($_POST['logout']) ) { require('../logout/logout.php');
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
// リダイレクト先のURLへ転送する
$url = '../index.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
+60
View File
@@ -0,0 +1,60 @@
<?php
$servernamefile = "../server/servername.txt";
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '');
setcookie($name, '', time()-1000, '/');
setcookie($name, '', time()-1000, '/emoji');
setcookie($name, '', time()-1000, '/home');
setcookie($name, '', time()-1000, '/notice');
setcookie($name, '', time()-1000, '/notification');
setcookie($name, '', time()-1000, '/others');
setcookie($name, '', time()-1000, '/search');
setcookie($name, '', time()-1000, '/settings');
setcookie($name, '', time()-1000, '/emoji');
setcookie($name, '', time()-1000, '/user');
}
}
session_destroy();
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/style.css">
<link rel="apple-touch-icon" type="image/png" href="../favicon/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="../favicon/icon-192x192.png">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>ログアウト完了 - <?php echo file_get_contents($servernamefile);?></title>
</head>
<script src="../js/back.js"></script>
<body>
<div class="leftbox2">
<div class="logo">
<img src="../img/uwuzulogo.svg">
</div>
<div class="textbox">
<h1>ログアウト完了</h1>
<p><br>ログアウトが完了しました!</p>
<p>ボタンを押すとログインページにリダイレクトします。</p>
<div class="btnbox">
<a href="../login.php" class="sirobutton">ログイン</a>
</div>
</div>
</div>
</body>
</html>
+10
View File
@@ -0,0 +1,10 @@
<?php
if( !empty($_POST['logout']) ) {
// リダイレクト先のURLへ転送する
$url = '../logout/index.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
?>
+5 -6
View File
@@ -41,6 +41,11 @@ if (!empty($pdo)) {
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
)); ));
$messageQuery = $dbh->prepare("SELECT title,msg,url,datetime,userchk FROM notification WHERE touserid = :userid ORDER BY datetime DESC LIMIT $offset, $itemsPerPage");
$messageQuery->bindValue(':userid', $userid);
$messageQuery->execute();
$message_array = $messageQuery->fetchAll();
// トランザクション開始 // トランザクション開始
$pdo->beginTransaction(); $pdo->beginTransaction();
@@ -52,12 +57,6 @@ if (!empty($pdo)) {
$res = $stmt->execute(); $res = $stmt->execute();
$res = $pdo->commit(); $res = $pdo->commit();
$messageQuery = $dbh->prepare("SELECT title,msg,url,datetime,userchk FROM notification WHERE touserid = :userid ORDER BY datetime DESC LIMIT $offset, $itemsPerPage");
$messageQuery->bindValue(':userid', $userid);
$messageQuery->execute();
$message_array = $messageQuery->fetchAll();
if (!empty($message_array)) { if (!empty($message_array)) {
foreach ($message_array as $value) { foreach ($message_array as $value) {
$messageDisplay = new MessageDisplay($value); // userid を渡さない $messageDisplay = new MessageDisplay($value); // userid を渡さない
+6 -2
View File
@@ -7,7 +7,11 @@ class MessageDisplay {
} }
public function display() { public function display() {
echo '<div class="notification">'; if($this->value['userchk'] === "none"){
echo '<div class="notification2">';
}else{
echo '<div class="notification">';
}
echo ' <div class="flebox">'; echo ' <div class="flebox">';
echo ' <div class="time">'; echo ' <div class="time">';
@@ -24,7 +28,7 @@ class MessageDisplay {
// 投稿内のHTMLコードを表示する部分 // 投稿内のHTMLコードを表示する部分
echo ' <h3>' . htmlentities($this->value['title']) . '</h3>'; echo ' <h3>' . htmlentities($this->value['title']) . '</h3>';
echo ' <p>' . htmlentities($this->value['msg']) . '</p>'; echo ' <p>' . htmlentities($this->value['msg']) . '</p>';
echo ' <a href="' . htmlentities($this->value['url']) . '">続きをみる</a>'; echo ' <a href="' . htmlentities($this->value['url']) . '">詳細をみる</a>';
echo '</div>'; echo '</div>';
} }
+1 -18
View File
@@ -219,24 +219,7 @@ if( !empty($_POST['btn_submit']) ) {
} }
if( !empty($_POST['logout']) ) { require('../logout/logout.php');
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
// リダイレクト先のURLへ転送する
$url = '../index.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
// データベースの接続を閉じる // データベースの接続を閉じる
+1 -19
View File
@@ -118,25 +118,7 @@ $notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count']; $notificationcount = $notiData['notification_count'];
if( !empty($_POST['logout']) ) { require('../logout/logout.php');
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
// リダイレクト先のURLへ転送する
$url = '../index.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
// データベースの接続を閉じる // データベースの接続を閉じる
$pdo = null; $pdo = null;
+6 -17
View File
@@ -187,6 +187,11 @@ if( !empty($_POST['btn_submit']) ) {
$deleteQuery->bindValue(':userid', $userid, PDO::PARAM_STR); $deleteQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
$res = $deleteQuery->execute(); $res = $deleteQuery->execute();
// 通知削除クエリを実行
$deleteQuery = $pdo->prepare("DELETE FROM notification WHERE touserid = :touserid");
$deleteQuery->bindValue(':touserid', $userid, PDO::PARAM_STR);
$res = $deleteQuery->execute();
// フォローの更新 // フォローの更新
$updateFollowQuery = $pdo->prepare("UPDATE account SET follow = REPLACE(follow, :userid, '') WHERE follow LIKE :pattern"); $updateFollowQuery = $pdo->prepare("UPDATE account SET follow = REPLACE(follow, :userid, '') WHERE follow LIKE :pattern");
$updateFollowQuery->bindValue(':userid', ",$userid", PDO::PARAM_STR); $updateFollowQuery->bindValue(':userid', ",$userid", PDO::PARAM_STR);
@@ -284,23 +289,7 @@ if( !empty($_POST['session_submit']) ) {
} }
if( !empty($_POST['logout']) ) { require('../logout/logout.php');
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
// リダイレクト先のURLへ転送する
$url = '../index.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
?> ?>
+1 -17
View File
@@ -116,23 +116,7 @@ $notificationcount = $notiData['notification_count'];
//------------------------------------------- //-------------------------------------------
if( !empty($_POST['logout']) ) { require('../logout/logout.php');
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
// リダイレクト先のURLへ転送する
$url = '../index.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
+6 -2
View File
@@ -10,6 +10,8 @@ uwuzuの読みはゆずです。
## 2. 誰でもサーバーを建てれるってことは、分散型? ## 2. 誰でもサーバーを建てれるってことは、分散型?
残念っ! 残念っ!
uwuzuにはActivityPubやその他の連合用機能がないため基本的に導入されたサーバー中心の中央集権型SNSです! uwuzuにはActivityPubやその他の連合用機能がないため基本的に導入されたサーバー中心の中央集権型SNSです!
いやでも中央集権型でも誰でもサーバーを立てれるから分散型...?
分散中央型SNSな気がしてきました!(?)
今後いつかはActivityPubも導入しようかと思っています... 今後いつかはActivityPubも導入しようかと思っています...
## 3. 名前の由来って何? ## 3. 名前の由来って何?
@@ -26,7 +28,7 @@ uwuzuはPHPとJS、HTML(プログラミング言語じゃないか)、CSSで作
ライブラリはjQueryを導入しています! ライブラリはjQueryを導入しています!
## 5. サーバーの建て方 ## 5. サーバーの建て方
※MySQLの設定結構めんどいです。脆弱です。 ※MySQLの設定結構めんどいです。
まず、Apache2とPHP 8とmysql Ver 15が導入されているサーバーを準備します! まず、Apache2とPHP 8とmysql Ver 15が導入されているサーバーを準備します!
次にSQLを設定します。(InnoDB) 次にSQLを設定します。(InnoDB)
まず、お好きな名前でDBを作成し、その中に、account,emoji,notice,role,ueuse,notificationとテーブルを作成します。 まず、お好きな名前でDBを作成し、その中に、account,emoji,notice,role,ueuse,notificationとテーブルを作成します。
@@ -53,6 +55,8 @@ uwuzuはPHPとJS、HTML(プログラミング言語じゃないか)、CSSで作
- follow(text) アカウントがフォローしている人保存用 - follow(text) アカウントがフォローしている人保存用
- follower(text) アカウントがフォローされている人保存用 - follower(text) アカウントがフォローされている人保存用
- admin(varchar(25)) 管理者アカウントなら「yes」、それ以外なら「none」と入力。 - admin(varchar(25)) 管理者アカウントなら「yes」、それ以外なら「none」と入力。
- authcode(varchar(256)) 二段階認証用キー保存用
- backupcode(varchar(256)) 二段階認証のバックアップコード保存用
### emoji ### emoji
- sysid(INT)(AUTO_INCREMENT) アカウントが追加されるとカウントされるシステム用ID - sysid(INT)(AUTO_INCREMENT) アカウントが追加されるとカウントされるシステム用ID
@@ -122,7 +126,7 @@ uwuzuはPHPとJS、HTML(プログラミング言語じゃないか)、CSSで作
- onlyuser.txt : 招待コード機能をオンにするかどうか、「true」でオン、「false」でオフ。招待コードはDBに直接追加。 - onlyuser.txt : 招待コード機能をオンにするかどうか、「true」でオン、「false」でオフ。招待コードはDBに直接追加。
### これでサーバーは完成!!! ### これでサーバーは完成!!!
結構脆弱だから気をつけてね... もう一度サーバーを起動してみんなに公開しよう!!!
## 6. Android、iOS、その他OS向けのアプリについて ## 6. Android、iOS、その他OS向けのアプリについて
残念ですが今現在は公式アプリ等はなく、Webブラウザからお楽しみいただけます。 残念ですが今現在は公式アプリ等はなく、Webブラウザからお楽しみいただけます。
+2 -2
View File
@@ -1,4 +1,4 @@
uwuzu uwuzu
1.2.6 1.2.8
2023/08/19 2023/08/21
daichimarukana,putonfps daichimarukana,putonfps
+20
View File
@@ -1,6 +1,26 @@
## リリースノートだぜぇぇぇぇぇぇい!!!!!!! ## リリースノートだぜぇぇぇぇぇぇい!!!!!!!
ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...) ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...)
## Version 1.2.8
リリース日:2023/08/21
ログイン時にリダイレクトを繰り返してしまうバグを修正しました。
ログアウトできないバグを修正しました。
## Version 1.2.7
リリース日:2023/08/21
通知画面のスマホ向けUIを改善しました。
Y.Swetake様よりファイルをお借りすることによりQRコードをサーバー上で生成できるようにしました。
それにより高速なQRコードの生成が可能となりました。
また、Michael Kliewe様の二段階認証実装用ライブラリのコードを一部改変させていただきました。
二段階認証のバックアップコードを生成する機能を作成しました。
ログイン通知を送信するようにしました。
未読の通知をわかりやすくしました。
アカウント削除時に通知が削除されるようにしました。
## Version 1.2.6.1
リリース日:2023/08/19
CSSの変更忘れです。
## Version 1.2.6 ## Version 1.2.6
リリース日:2023/08/19 リリース日:2023/08/19
ログイン時の二段階認証入力画面を数字のみに限定しました。 ログイン時の二段階認証入力画面を数字のみに限定しました。
+12 -5
View File
@@ -8,6 +8,11 @@ function createUniqId(){
return base_convert($hashCreateTime,10,36); return base_convert($hashCreateTime,10,36);
} }
function random($length = 32)
{
return substr(str_shuffle('1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $length);
}
require('../db.php'); require('../db.php');
@@ -142,6 +147,7 @@ if( !empty($_POST['btn_submit']) ) {
$checkResult = $chkauthcode->verifyCode($secret, $userauthcode, $discrepancy); $checkResult = $chkauthcode->verifyCode($secret, $userauthcode, $discrepancy);
if ($checkResult) { if ($checkResult) {
if( empty($error_message) ) { if( empty($error_message) ) {
$backupcode = random();
$secret = $_SESSION['secretcode']; $secret = $_SESSION['secretcode'];
// トランザクション開始 // トランザクション開始
$pdo->beginTransaction(); $pdo->beginTransaction();
@@ -149,10 +155,10 @@ if( !empty($_POST['btn_submit']) ) {
try { try {
// SQL作成 // SQL作成
$stmt = $pdo->prepare("UPDATE account SET authcode = :authcode WHERE userid = :userid"); $stmt = $pdo->prepare("UPDATE account SET authcode = :authcode,backupcode = :backupcode WHERE userid = :userid");
$stmt->bindValue(':authcode', $secret, PDO::PARAM_STR); $stmt->bindValue(':authcode', $secret, PDO::PARAM_STR);
$stmt->bindValue(':backupcode', $backupcode, PDO::PARAM_STR);
// ユーザーIDのバインド(WHERE句に必要) // ユーザーIDのバインド(WHERE句に必要)
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR); $stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
@@ -171,6 +177,7 @@ if( !empty($_POST['btn_submit']) ) {
if ($res) { if ($res) {
// リダイレクト先のURLへ転送する // リダイレクト先のURLへ転送する
$_SESSION['backupcode'] = $backupcode;
$url = 'success.php'; $url = 'success.php';
header('Location: ' . $url, true, 303); header('Location: ' . $url, true, 303);
exit; exit;
@@ -186,7 +193,7 @@ if( !empty($_POST['btn_submit']) ) {
} }
} }
require('../logout/logout.php');
// データベースの接続を閉じる // データベースの接続を閉じる
$pdo = null; $pdo = null;
@@ -232,14 +239,14 @@ $pdo = null;
$name = $userid; $name = $userid;
$qrCodeUrl = $authcode->getQRCodeGoogleUrl($name, $secret, $title); $qrCodeUrl = $authcode->getQRCodeUrl($name, $secret, $title);
?> ?>
<form class="formarea" enctype="multipart/form-data" method="post"> <form class="formarea" enctype="multipart/form-data" method="post">
<p>以下の二次元コードより二段階認証をセットアップしてください。</p> <p>以下の二次元コードより二段階認証をセットアップしてください。</p>
<p>セットアップが完了したら入力ボックスにコードを入力して「次へ」ボタンを押してください!<br>注意:まだ二段階認証の設定は終わっていません。次へを押すと設定が完了します。</p> <p>セットアップが完了したら入力ボックスにコードを入力して「次へ」ボタンを押してください!<br>注意:まだ二段階認証の設定は終わっていません。次へを押すと設定が完了します。</p>
<div class="authzone"> <div class="authzone">
<img src="<?php echo $qrCodeUrl;?>"> <img src="../qr/php/qr_img.php?d=<?php echo $qrCodeUrl?>">
</div> </div>
<div> <div>
<p>二段階認証コード</p> <p>二段階認証コード</p>
+5 -18
View File
@@ -568,23 +568,7 @@ if( !empty($_POST['img2btn_submit']) ) {
} }
} }
if( !empty($_POST['logout']) ) { require('../logout/logout.php');
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
// リダイレクト先のURLへ転送する
$url = '../index.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
if( !empty($_POST['auth_on_submit']) ) { if( !empty($_POST['auth_on_submit']) ) {
$_SESSION['userid'] = $userid; $_SESSION['userid'] = $userid;
@@ -599,15 +583,17 @@ if( !empty($_POST['auth_on_submit']) ) {
if( !empty($_POST['auth_off_submit']) ) { if( !empty($_POST['auth_off_submit']) ) {
if( empty($error_message) ) { if( empty($error_message) ) {
$secret = ""; $secret = "";
$backupcode = "";
// トランザクション開始 // トランザクション開始
$pdo->beginTransaction(); $pdo->beginTransaction();
try { try {
// SQL作成 // SQL作成
$stmt = $pdo->prepare("UPDATE account SET authcode = :authcode WHERE userid = :userid"); $stmt = $pdo->prepare("UPDATE account SET authcode = :authcode,backupcode = :backupcode WHERE userid = :userid");
$stmt->bindValue(':authcode', $secret, PDO::PARAM_STR); $stmt->bindValue(':authcode', $secret, PDO::PARAM_STR);
$stmt->bindValue(':backupcode', $backupcode, PDO::PARAM_STR);
// ユーザーIDのバインド(WHERE句に必要) // ユーザーIDのバインド(WHERE句に必要)
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR); $stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
@@ -716,6 +702,7 @@ $pdo = null;
<?php <?php
if(empty($userdata['authcode'])){ if(empty($userdata['authcode'])){
?> ?>
<p>一時的に有効なキーを生成する二段階認証を設定することにより本人以外がログインしにくくなります。</p>
<input type="submit" class = "irobutton" name="auth_on_submit" value="二段階認証の設定"> <input type="submit" class = "irobutton" name="auth_on_submit" value="二段階認証の設定">
<?php }else{ ?> <?php }else{ ?>
<p>下のボタンを押すとすぐに解除されます。確認などはありません。気をつけてください。</p> <p>下のボタンを押すとすぐに解除されます。確認などはありません。気をつけてください。</p>
+7 -2
View File
@@ -22,7 +22,7 @@ $option = null;
$userid = $_SESSION['userid']; $userid = $_SESSION['userid'];
$backupcode = $_SESSION['backupcode'];
try { try {
@@ -112,6 +112,8 @@ $notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC); $notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count']; $notificationcount = $notiData['notification_count'];
require('../logout/logout.php');
?> ?>
@@ -148,8 +150,11 @@ $notificationcount = $notiData['notification_count'];
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php endif; ?> <?php endif; ?>
<div class="formarea">
<p>登録完了!セキュリティの強化にご協力いただきありがとうございます!<br>(≧∇≦)</p> <p>登録完了!セキュリティの強化にご協力いただきありがとうございます!<br>(≧∇≦)</p>
<p>バックアップコードは以下のものです!<br>以下のコードでスマートフォンをなくしてしまったなどのもしものときにログインいただけます。<br>絶対に大切に保管してください!<br>また、そのバックアップコードは絶対に公開しないでください。</p>
<p><?php echo $backupcode;?>
</div>
<a href="index" class="irobutton">戻る</a> <a href="index" class="irobutton">戻る</a>
</div> </div>
+1 -17
View File
@@ -291,23 +291,7 @@ if (!empty($_POST['follow'])) {
if( !empty($_POST['logout']) ) { require('../logout/logout.php');
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
// リダイレクト先のURLへ転送する
$url = '../index.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}