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

uwuzu version 1.2.10

This commit is contained in:
daichimarukana
2023-08-23 20:15:05 +09:00
parent a0640ebf9a
commit 49a89b55f6
12 changed files with 670 additions and 33 deletions
+127
View File
@@ -0,0 +1,127 @@
<?php
header("Content-Type: application/json; charset=utf-8");
function createUniqId(){
list($msec, $sec) = explode(" ", microtime());
$hashCreateTime = $sec.floor($msec*1000000);
$hashCreateTime = strrev($hashCreateTime);
return base_convert($hashCreateTime,10,36);
}
if(isset($_GET['token'])&&isset($_GET['ueuse'])) {
$token = htmlentities($_GET['token']);
$ueuse = htmlentities($_GET['ueuse']);
require('../db.php');
$datetime = array();
$pdo = null;
session_start();
try {
$option = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
);
$pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
} catch(PDOException $e) {
// 接続エラーのときエラー内容を取得する
$error_message[] = $e->getMessage();
}
if( !empty($pdo) ) {
// データベース接続の設定
$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,
));
$userQuery = $dbh->prepare("SELECT username, userid FROM account WHERE token = :token");
$userQuery->bindValue(':token', $token);
$userQuery->execute();
$userData = $userQuery->fetch();
if(empty($userData["userid"])){
$err = "token_invalid";
$response = array(
'error_code' => $err,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
}else{
// 書き込み日時を取得
$username = $userData["username"];
$userid = $userData["userid"];
$datetime = date("Y-m-d H:i:s");
$uniqid = createUniqId();
$abi = "none";
// トランザクション開始
$pdo->beginTransaction();
try {
// SQL作成
$stmt = $pdo->prepare("INSERT INTO ueuse (username, account, uniqid, ueuse, datetime, abi) VALUES (:username, :account, :uniqid, :ueuse, :datetime, :abi)");
$stmt->bindParam(':username', $username, PDO::PARAM_STR);
$stmt->bindParam(':account', $userid, PDO::PARAM_STR);
$stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR);
$stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR);
$stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR);
$stmt->bindParam(':abi', $abi, PDO::PARAM_STR);
// SQLクエリの実行
$res = $stmt->execute();
// コミット
$res = $pdo->commit();
} catch(Exception $e) {
// エラーが発生した時はロールバック
$pdo->rollBack();
}
if( $res ) {
$response = array(
'uniqid' => $uniqid,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
} else {
$err = "db_error_".$e->getMessage();
$response = array(
'error_code' => $err,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
}
// プリペアドステートメントを削除
$stmt = null;
}
}
}else{
$err = "input_not_found";
$response = array(
'error_code' => $err,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
}
?>
+108
View File
@@ -0,0 +1,108 @@
<?php
header("Content-Type: application/json; charset=utf-8");
if(isset($_GET['limit'])) {
$itemsPerPage = (int)$_GET['limit']; // 1ページあたりの投稿数
if(isset($_GET['page'])) {
$pageNumber = (int)$_GET['page'];
}else{
$pageNumber = 1;
}
$offset = ($pageNumber - 1) * $itemsPerPage;
$messages = array();
require('../db.php');
$datetime = array();
$pdo = null;
session_start();
try {
$option = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
);
$pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
} catch(PDOException $e) {
// 接続エラーのときエラー内容を取得する
$error_message[] = $e->getMessage();
}
if (!empty($pdo)) {
$sql = "SELECT account, username, uniqid, rpuniqid, ueuse, datetime, photo1, photo2, video1, favorite, abi, abidate FROM ueuse WHERE rpuniqid = '' ORDER BY datetime DESC LIMIT " . intval($offset) . ", " . intval($itemsPerPage);
$message_array = $pdo->query($sql);
while ($row = $message_array->fetch(PDO::FETCH_ASSOC)) {
$messages[] = $row;
}
// ユーザー情報を取得して、$messages内のusernameをuserDataのusernameに置き換える
foreach ($messages as &$message) {
$userQuery = $pdo->prepare("SELECT username, userid, profile, role FROM account WHERE userid = :userid");
$userQuery->bindValue(':userid', $message["account"]);
$userQuery->execute();
$userData = $userQuery->fetch();
if ($userData) {
$message['username'] = $userData['username'];
$message['role'] = $userData['role'];
}
}
if (!empty($messages)) {
$response = array(); // ループ外で $response を初期化
foreach ($messages as $ueusedata) {
$favcnts = explode(',', $ueusedata["favorite"]);
$ueusedata["favorite_cnt"] = count($favcnts) - 1;
$item = [
'account' => htmlentities($ueusedata["account"]),
'username' => htmlentities($ueusedata["username"]),
'uniqid' => htmlentities($ueusedata["uniqid"]),
'ueuse' => htmlentities($ueusedata["ueuse"]),
'photo1' => htmlentities(str_replace('../', '' . $_SERVER['HTTP_HOST'] . '/', $ueusedata["photo1"])),
'photo2' => htmlentities(str_replace('../', '' . $_SERVER['HTTP_HOST'] . '/', $ueusedata["photo2"])),
'video1' => htmlentities(str_replace('../', '' . $_SERVER['HTTP_HOST'] . '/', $ueusedata["video1"])),
'favorite' => htmlentities($ueusedata["favorite"]),
'favorite_cnt' => htmlentities($ueusedata["favorite_cnt"]),
'datetime' => htmlentities($ueusedata["datetime"]),
'abi' => htmlentities($ueusedata["abi"]),
'abidatetime' => htmlentities($ueusedata["abidate"]),
];
$response[$ueusedata["uniqid"]] = $item; // ループ内で $response にデータを追加
}
echo json_encode($response, JSON_UNESCAPED_UNICODE);
} else {
$err = "ueuse_not_found";
$response = array(
'error_code' => $err,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
}
$pdo = null;
}
}else{
$err = "input_not_found";
$response = array(
'error_code' => $err,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
}
?>
+89
View File
@@ -0,0 +1,89 @@
<?php
header("Content-Type: application/json; charset=utf-8");
if(isset($_GET['ueuseid'])) {
$ueuseid = htmlentities($_GET['ueuseid']);
require('../db.php');
$datetime = array();
$pdo = null;
session_start();
try {
$option = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
);
$pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
} catch(PDOException $e) {
// 接続エラーのときエラー内容を取得する
$error_message[] = $e->getMessage();
}
if (!empty($pdo)) {
$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,
));
$ueuseQuery = $pdo->prepare("SELECT account, ueuse, uniqid, rpuniqid, datetime, photo1, photo2, video1, favorite, abi, abidate FROM ueuse WHERE uniqid = :ueuseid");
$ueuseQuery->bindValue(':ueuseid', $ueuseid);
$ueuseQuery->execute();
$ueusedata = $ueuseQuery->fetch();
}
if (empty($ueusedata)){
$response = array(
'error_code' => "ueuseid_not_found",
);
}else{
$userQuery = $pdo->prepare("SELECT username, userid, profile, role FROM account WHERE userid = :userid");
$userQuery->bindValue(':userid', $ueusedata["account"]);
$userQuery->execute();
$userData = $userQuery->fetch();
if ($userData) {
$ueusedata['username'] = $userData['username'];
$ueusedata['role'] = $userData['role'];
}
$favcnts = explode(',', $ueusedata["favorite"]);
$ueusedata["favorite_cnt"] = count($favcnts)-1;
$response = array(
'userid' => htmlentities($ueusedata["account"]),
'user_name' => htmlentities($ueusedata["username"]),
'uniqid' => htmlentities($ueusedata["uniqid"]),
'ueuse' => htmlentities($ueusedata["ueuse"]),
'photo1' => htmlentities(str_replace('../', ''.$_SERVER['HTTP_HOST'].'/', $ueusedata["photo1"])),
'photo2' => htmlentities(str_replace('../', ''.$_SERVER['HTTP_HOST'].'/', $ueusedata["photo2"])),
'video1' => htmlentities(str_replace('../', ''.$_SERVER['HTTP_HOST'].'/', $ueusedata["video1"])),
'favorite' => htmlentities($ueusedata["favorite"]),
'favorite_cnt' => htmlentities($ueusedata["favorite_cnt"]),
'datetime' => htmlentities($ueusedata["datetime"]),
'abi' => htmlentities($ueusedata["abi"]),
'abidatetime' => htmlentities($ueusedata["abidate"]),
);
}
echo json_encode($response, JSON_UNESCAPED_UNICODE);;
}else{
$err = "input_not_found";
$response = array(
'error_code' => $err,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
}
?>
+1
View File
@@ -1,4 +1,5 @@
<?php
header("Content-Type: application/json; charset=utf-8");
if(isset($_GET['userid'])) {
+43 -12
View File
@@ -803,6 +803,7 @@ main h1{
}
.ueuse .flebox{
display: flex;
flex-wrap: wrap;
}
.ueuse .flebox img{
object-fit: cover;
@@ -813,12 +814,13 @@ main h1{
height:48px;
border-radius: 50%;
}
.ueuse .flebox a{
.ueuse .flebox a {
flex-shrink: 0;
margin-top: auto;
margin-bottom: auto;
margin-left: 12px;
font-size: 18px;
color:#252525;
color: #252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
@@ -1654,9 +1656,21 @@ main h1{
}
.formarea p{
line-height: 20px;
overflow-wrap: break-word;
margin-top: 24px;
margin-bottom: 24px;
margin-top: 12px;
margin-bottom: 12px;
font-size: 16px;
color:#252525;
text-decoration: none;
font-family: 'BIZ UDPGothic', sans-serif;
font-weight: bold;
}
.formarea li{
line-height: 20px;
overflow-wrap: break-word;
margin-top: 12px;
margin-bottom: 12px;
font-size: 16px;
color:#252525;
text-decoration: none;
@@ -2618,6 +2632,7 @@ hr{
.checkicon {
display: block;
flex-shrink: 0;
text-align: center;
width: 25px;
height: 25px;
@@ -2698,7 +2713,7 @@ hr{
}
main{
height: 90dvh;
height: 93.7dvh;
overflow: auto;
border-radius: 0px;
margin-top: 0px;
@@ -2820,8 +2835,8 @@ hr{
margin-top: 0px;
margin-bottom: 0px;
background-color: none;
padding-top: 1.9dvh;
padding-bottom: 1.9dvh;
padding-top: 0.5dvh;
padding-bottom: 0.5dvh;
border-radius: 0px;
color:#FFC832;
@@ -2845,8 +2860,8 @@ hr{
box-shadow:none;
}
svg {
width: 6dvh;
height: 6dvh;
width: 5dvh;
height: 5dvh;
margin-left: auto;
margin-right: auto;
margin-top: auto;
@@ -3039,6 +3054,19 @@ hr{
margin-left: 0px;
width: 24px;
}
.ueuse{
animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards;
margin: 12px;
border-radius: 10px;
padding-left: 12px;
padding-right: 12px;
padding-top: 12px;
padding-bottom: 12px;
background-color: #F5F5F5;
border: 1px solid #EEE;
width: auto;
}
.leftbox{
display: block;
@@ -3832,15 +3860,18 @@ hr{
border: 1px solid #FFC832;
border-bottom: 3px solid #FFC832;
}
.botbox{
border-top: 1px solid #FFC832;
}
.btmbutton{
background-color: #FFC832;
color:#FFFAE6;
background-color: #0c0c0c;
color:#F5F5F5;
border: none;
}
.btmbutton:hover{
background-color: #FFC832;
color: #FFFAE6;
color: #f5f5f5;
}
+2
View File
@@ -272,6 +272,8 @@ $pdo = null;
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/home.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">
<title>絵文字登録 - <?php echo file_get_contents($servernamefile);?></title>
</head>
+2 -1
View File
@@ -137,7 +137,8 @@ $pdo = null;
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<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">
<link rel="stylesheet" href="../css/home.css">
<title>絵文字一覧 - <?php echo file_get_contents($servernamefile);?></title>
+2
View File
@@ -231,6 +231,8 @@ $pdo = null;
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/home.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">
<title>お知らせ配信 - <?php echo file_get_contents($servernamefile);?></title>
</head>
+117 -17
View File
@@ -1,5 +1,10 @@
<?php
function random_token($length = 64)
{
return substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $length);
}
$servernamefile = "../server/servername.txt";
function createUniqId(){
list($msec, $sec) = explode(" ", microtime());
@@ -133,7 +138,7 @@ if( !empty($pdo) ) {
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
));
$userQuery = $dbh->prepare("SELECT userid FROM account WHERE userid = :userid");
$userQuery = $dbh->prepare("SELECT userid,token FROM account WHERE userid = :userid");
$userQuery->bindValue(':userid', $userid);
$userQuery->execute();
$userData = $userQuery->fetch();
@@ -283,7 +288,74 @@ if( !empty($_POST['session_submit']) ) {
// すべての出力を終了
exit;
} else {
$error_message[] = '登録に失敗しました。';
$error_message[] = 'セッションの終了に失敗しました。';
}
}
if( !empty($_POST['token_submit']) ) {
$token = random_token();
$pdo->beginTransaction();
try {
$stmt = $pdo->prepare("UPDATE account SET token = :token WHERE userid = :userid;");
$stmt->bindParam(':token', $token, PDO::PARAM_STR);
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
// SQLクエリの実行
$res = $stmt->execute();
// コミット
$res = $pdo->commit();
} catch (Exception $e) {
// エラーが発生した時はロールバック
$pdo->rollBack();
}
if ($res) {
$_SESSION['token'] = $token;
// リダイレクト先のURLへ転送する
$url = 'token.php';
header('Location: ' . $url, true, 303);
exit;
} else {
$error_message[] = 'トークンの発行に失敗しました。';
}
}
if( !empty($_POST['token_off_submit']) ) {
$token = '';
$pdo->beginTransaction();
try {
$stmt = $pdo->prepare("UPDATE account SET token = :token WHERE userid = :userid;");
$stmt->bindParam(':token', $token, PDO::PARAM_STR);
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
// SQLクエリの実行
$res = $stmt->execute();
// コミット
$res = $pdo->commit();
} catch (Exception $e) {
// エラーが発生した時はロールバック
$pdo->rollBack();
}
if ($res) {
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location:".$url."");
exit;
} else {
$error_message[] = 'トークンの削除に失敗しました。';
}
}
@@ -317,26 +389,54 @@ require('../logout/logout.php');
</ul>
<?php endif; ?>
<form class="formarea" method="post">
<h1>セッション終了</h1>
<p>下のセッションを終了ボタンを押すと全てのログイン中のデバイスからログアウトされます。<br>再度uwuzu使用するにはログインが必須になります。</p>
<input type="submit" class = "irobutton" name="session_submit" value="セッションを終了">
<hr>
<hr>
<h1>アカウント削除</h1>
<p>アカウント誤削除を防ぐため下の入力ボックスにご自身のユーザーIDを入力する必要があります。</p>
<?php if($res["admin"] === "yes"){?>
<p class="errmsg">あなたはこのサーバーの管理者のようです。<br>管理者アカウントの移行は済んでいますか?<br>アカウントを削除しても大丈夫なのですか...?</p>
<?php }?>
<div>
<p>確認用ユーザーID</p>
<input id="chkuserid" placeholder="" class="inbox" type="text" name="chkuserid" value="">
</div>
<input type="submit" class = "irobutton" name="btn_submit" value="アカウント削除">
<p>アカウント誤削除を防ぐため下の入力ボックスにご自身のユーザーIDを入力する必要があります。</p>
<?php if($res["admin"] === "yes"){?>
<p class="errmsg">あなたはこのサーバーの管理者のようです。<br>管理者アカウントの移行は済んでいますか?<br>アカウントを削除しても大丈夫なのですか...?</p>
<?php }?>
<div>
<p>確認用ユーザーID</p>
<input id="chkuserid" placeholder="" class="inbox" type="text" name="chkuserid" value="">
</div>
<input type="submit" class = "irobutton" name="btn_submit" value="アカウント削除">
<hr>
<h1>API</h1>
<p>APIの簡単な使用法です。</p>
<hr>
<li>ユーザー情報取得API</li>
<p>https://[ドメイン名(uwuzu.netなど)]/api/userdata-api?userid=[ユーザーID]</p>
<p>これによりユーザーのユーザーネーム(user_name)、プロフィール(profile)、登録日時(registered_date)、フォローしている人一覧(follow)、フォロワー一覧(follower)、フォロー・フォロワー数(follow_cnt,follower_cnt)が取得できます。</p>
<hr>
<li>単独投稿取得API</li>
<p>https://[ドメイン名(uwuzu.netなど)]/api/ueuse-api?ueuseid=[投稿の詳細ページのリンクより投稿のID(!より後、~より手前の文字列)]</p>
<p>これにより投稿内容(ueuse)と、ユーザーネーム(user_name)、ユーザーID(userid)、投稿ID(uniqid)、写真・動画URL(photo1,photo2,video1)、いいねした人一覧(favorite)、いいね数(favorite_cnt)、投稿日時(datetime)、追記内容(abi)、追記日時(abidatetime)が取得できます。</p>
<hr>
<li>ローカルタイムライン投稿取得API</li>
<p>https://[ドメイン名(uwuzu.netなど)]/api/ltl-api?limit=[取得件数]&page=[ページ切り替え]</p>
<p>これにより投稿内容(ueuse)と、ユーザーネーム(user_name)、ユーザーID(userid)、投稿ID(uniqid)、写真・動画URL(photo1,photo2,video1)、いいねした人一覧(favorite)、いいね数(favorite_cnt)、投稿日時(datetime)、追記内容(abi)、追記日時(abidatetime)が取得できます。<br>page=は指定しなくても動作します。(https://[ドメイン名(uwuzu.netなど)]/api/ltl-api?limit=[取得件数])</p>
<hr>
<li>ローカルタイムライン投稿取得API</li>
<p>https://[ドメイン名(uwuzu.netなど)]/api/ltl-api?limit=[取得件数]&page=[ページ切り替え]</p>
<hr>
<li>投稿API</li>
<p>https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&ueuse=[投稿の内容]</p>
<?php
if(empty($userData['token'])){
?>
<p>以下のボタンよりアクセストークンを取得すると使用できます。<br>アクセストークンは一度発行すると作り直すまで再度確認はできません。また、絶対に他人に知られないように保護してください。<p>
<input type="submit" class = "irobutton" name="token_submit" value="アクセストークン発行">
<?php }else{ ?>
<p>以下のボタンよりアクセストークンを削除できます。ボタンを押すとすぐに削除されますのでご注意ください。</p>
<input type="submit" class = "irobutton" name="token_off_submit" value="アクセストークン削除">
<?php } ?>
</form>
</main>
+170
View File
@@ -0,0 +1,170 @@
<?php
$servernamefile = "../server/servername.txt";
require('../db.php');
$onlyuserfile = "../server/onlyuser.txt";
$onlyuser = file_get_contents($onlyuserfile);
session_start();
// 変数の初期化
$current_date = null;
$message_array = array();
$error_message = array();
$authcode = array();
$pdo = null;
$stmt = null;
$res = null;
$option = null;
$userid = $_SESSION['userid'];
$token = $_SESSION['token'];
try {
$option = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
);
$pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
} catch(PDOException $e) {
// 接続エラーのときエラー内容を取得する
$error_message[] = $e->getMessage();
}
if(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);
}else{
header("Location: ../login.php");
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);
}else{
header("Location: ../login.php");
exit;
}
} else {
// ログインが許可されていない場合、ログインページにリダイレクト
header("Location: ../login.php");
exit;
}
if(empty($userid)){
header("Location: ../login.php");
exit;
}
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('../logout/logout.php');
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<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">
<title>アクセストークン発行完了 - <?php echo file_get_contents($servernamefile);?></title>
</head>
<body>
<?php require('../require/leftbox.php');?>
<main>
<?php if( !empty($error_message) ): ?>
<ul class="errmsg">
<?php foreach( $error_message as $value ): ?>
<p>・ <?php echo $value; ?></p>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div class="emojibox">
<h1>アクセストークン発行完了</h1>
<?php if( !empty($error_message) ): ?>
<ul class="errmsg">
<?php foreach( $error_message as $value ): ?>
<p>・ <?php echo $value; ?></p>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div class="formarea">
<p>発行完了!以下のアクセストークンでこのアカウント(<?php echo $userid?>)に投稿を行えます!</p>
<p>アクセストークンは以下のものです!<br>
<ul class="errmsg">
<p>以下のアクセストークンは絶対に他人に知られないように大切に保管してください!</p>
</ul>
<p><?php echo $token;?>
</div>
<a href="index" class="irobutton">戻る</a>
</div>
</main>
<?php require('../require/rightbox.php');?>
<?php require('../require/botbox.php');?>
</body>
</html>
+2 -2
View File
@@ -1,4 +1,4 @@
uwuzu
1.2.9
2023/08/22
1.2.10
2023/08/23
daichimarukana,putonfps
+7 -1
View File
@@ -1,8 +1,14 @@
## リリースノートだぜぇぇぇぇぇぇい!!!!!!!
ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...)
## Version 1.2.10
リリース日:2023/08/23
モバイル向けUIを変更しました。
使用できるAPIを増やしました。
投稿API機能によりアクセストークンを使用し投稿できるようにしました。
## Version 1.2.9
リリース日:2023/08/21
リリース日:2023/08/22
メニュー画面に各機能のアイコンを表示するようにしました。
公式ロールがあるアカウントの投稿がタイムラインに流れると公式バッジがアカウントidの横に表示されるようにしました。
プロフィールにカスタム絵文字を使用できるようにしました。