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

uwuzu version 1.2.6.1

This commit is contained in:
だいちまる
2023-08-19 21:36:13 +09:00
committed by GitHub
parent 1442ff648a
commit ea8587e10f
22 changed files with 292 additions and 15 deletions
+6 -1
View File
@@ -32,7 +32,6 @@ $option = null;
$userid = $_SESSION['userid'];
// データベースに接続
try {
$option = array(
@@ -46,6 +45,12 @@ try {
// 接続エラーのときエラー内容を取得する
$error_message[] = $e->getMessage();
}
// 管理者としてログインしているか確認
if( empty($_SESSION['admin_login']) || $_SESSION['admin_login'] !== true ) {
// ログインページへリダイレクト
header("Location: ./login.php");
exit;
}
require_once 'authcode/GoogleAuthenticator.php';
+62 -4
View File
@@ -30,15 +30,73 @@ $_SESSION["password"]="";
session_start();
$userid = $_SESSION['userid'];
try {
$options = array(
$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, $options);
$pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
} catch(PDOException $e) {
// 接続エラーのときエラー内容を取得する
$error_message[] = 'データベース接続エラー: ' . $e->getMessage();
$error_message[] = $e->getMessage();
}
if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
$passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid");
$passQuery->bindValue(':userid', $_SESSION['userid']);
$passQuery->execute();
$res = $passQuery->fetch();
if(empty($res["userid"])){
header("Location: login.php");
exit;
}elseif($_SESSION['loginid'] === $res["loginid"]){
// セッションに値をセット
$userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット
$username = $_SESSION['username']; // セッションに格納されている値をそのままセット
$_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);
header("Location: home/");
exit;
}
} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) {
$passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid");
$passQuery->bindValue(':userid', $_COOKIE['userid']);
$passQuery->execute();
$res = $passQuery->fetch();
if(empty($res["userid"])){
header("Location: login.php");
exit;
}elseif($_COOKIE['loginid'] === $res["loginid"]){
// セッションに値をセット
$userid = $_COOKIE['userid']; // クッキーから取得した値をセット
$username = $_COOKIE['username']; // クッキーから取得した値をセット
$_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);
header("Location: home/");
exit;
}
}
@@ -144,7 +202,7 @@ $pdo = null;
<div>
<p>二段階認証コード</p>
<div class="p2">6桁のコードを入力してください。</div>
<input id="profile" type="text" placeholder="123456" class="inbox" name="usercode" value="">
<input id="profile" type="number" placeholder="123456" class="inbox" name="usercode" value="">
</div>
<input type="submit" class = "irobutton" name="btn_submit" value="次へ">
</form>
+64 -1
View File
@@ -349,9 +349,10 @@ body{
}
.leftbutton{
cursor: pointer;
border: none;
display: block;
display: flex;
width:70%;
margin: 16px;
padding: 8px auto;
@@ -387,6 +388,39 @@ body{
width:65%;
}
.leftbutton .notipod{
width: 25px;
height: 25px;
margin-left: auto;
margin-right: 20px;
margin-top: auto;
margin-bottom: auto;
background-color: #FF4444;
border-radius: 50%;
transition: all 250ms ease-out;
}
.leftbutton .notipod p{
margin-top: -1px;
margin-bottom: 0px;
margin-left: auto;
margin-right: auto;
color:#FFFFFF;
font-size: 16px;
font-family: 'Zen Maru Gothic', sans-serif;
font-weight: normal;
text-decoration:none;
text-align: center;
transition: all 250ms ease-out;
}
.leftbutton:hover .notipod {
background-color:#FFFFFF;
}
.leftbutton:hover .notipod p{
color:#FF4444;
}
main{
height: 95dvh;
overflow: auto;
@@ -2617,6 +2651,35 @@ hr{
width:27%;
}
.btmbutton_on{
cursor: pointer;
border: none;
display: block;
width:28%;
margin: 16px;
padding: 8px auto;
height: auto;
margin-left: 12px;
margin-right: 12px;
padding-top: 14px;
padding-bottom: 14px;
background-color: #FFFFFF;
border-radius: 50px;
color:#FF4444;
font-size: 16px;
font-family: 'Zen Maru Gothic', sans-serif;
font-weight: normal;
text-decoration:none;
text-align: center;
transition: box-shadow 250ms ease-in-out;
transition: width 250ms ease-out;
transition: all 250ms ease-out;
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05);
border: 1px solid #FFC832;
}
.ueuse .favbox .tuduki{
display: block;
+6
View File
@@ -114,6 +114,12 @@ if(!($res["admin"] === "yes")){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
if( !empty($pdo) ) {
+5
View File
@@ -108,7 +108,12 @@ if(empty($username)){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
if (!empty($pdo)) {
$sql = "SELECT emojiname,emojiinfo,emojidate FROM emoji ORDER BY emojidate DESC";
+7
View File
@@ -108,6 +108,13 @@ if(empty($username)){
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
//-------------------------------------------
if( !empty($_POST['btn_submit']) ) {
+3 -3
View File
@@ -40,7 +40,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
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);
header("Location: home/index.php");
header("Location: home/");
exit;
}
@@ -52,7 +52,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
$passQuery->execute();
$res = $passQuery->fetch();
if(empty($res["userid"])){
header("Location: ../login.php");
header("Location: login.php");
exit;
}elseif($_COOKIE['loginid'] === $res["loginid"]){
// セッションに値をセット
@@ -66,7 +66,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
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);
header("Location: home/index.php");
header("Location: home/");
exit;
}
+55 -1
View File
@@ -28,7 +28,7 @@ $_SESSION["password"]="";
session_start();
// データベースに接続
try {
$option = array(
@@ -43,6 +43,60 @@ try {
$error_message[] = $e->getMessage();
}
if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
$passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid");
$passQuery->bindValue(':userid', $_SESSION['userid']);
$passQuery->execute();
$res = $passQuery->fetch();
if(empty($res["userid"])){
header("Location: login.php");
exit;
}elseif($_SESSION['loginid'] === $res["loginid"]){
// セッションに値をセット
$userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット
$username = $_SESSION['username']; // セッションに格納されている値をそのままセット
$_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);
header("Location: home/");
exit;
}
} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) {
$passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid");
$passQuery->bindValue(':userid', $_COOKIE['userid']);
$passQuery->execute();
$res = $passQuery->fetch();
if(empty($res["userid"])){
header("Location: login.php");
exit;
}elseif($_COOKIE['loginid'] === $res["loginid"]){
// セッションに値をセット
$userid = $_COOKIE['userid']; // クッキーから取得した値をセット
$username = $_COOKIE['username']; // クッキーから取得した値をセット
$_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);
header("Location: home/");
exit;
}
}
if( !empty($_POST['btn_submit']) ) {
+12
View File
@@ -41,6 +41,18 @@ if (!empty($pdo)) {
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
));
// トランザクション開始
$pdo->beginTransaction();
// SQL作成
$stmt = $pdo->prepare("UPDATE notification SET userchk = 'done' WHERE touserid = :userid;");
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
$res = $stmt->execute();
$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();
+6
View File
@@ -114,6 +114,12 @@ if(!($res["admin"] === "yes")){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
if( !empty($pdo) ) {
+9 -2
View File
@@ -111,6 +111,12 @@ if(empty($username)){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
if( !empty($_POST['logout']) ) {
if (isset($_SERVER['HTTP_COOKIE'])) {
@@ -139,11 +145,12 @@ $pdo = null;
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<link rel="stylesheet" href="../css/home.css">
<meta name="viewport" content="width=device-width,initial-scale=1">
<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 charset="utf-8">
<link rel="stylesheet" href="../css/home.css">
<title>通知 - <?php echo file_get_contents($servernamefile);?></title>
</head>
+6
View File
@@ -117,6 +117,12 @@ if(empty($username)){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
if( !empty($pdo) ) {
+5 -1
View File
@@ -2,8 +2,12 @@
<div class="botbox">
<div class="lbtnzone">
<a href="/home" class="btmbutton">ホーム</a>
<?php if($notificationcount > 0){?>
<a href="/notification" class="btmbutton_on">通知</a>
<?php }else{?>
<a href="/notification" class="btmbutton">通知</a>
<?php }?>
<a href="/search" class="btmbutton">検索</a>
<a href="/@<?php echo $userid; ?>" class="btmbutton">自情報</a>
<a href="/settings" class="btmbutton">設定</a>
</div>
</div>
+5 -1
View File
@@ -7,7 +7,11 @@
<div class="lbtnzone">
<a href="/home" class="leftbutton">🏠ホーム</a>
<a href="/search" class="leftbutton">検索</a>
<a href="/notification" class="leftbutton">通知</a>
<?php if($notificationcount > 0){?>
<a href="/notification" class="leftbutton">通知<div class="notipod"><p><?php echo $notificationcount?></p></div></a>
<?php }else{?>
<a href="/notification" class="leftbutton">通知</a>
<?php }?>
<a href="/emoji" class="leftbutton">絵文字</a>
<a href="/@<?php echo $userid; ?>" class="leftbutton">プロフィール</a>
<a href="/settings" class="leftbutton">設定</a>
+6
View File
@@ -107,6 +107,12 @@ if(empty($username)){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
//-------------------------------------------
+1 -1
View File
@@ -1,4 +1,4 @@
uwuzu
1.2.5
1.2.6
2023/08/19
daichimarukana,putonfps
+5
View File
@@ -1,6 +1,11 @@
## リリースノートだぜぇぇぇぇぇぇい!!!!!!!
ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...)
## Version 1.2.6
リリース日:2023/08/19
ログイン時の二段階認証入力画面を数字のみに限定しました。
通知機能を強化し、わかりやすくしました!
## Version 1.2.5
リリース日:2023/08/19
全てのデバイスでセッションを終了する機能を実装しました!
+6
View File
@@ -114,6 +114,12 @@ if(empty($username)){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
require_once '../authcode/GoogleAuthenticator.php';
+6
View File
@@ -109,6 +109,12 @@ if(empty($username)){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
if( !empty($pdo) ) {
+6
View File
@@ -106,6 +106,12 @@ if(empty($username)){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
?>
+6
View File
@@ -112,6 +112,12 @@ if(empty($username)){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
$ueuseid = htmlentities(str_replace('!', '', $_GET['ueuseid']));
$touserid = htmlentities(str_replace('~', '', $_GET['touser']));
+5
View File
@@ -111,7 +111,12 @@ if(empty($username)){
header("Location: ../login.php");
exit;
}
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
$notiQuery->bindValue(':userid', $userid);
$notiQuery->execute();
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
function customStripTags($html, $allowedTags) {
$allowedTagsString = '<' . implode('><', $allowedTags) . '>';