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

uwuzu version 1.2.19

This commit is contained in:
daichimarukana
2023-09-10 18:19:44 +09:00
parent 66a93d34ec
commit c4a67e75ec
43 changed files with 4546 additions and 698 deletions
+400
View File
@@ -0,0 +1,400 @@
<?php
$servernamefile = "../server/servername.txt";
$serverinfofile = '../server/info.txt';
$serverinfo = file_get_contents($serverinfofile);
$servertermsfile = '../server/terms.txt';
$serverterms = file_get_contents($servertermsfile);
$serverprvfile = '../server/privacypolicy.txt';
$serverprv = file_get_contents($serverprvfile);
$contactfile = "../server/contact.txt";
$adminfile = "../server/admininfo.txt";
$serverstopfile = "../server/serverstop.txt";
$onlyuserfile = "../server/onlyuser.txt";
$err404imagefile = "../server/404imagepath.txt";
$robots = "../robots.txt";
function createUniqId(){
list($msec, $sec) = explode(" ", microtime());
$hashCreateTime = $sec.floor($msec*1000000);
$hashCreateTime = strrev($hashCreateTime);
return base_convert($hashCreateTime,10,36);
}
function random_code($length = 8){
return substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $length);
}
require('../db.php');
// 変数の初期化
$datetime = array();
$user_name = null;
$message = array();
$message_data = null;
$error_message = array();
$pdo = null;
$stmt = null;
$res = null;
$option = null;
session_name('uwuzu_s_id');
session_start();
session_regenerate_id(true);
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"] && $_SESSION['userid'] === $res["userid"]){
// セッションに値をセット
$userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット
$username = $_SESSION['username']; // セッションに格納されている値をそのままセット
$loginid = $res["loginid"];
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['loginid'] = $res["loginid"];
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;
}
} 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"] && $_COOKIE['userid'] === $res["userid"]){
// セッションに値をセット
$userid = $_COOKIE['userid']; // クッキーから取得した値をセット
$username = $_COOKIE['username']; // クッキーから取得した値をセット
$loginid = $res["loginid"];
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['loginid'] = $res["loginid"];
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;
}
} else {
// ログインが許可されていない場合、ログインページにリダイレクト
header("Location: ../login.php");
exit;
}
if(empty($userid)){
header("Location: ../login.php");
exit;
}
if(empty($username)){
header("Location: ../login.php");
exit;
}
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($_POST['ads_btn_submit']) ) {
$ads_url = htmlentities($_POST['ads_url']);
$ads_img_url = htmlentities($_POST['ads_img_url']);
$ads_start_date = htmlentities(date($_POST['ads_start_date']));
$ads_limit_date = htmlentities(date($_POST['ads_limit_date']));
$ads_memo = htmlentities($_POST['ads_memo']);
if(empty($ads_url)){
$error_message[] = "URLが入力されていません。";
}
if(empty($ads_img_url)){
$error_message[] = "画像のURLが入力されていません。";
}
if(empty($ads_start_url)){
$error_message[] = "設置開始日時が入力されていません。";
}
if(empty($ads_limit_url)){
$error_message[] = "設置終了日時が入力されていません。";
}
if(empty($ads_memo_url)){
$error_message[] = "メモが入力されていません。";
}
if (!empty($pdo)) {
// 書き込み日時を取得
$datetime = date("Y-m-d H:i:s");
$uniqid = createUniqId();
// トランザクション開始
$pdo->beginTransaction();
try {
// SQL作成
$stmt = $pdo->prepare("INSERT INTO ads (uniqid, url, image_url, memo, start_date, limit_date, datetime) VALUES (:uniqid, :url, :image_url, :memo, :start_date, :limit_date, :datetime)");
$stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR);
$stmt->bindParam(':url', $ads_url, PDO::PARAM_STR);
$stmt->bindParam(':image_url', $ads_img_url, PDO::PARAM_STR);
$stmt->bindParam(':memo', $ads_memo, PDO::PARAM_STR);
$stmt->bindParam(':start_date', $ads_start_date, PDO::PARAM_STR);
$stmt->bindParam(':limit_date', $ads_limit_date, PDO::PARAM_STR);
$stmt->bindParam(':datetime', $datetime, 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[] = $e->getMessage();
}
// プリペアドステートメントを削除
$stmt = null;
}
}
if( !empty($_POST['ads_del']) ) {
$ads_uniqid = htmlentities($_POST['ads_id']);
try{
// 通知削除クエリを実行
$deleteQuery = $pdo->prepare("DELETE FROM ads WHERE uniqid = :uniqid");
$deleteQuery->bindValue(':uniqid', $ads_uniqid, PDO::PARAM_STR);
$res = $deleteQuery->execute();
} 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[] = $e->getMessage();
}
// プリペアドステートメントを削除
$stmt = null;
}
require('../logout/logout.php');
if(isset($_GET['q'])){
$keyword = htmlentities($_GET['q']);
}else{
$keyword = "";
}
if (!empty($pdo)) {
$sql = "SELECT * FROM ads ORDER BY datetime DESC";
$allads = $pdo->query($sql);
while ($row = $allads->fetch(PDO::FETCH_ASSOC)) {
$adss[] = $row;
}
}
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/home.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<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="admin_settings">
<?php require('settings_left_menu.php');?>
<div class="admin_right">
<form class="formarea" enctype="multipart/form-data" method="post">
<h1>広告追加</h1>
<p>広告はLTL・FTL・返信画面に表示されます。<br>また、投稿10件につき一件の広告がランダムに選ばれ表示されます。<br>表示の優先順位は設定できません。</p>
<div>
<p>クリックした時のリダイレクト先URL</p>
<div class="p2">広告をクリックするとこのURLに飛びます。</div>
<input id="ads_url" placeholder="https://uwuzu.net/" class="inbox" type="text" name="ads_url" value="">
</div>
<div>
<p>画像URL</p>
<div class="p2">以下のURL先の画像が表示されます。</div>
<input id="ads_img_url" placeholder="https://uwuzu.net/img/uwuzulogo.png" class="inbox" type="text" name="ads_img_url" value="">
</div>
<div>
<p>掲載開始日時</p>
<div class="p2">広告の掲載開始日時です。</div>
<input type="date" name="ads_start_date" class="inbox" value="2023-08-16">
</div>
<div>
<p>掲載終了日時</p>
<div class="p2">広告の掲載終了日時です。</div>
<input type="date" name="ads_limit_date" class="inbox" value="2023-08-17">
</div>
<div>
<p>広告のメモ</p>
<div class="p2">ユーザーが広告について確認するときに表示されるメモです。</div>
<textarea type="text" name="ads_memo" placeholder="このメモはユーザーに公開されます" class="inbox"></textarea>
</div>
<input type="submit" class = "irobutton" name="ads_btn_submit" value="追加">
</form>
<div class="formarea">
<hr>
<h1>広告一覧</h1>
<?php if(!(empty($adss))){?>
<?php foreach ($adss as $value) {?>
<div class="server_code">
<details>
<summary><?php echo htmlentities($value["url"]);?></summary>
<hr>
<p>設置状況:<?php if( !empty($value["url"]) ){
if($value["start_date"] < date("Y-m-d H:i:s") && $value["limit_date"] > date("Y-m-d H:i:s")){
echo "設置中  ✅";
}else{
echo "設置解除済⛔";
}}?></p>
<p>設置期間:<?php echo date("Y年m月d日",strtotime($value["start_date"])).' から '.date("Y年m月d日",strtotime($value["limit_date"])).' まで';?>
<hr>
<p>URL:<?php echo htmlentities($value["url"]);?></p>
<p>画像URL:<?php echo htmlentities($value["image_url"]);?></p>
<hr>
<p>メモ:<?php echo htmlentities($value["memo"]);?></p>
<hr>
<p>追加日時:<?php echo htmlentities($value["datetime"]);?></p>
<hr>
<form enctype="multipart/form-data" method="post">
<div class="delbox">
<p>削除ボタンを押すとこの広告は削除されます。</p>
<input type="text" name="ads_id" id="ads_id" value="<?php echo htmlentities($value["uniqid"]);?>" style="display:none;" >
<input type="submit" name="ads_del" class="delbtn" value="削除">
</div>
</form>
</details>
</div>
<?php }?>
<?php }?>
</div>
</div>
</div>
</main>
<?php require('../require/rightbox.php');?>
<?php require('../require/botbox.php');?>
</body>
</html>
+60
View File
@@ -0,0 +1,60 @@
<?php
require('../db.php');
if (htmlentities(isset($_POST['code'])) && htmlentities(isset($_POST['userid'])) && htmlentities(isset($_POST['account_id']))){
$postUserid = htmlentities($_POST['userid']);
$postCode= htmlentities($_POST['code']);
$loginid = htmlentities($_POST['account_id']);
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();
}
// データベース接続の設定
$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,
));
$query = $dbh->prepare('SELECT * FROM account WHERE userid = :userid limit 1');
$query->execute(array(':userid' => $postUserid));
$result2 = $query->fetch();
if($result2["loginid"] === $loginid){
if($result2["admin"] === "yes"){
try {
$pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS);
// 削除クエリを実行
$deleteQuery = $pdo->prepare("DELETE FROM invitation WHERE code = :code");
$deleteQuery->bindValue(':code', $postCode, PDO::PARAM_STR);
$res = $deleteQuery->execute();
if ($res) {
echo json_encode(['success' => true]);
exit;
} else {
echo json_encode(['success' => false, 'error' => '削除に失敗しました。']);
exit;
}
} catch(PDOException $e) {
echo json_encode(['success' => false, 'error' => 'データベースエラー:' . $e->getMessage()]);
exit;
}
}
}
}else{
echo json_encode(['success' => false, 'error' => '削除に失敗しました。(sess_err)']);
exit;
}
?>
+364
View File
@@ -0,0 +1,364 @@
<?php
$servernamefile = "../server/servername.txt";
$serverinfofile = '../server/info.txt';
$serverinfo = file_get_contents($serverinfofile);
$servertermsfile = '../server/terms.txt';
$serverterms = file_get_contents($servertermsfile);
$serverprvfile = '../server/privacypolicy.txt';
$serverprv = file_get_contents($serverprvfile);
$contactfile = "../server/contact.txt";
$adminfile = "../server/admininfo.txt";
$serverstopfile = "../server/serverstop.txt";
$onlyuserfile = "../server/onlyuser.txt";
$err404imagefile = "../server/404imagepath.txt";
$robots = "../robots.txt";
function createUniqId(){
list($msec, $sec) = explode(" ", microtime());
$hashCreateTime = $sec.floor($msec*1000000);
$hashCreateTime = strrev($hashCreateTime);
return base_convert($hashCreateTime,10,36);
}
function random_code($length = 8){
return substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $length);
}
require('../db.php');
// 変数の初期化
$datetime = array();
$user_name = null;
$message = array();
$message_data = null;
$error_message = array();
$pdo = null;
$stmt = null;
$res = null;
$option = null;
session_name('uwuzu_s_id');
session_start();
session_regenerate_id(true);
try {
$option = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
);
$pdo = new PDO('mysql:charset=UTF8;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"] && $_SESSION['userid'] === $res["userid"]){
// セッションに値をセット
$userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット
$username = $_SESSION['username']; // セッションに格納されている値をそのままセット
$loginid = $res["loginid"];
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['loginid'] = $res["loginid"];
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;
}
} 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"] && $_COOKIE['userid'] === $res["userid"]){
// セッションに値をセット
$userid = $_COOKIE['userid']; // クッキーから取得した値をセット
$username = $_COOKIE['username']; // クッキーから取得した値をセット
$loginid = $res["loginid"];
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['loginid'] = $res["loginid"];
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;
}
} else {
// ログインが許可されていない場合、ログインページにリダイレクト
header("Location: ../login.php");
exit;
}
if(empty($userid)){
header("Location: ../login.php");
exit;
}
if(empty($username)){
header("Location: ../login.php");
exit;
}
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) ) {
// データベース接続の設定
$dbh = new PDO('mysql:charset=UTF8;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, profile, role FROM account WHERE userid = :userid");
$userQuery->bindValue(':userid', $userid);
$userQuery->execute();
$userData = $userQuery->fetch();
$role = $userData["role"];
$dbh = new PDO('mysql:charset=UTF8;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
$rerole = $dbh->prepare("SELECT username, userid, password, mailadds, profile, iconname, headname, role, datetime FROM account WHERE userid = :userid");
$rerole->bindValue(':userid', $userid);
// SQL実行
$rerole->execute();
$userdata = $rerole->fetch(); // ここでデータベースから取得した値を $role に代入する
}
if (!empty($pdo)) {
$sql = "SELECT code,used,datetime FROM invitation ORDER BY datetime DESC";
$invcode = $pdo->query($sql);
while ($row = $invcode->fetch(PDO::FETCH_ASSOC)) {
$codes[] = $row;
}
}
if( !empty($_POST['code_btn_submit']) ) {
$make_code = $_POST['make_code'];
$code_num = 0;
while ($code_num < (int)$make_code) {
$code_num++;
$pdo->beginTransaction();
$datetime = date("Y-m-d H:i:s");
try {
$new_invcode = random_code();
$used = "none";
// SQL作成
$stmt = $pdo->prepare("INSERT INTO invitation (code, used, datetime) VALUES (:code, :used, :datetime)");
$stmt->bindParam(':code', $new_invcode, PDO::PARAM_STR);
$stmt->bindParam(':used', $used, PDO::PARAM_STR);
$stmt->bindParam(':datetime', $datetime, 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[] = '発行に失敗しました。';
}
// プリペアドステートメントを削除
$stmt = null;
}
require('../logout/logout.php');
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/home.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<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="admin_settings">
<?php require('settings_left_menu.php');?>
<div class="admin_right">
<form class="formarea" enctype="multipart/form-data" method="post">
<h1>招待コード発行所</h1>
<?php if(file_get_contents($onlyuserfile) === "true"){?>
<p>下の発行ボタンで新しくコードを発行できます!<br>なお、コードは一回限り有効です。</p>
<div>
<p>発行数</p>
<input id="make_code" placeholder="1" class="inbox" type="number" name="make_code" value="1" min="1" max="10000">
</div>
<input type="submit" class = "irobutton" name="code_btn_submit" value="発行!">
<?php foreach ($codes as $value) {?>
<div class="server_code">
<details>
<summary>コード:<?php if( !empty($value["code"]) ){ echo htmlentities($value["code"]); }?><?php if( !empty($value["used"]) ){if($value["used"] === "true"){echo " ✅";}}?> </summary>
<p>使用状況:<?php if( !empty($value["used"]) ){
if($value["used"] === "none"){
echo "未使用<br>発行日時:".$value["datetime"]."";
}elseif($value["used"] === "true"){
echo "使用済み<br>使用日時:".$value["datetime"]."";
}?></p>
<div class="delbox">
<p>削除ボタンを押すとこのコードは使用できなくなります。</p>
<button type="button" id="code_delete" class="delbtn" del-code="<?php echo htmlentities($value["code"]);?>">削除</button>
</div>
</details>
</div>
<?php }?>
<?php }?>
<?php }else{?>
<p>サーバーは招待制にされていないため招待コードは利用できません。</p>
<?php }?>
</form>
</div>
</div>
</main>
<?php require('../require/rightbox.php');?>
<?php require('../require/botbox.php');?>
<script>
$(document).ready(function() {
$(document).on('click', '.delbtn', function (event) {
var code = $(this).attr('del-code');
var userid = '<?php echo $userid; ?>';
var account_id = '<?php echo $loginid; ?>';
var codeElement = $(this).closest('.server_code');
$.ajax({
url: 'code_delete.php',
method: 'POST',
data: { code: code, userid: userid, account_id: account_id },
dataType: 'json',
success: function (response) {
if (response.success) {
codeElement.remove();
} else {
// 削除失敗時の処理
}
},
error: function () {
// エラー時の処理
}
});
});
});
</script>
</body>
</html>
+447
View File
@@ -0,0 +1,447 @@
<?php
$servernamefile = "../server/servername.txt";
$serverinfofile = '../server/info.txt';
$serverinfo = file_get_contents($serverinfofile);
$servertermsfile = '../server/terms.txt';
$serverterms = file_get_contents($servertermsfile);
$serverprvfile = '../server/privacypolicy.txt';
$serverprv = file_get_contents($serverprvfile);
$contactfile = "../server/contact.txt";
$adminfile = "../server/admininfo.txt";
$serverstopfile = "../server/serverstop.txt";
$onlyuserfile = "../server/onlyuser.txt";
$err404imagefile = "../server/404imagepath.txt";
$robots = "../robots.txt";
function createUniqId(){
list($msec, $sec) = explode(" ", microtime());
$hashCreateTime = $sec.floor($msec*1000000);
$hashCreateTime = strrev($hashCreateTime);
return base_convert($hashCreateTime,10,36);
}
function random_code($length = 8){
return substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $length);
}
require('../db.php');
// 変数の初期化
$datetime = array();
$user_name = null;
$message = array();
$message_data = null;
$error_message = array();
$pdo = null;
$stmt = null;
$res = null;
$option = null;
session_name('uwuzu_s_id');
session_start();
session_regenerate_id(true);
try {
$option = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
);
$pdo = new PDO('mysql:charset=UTF8;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"] && $_SESSION['userid'] === $res["userid"]){
// セッションに値をセット
$userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット
$username = $_SESSION['username']; // セッションに格納されている値をそのままセット
$loginid = $res["loginid"];
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['loginid'] = $res["loginid"];
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;
}
} 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"] && $_COOKIE['userid'] === $res["userid"]){
// セッションに値をセット
$userid = $_COOKIE['userid']; // クッキーから取得した値をセット
$username = $_COOKIE['username']; // クッキーから取得した値をセット
$loginid = $res["loginid"];
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['loginid'] = $res["loginid"];
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;
}
} else {
// ログインが許可されていない場合、ログインページにリダイレクト
header("Location: ../login.php");
exit;
}
if(empty($userid)){
header("Location: ../login.php");
exit;
}
if(empty($username)){
header("Location: ../login.php");
exit;
}
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) ) {
// データベース接続の設定
$dbh = new PDO('mysql:charset=UTF8;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, profile, role FROM account WHERE userid = :userid");
$userQuery->bindValue(':userid', $userid);
$userQuery->execute();
$userData = $userQuery->fetch();
$role = $userData["role"];
$dbh = new PDO('mysql:charset=UTF8;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
$rerole = $dbh->prepare("SELECT username, userid, password, mailadds, profile, iconname, headname, role, datetime FROM account WHERE userid = :userid");
$rerole->bindValue(':userid', $userid);
// SQL実行
$rerole->execute();
$userdata = $rerole->fetch(); // ここでデータベースから取得した値を $role に代入する
}
if (!empty($pdo)) {
$sql = "SELECT code,used,datetime FROM invitation ORDER BY datetime DESC";
$invcode = $pdo->query($sql);
while ($row = $invcode->fetch(PDO::FETCH_ASSOC)) {
$codes[] = $row;
}
}
if( !empty($_POST['btn_submit']) ) {
// 空白除去
$servername = $_POST['servername'];
$serverinfo = $_POST['serverinfo'];
$serveradminname = $_POST['serveradminname'];
$servermailadds = $_POST['servermailadds'];
$onlyuser = $_POST['onlyuser'];
if($onlyuser === "true"){
$saveonlyuser = "true";
}else{
$saveonlyuser = "false";
}
$postrobots = $_POST['robots'];
if($postrobots === "true"){
//GPTBotによるクロールを拒否
$file = fopen($robots, 'w');
$data = "User-agent: GPTBot\nDisallow: /";
fputs($file, $data);
fclose($file);
}else{
//GPTBotによるクロールを許可
$file = fopen($robots, 'w');
$data = "";
fputs($file, $data);
fclose($file);
}
$serverterms = $_POST['serverterms'];
$serverprv = $_POST['serverprv'];
$serverstop = $_POST['serverstop'];
//鯖名
$file = fopen($servernamefile, 'w');
$data = $servername;
fputs($file, $data);
fclose($file);
//鯖紹介
$file = fopen($serverinfofile, 'w');
$data = $serverinfo;
fputs($file, $data);
fclose($file);
//鯖管理者名
$file = fopen($adminfile, 'w');
$data = $serveradminname;
fputs($file, $data);
fclose($file);
//鯖管理者メアド
$file = fopen($contactfile, 'w');
$data = $servermailadds;
fputs($file, $data);
fclose($file);
//招待制にするか
$file = fopen($onlyuserfile, 'w');
$data = $saveonlyuser;
fputs($file, $data);
fclose($file);
//利用規約
$file = fopen($servertermsfile, 'w');
$data = $serverterms;
fputs($file, $data);
fclose($file);
//プライバシーポリシー
$file = fopen($serverprvfile, 'w');
$data = $serverprv;
fputs($file, $data);
fclose($file);
//鯖停止
$file = fopen($serverstopfile, 'w');
$data = $serverstop;
fputs($file, $data);
fclose($file);
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location:".$url."");
exit;
}
require('../logout/logout.php');
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/home.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<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="admin_settings">
<?php require('settings_left_menu.php');?>
<div class="admin_right">
<form class="formarea" enctype="multipart/form-data" method="post">
<h1>サーバー設定</h1>
<div>
<p>サーバー名</p>
<input id="servername" placeholder="uwuzuさ~ば~" class="inbox" type="text" name="servername" value="<?php if( !empty(file_get_contents($servernamefile)) ){ echo htmlspecialchars(file_get_contents($servernamefile), ENT_QUOTES, 'UTF-8'); } ?>">
</div>
<div>
<p>サーバー紹介メッセージ</p>
<textarea id="serverinfo" placeholder="たのしいさーばーです" class="inbox" type="text" name="serverinfo"><?php $sinfo = explode("\n", $serverinfo); foreach ($sinfo as $info) { echo $info; }?></textarea>
</div>
<div>
<p>サーバー管理者の名前</p>
<input id="serveradminname" placeholder="わたし" class="inbox" type="text" name="serveradminname" value="<?php if( !empty(file_get_contents($adminfile)) ){ echo htmlspecialchars(file_get_contents($adminfile), ENT_QUOTES, 'UTF-8'); } ?>">
</div>
<div>
<p>サーバーへのお問い合わせ用メールアドレス</p>
<input id="servermailadds" placeholder="" class="inbox" type="text" name="servermailadds" value="<?php if( !empty(file_get_contents($contactfile)) ){ echo htmlspecialchars(file_get_contents($contactfile), ENT_QUOTES, 'UTF-8'); } ?>">
</div>
<div>
<p>招待制にするかどうか</p>
<div class="switch_button">
<?php if(file_get_contents($onlyuserfile) === "true"){?>
<input id="onlyuser" class="switch_input" type='checkbox' name="onlyuser" value="true" checked/>
<label for="onlyuser" class="switch_label"></label>
<?php }else{?>
<input id="onlyuser" class="switch_input" type='checkbox' name="onlyuser" value="true" />
<label for="onlyuser" class="switch_label"></label>
<?php }?>
</div>
</div>
<div>
<p>OpenAIによるクロールを拒否するかどうか<br>※robots.txtによりOpenAIからのクロールを拒否するものであり、他のAI企業によるクロールを完全拒否するものではございません。</p>
<div class="switch_button">
<?php if(file_get_contents($robots) === "User-agent: GPTBot\nDisallow: /"){?>
<input id="robots" class="switch_input" type='checkbox' name="robots" value="true" checked/>
<label for="robots" class="switch_label"></label>
<?php }else{?>
<input id="robots" class="switch_input" type='checkbox' name="robots" value="true" />
<label for="robots" class="switch_label"></label>
<?php }?>
</div>
</div>
<div>
<p>利用規約</p>
<textarea id="serverterms" placeholder="しっかり書きましょう" class="inbox" type="text" name="serverterms"><?php $sinfo = explode("\n", $serverterms); foreach ($sinfo as $info) { echo $info; }?></textarea>
</div>
<div>
<p>プライバシーポリシー</p>
<textarea id="serverprv" placeholder="しっかり書きましょう" class="inbox" type="text" name="serverprv"><?php $sinfo = explode("\n", $serverprv); foreach ($sinfo as $info) { echo $info; }?></textarea>
</div>
<div>
<p>サーバー停止時表示メッセージ</p>
<input id="serverstop" placeholder="現在サーバーは止まっておりません。" class="inbox" type="text" name="serverstop" value="<?php if( !empty(file_get_contents($serverstopfile)) ){ echo htmlspecialchars(file_get_contents($serverstopfile), ENT_QUOTES, 'UTF-8'); } ?>">
</div>
<input type="submit" class = "irobutton" name="btn_submit" value="保存&更新">
</form>
</div>
</div>
</main>
<?php require('../require/rightbox.php');?>
<?php require('../require/botbox.php');?>
<script>
$(document).ready(function() {
$(document).on('click', '.delbtn', function (event) {
var code = $(this).attr('del-code');
var userid = '<?php echo $userid; ?>';
var account_id = '<?php echo $loginid; ?>';
var codeElement = $(this).closest('.server_code');
$.ajax({
url: 'code_delete.php',
method: 'POST',
data: { code: code, userid: userid, account_id: account_id },
dataType: 'json',
success: function (response) {
if (response.success) {
codeElement.remove();
} else {
// 削除失敗時の処理
}
},
error: function () {
// エラー時の処理
}
});
});
});
</script>
</body>
</html>
+8
View File
@@ -0,0 +1,8 @@
<?php ?>
<div class="admin_left">
<a href="serveradmin" class="admin_leftbtn">サーバー設定</a>
<a href="useradmin" class="admin_leftbtn">ユーザー管理</a>
<a href="codeadmin" class="admin_leftbtn">招待コード発行所</a>
<a href="ad_admin" class="admin_leftbtn">広告</a>
</div>
<?php ?>
+374
View File
@@ -0,0 +1,374 @@
<?php
$servernamefile = "../server/servername.txt";
$serverinfofile = '../server/info.txt';
$serverinfo = file_get_contents($serverinfofile);
$servertermsfile = '../server/terms.txt';
$serverterms = file_get_contents($servertermsfile);
$serverprvfile = '../server/privacypolicy.txt';
$serverprv = file_get_contents($serverprvfile);
$contactfile = "../server/contact.txt";
$adminfile = "../server/admininfo.txt";
$serverstopfile = "../server/serverstop.txt";
$onlyuserfile = "../server/onlyuser.txt";
$err404imagefile = "../server/404imagepath.txt";
$robots = "../robots.txt";
function createUniqId(){
list($msec, $sec) = explode(" ", microtime());
$hashCreateTime = $sec.floor($msec*1000000);
$hashCreateTime = strrev($hashCreateTime);
return base_convert($hashCreateTime,10,36);
}
function random_code($length = 8){
return substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $length);
}
require('../db.php');
// 変数の初期化
$datetime = array();
$user_name = null;
$message = array();
$message_data = null;
$error_message = array();
$pdo = null;
$stmt = null;
$res = null;
$option = null;
session_name('uwuzu_s_id');
session_start();
session_regenerate_id(true);
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"] && $_SESSION['userid'] === $res["userid"]){
// セッションに値をセット
$userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット
$username = $_SESSION['username']; // セッションに格納されている値をそのままセット
$loginid = $res["loginid"];
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['loginid'] = $res["loginid"];
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;
}
} 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"] && $_COOKIE['userid'] === $res["userid"]){
// セッションに値をセット
$userid = $_COOKIE['userid']; // クッキーから取得した値をセット
$username = $_COOKIE['username']; // クッキーから取得した値をセット
$loginid = $res["loginid"];
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['loginid'] = $res["loginid"];
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;
}
} else {
// ログインが許可されていない場合、ログインページにリダイレクト
header("Location: ../login.php");
exit;
}
if(empty($userid)){
header("Location: ../login.php");
exit;
}
if(empty($username)){
header("Location: ../login.php");
exit;
}
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($_POST['btn_submit']) ) {
// 空白除去
$target_userid = $_POST['target_userid'];
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,
));
$rerole = $dbh->prepare("SELECT * FROM account WHERE userid = :userid");
$rerole->bindValue(':userid', $target_userid);
// SQL実行
$rerole->execute();
$userdata = $rerole->fetch(); // ここでデータベースから取得した値を $role に代入する
if(empty($userdata)){
$error_message[] = "ユーザーがいません";
}else{
$_SESSION['userdata'] = $userdata;
// リダイレクト先のURLへ転送する
$url = 'userinfo';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
}
}
if( !empty($_POST['report_done']) ) {
$report_id = $_POST['report_id'];
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,
));
$newchk = "done";
// トランザクション開始
$pdo->beginTransaction();
try {
$stmt = $pdo->prepare("UPDATE report SET admin_chk = :adchk WHERE uniqid = :uniqid");
$stmt->bindValue(':adchk', $newchk, PDO::PARAM_STR);
$stmt->bindValue(':uniqid', $report_id , PDO::PARAM_STR);
// SQLクエリの実行
$res = $stmt->execute();
// コミット
$res = $pdo->commit();
if ($res) {
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location:".$url."");
exit;
} else {
$error_message[] = '発行に失敗しました。';
}
} catch (Exception $e) {
$error_message[] = "えらー";
// エラーが発生した時はロールバック
$pdo->rollBack();
}
}
}
require('../logout/logout.php');
if(isset($_GET['q'])){
$keyword = htmlentities($_GET['q']);
}else{
$keyword = "";
}
if (!empty($pdo)) {
$sql = "SELECT * FROM report WHERE admin_chk = 'none' ORDER BY datetime DESC";
$allreport = $pdo->query($sql);
while ($row = $allreport->fetch(PDO::FETCH_ASSOC)) {
$reports[] = $row;
}
}
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/home.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<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="admin_settings">
<?php require('settings_left_menu.php');?>
<div class="admin_right">
<form class="formarea" enctype="multipart/form-data" method="post">
<h1>ユーザー管理</h1>
<div>
<p>ユーザーID</p>
<div class="p2">「@」は外してください。</div>
<input id="target_userid" placeholder="admin" class="inbox" type="text" name="target_userid" value="<?php if( !empty($keyword) ){ echo htmlspecialchars($keyword, ENT_QUOTES, 'UTF-8'); } ?>">
</div>
<input type="submit" class = "irobutton" name="btn_submit" value="検索">
<section class="inner">
<div id="postContainer">
</div>
</section>
<div id="loading" class="loading" style="display: none;">
🤔
</div>
<hr>
</form>
<div class="formarea">
<h1>通報</h1>
<?php if(!(empty($reports))){?>
<?php foreach ($reports as $value) {?>
<div class="server_code">
<details>
<summary>@<?php if( !empty($value["userid"]) ){ echo htmlentities($value["userid"]); }?></summary>
<hr>
<p>通報先アカウント名:@<?php echo htmlentities($value["userid"]);?></p>
<p>通報元アカウント名:@<?php echo htmlentities($value["report_userid"]);?></p>
<hr>
<p>通報元アカウントよりメッセージ</p>
<p><?php echo nl2br(htmlentities($value["msg"]));?></p>
<hr>
<p>通報日時:<?php echo htmlentities($value["datetime"]);?></p>
<hr>
<p>アカウント操作を行う場合は上の「ユーザーID」にアカウントをしたいユーザーIDを入れて対応してください。</p>
<form enctype="multipart/form-data" method="post">
<div class="delbox">
<p>解決ボタンを押すとこの件は解決済みとなります。</p>
<input type="text" name="report_id" value="<?php echo htmlentities($value["uniqid"]);?>" style="display:none;" >
<input type="submit" name="report_done" class="delbtn" value="解決">
</div>
</form>
</details>
</div>
<?php }?>
<?php }else{?>
<p>通報されたアカウントはありません。</p>
<?php }?>
</div>
</div>
</div>
</main>
<?php require('../require/rightbox.php');?>
<?php require('../require/botbox.php');?>
</body>
</html>
+696
View File
@@ -0,0 +1,696 @@
<?php
$servernamefile = "../server/servername.txt";
$serverinfofile = '../server/info.txt';
$serverinfo = file_get_contents($serverinfofile);
$servertermsfile = '../server/terms.txt';
$serverterms = file_get_contents($servertermsfile);
$serverprvfile = '../server/privacypolicy.txt';
$serverprv = file_get_contents($serverprvfile);
$contactfile = "../server/contact.txt";
$adminfile = "../server/admininfo.txt";
$serverstopfile = "../server/serverstop.txt";
$onlyuserfile = "../server/onlyuser.txt";
$err404imagefile = "../server/404imagepath.txt";
$robots = "../robots.txt";
function createUniqId(){
list($msec, $sec) = explode(" ", microtime());
$hashCreateTime = $sec.floor($msec*1000000);
$hashCreateTime = strrev($hashCreateTime);
return base_convert($hashCreateTime,10,36);
}
function random_code($length = 8){
return substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $length);
}
require('../db.php');
// 変数の初期化
$datetime = array();
$user_name = null;
$message = array();
$message_data = null;
$error_message = array();
$pdo = null;
$stmt = null;
$res = null;
$option = null;
session_name('uwuzu_s_id');
session_start();
session_regenerate_id(true);
$userdata = $_SESSION['userdata'];
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"] && $_SESSION['userid'] === $res["userid"]){
// セッションに値をセット
$userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット
$username = $_SESSION['username']; // セッションに格納されている値をそのままセット
$loginid = $res["loginid"];
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['loginid'] = $res["loginid"];
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;
}
} 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"] && $_COOKIE['userid'] === $res["userid"]){
// セッションに値をセット
$userid = $_COOKIE['userid']; // クッキーから取得した値をセット
$username = $_COOKIE['username']; // クッキーから取得した値をセット
$loginid = $res["loginid"];
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['loginid'] = $res["loginid"];
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;
}
} else {
// ログインが許可されていない場合、ログインページにリダイレクト
header("Location: ../login.php");
exit;
}
if(empty($userid)){
header("Location: ../login.php");
exit;
}
if(empty($username)){
header("Location: ../login.php");
exit;
}
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)) {
$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,
));
$roles = explode(',', $userdata["role"]);
$roleDataArray = array();
foreach ($roles as $roleId) {
$rerole = $dbh->prepare("SELECT rolename, roleauth, rolecolor FROM role WHERE roleidname = :role");
$rerole->bindValue(':role', $roleId);
$rerole->execute();
$roleDataArray[$roleId] = $rerole->fetch();
}
$followIds = explode(',', $userdata['follow']);
$followCount = count($followIds)-1;
$followerIds = explode(',', $userdata['follower']);
$followerCount = count($followerIds)-1;
$result = $dbh->prepare("SELECT ueuse FROM ueuse WHERE account = :userid ORDER BY datetime");
$result->bindValue(':userid', $userdata["userid"]);
$result->execute();
$upload_cnt1 = $result->rowCount();
}
if( !empty($_POST['send_ice_submit']) ) {
$notice_msg = $_POST['notice_msg'];
$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,
));
$newrole = "ice";
$newtoken = "ice";
$newadmin = "user";
// トランザクション開始
$pdo->beginTransaction();
try {
$touserid = htmlentities($userdata['userid'], ENT_QUOTES, 'UTF-8');
// SQL作成
$stmt = $pdo->prepare("UPDATE account SET role = :role,token = :newtoken,admin = :newadmin WHERE userid = :userid");
$stmt->bindValue(':role', $newrole, PDO::PARAM_STR);
$stmt->bindValue(':newtoken', $newtoken, PDO::PARAM_STR);
$stmt->bindValue(':newadmin', $newadmin, PDO::PARAM_STR);
$stmt->bindValue(':userid', $touserid, PDO::PARAM_STR);
// SQLクエリの実行
$res = $stmt->execute();
// コミット
$res = $pdo->commit();
} catch (Exception $e) {
// エラーが発生した時はロールバック
$pdo->rollBack();
}
$pdo->beginTransaction();
try {
$touserid = htmlentities($userdata['userid'], ENT_QUOTES, 'UTF-8');
$datetime = date("Y-m-d H:i:s");
$msg = "サービス管理者からのメッセージは以下のものです。\n" . $notice_msg . "\n異議申し立てする場合は連絡用メールに異議申し立てをする旨を記載し送信をしてください。";
$title = "🧊お使いのアカウントは凍結されました。🧊";
$url = "/rule/serverabout";
$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 ($res) {
header("Location:useradmin");
exit;
} else {
$error_message[] = '凍結に失敗しました。';
}
}
if( !empty($_POST['send_water_submit']) ) {
$newrole = "user";
$newtoken = "";
$newadmin = "user";
// トランザクション開始
$pdo->beginTransaction();
try {
$touserid = htmlentities($userdata['userid'], ENT_QUOTES, 'UTF-8');
// SQL作成
$stmt = $pdo->prepare("UPDATE account SET role = :role,token = :newtoken,admin = :newadmin WHERE userid = :userid");
$stmt->bindValue(':role', $newrole, PDO::PARAM_STR);
$stmt->bindValue(':newtoken', $newtoken, PDO::PARAM_STR);
$stmt->bindValue(':newadmin', $newadmin, PDO::PARAM_STR);
$stmt->bindValue(':userid', $touserid, PDO::PARAM_STR);
// SQLクエリの実行
$res = $stmt->execute();
// コミット
$res = $pdo->commit();
} catch (Exception $e) {
$error_message[] = "えらー";
// エラーが発生した時はロールバック
$pdo->rollBack();
}
$pdo->beginTransaction();
try {
$touserid = htmlentities($userdata['userid'], ENT_QUOTES, 'UTF-8');
$datetime = date("Y-m-d H:i:s");
$msg = "サービス管理者によりお使いのアカウントは解凍されました!\n今まで通りご利用いただけます。\nまた、APIを使用している方はAPIのトークンがリセットされているため再度トークンを発行してご利用ください。";
$title = "🫗お使いのアカウントが解凍されました!🫗";
$url = "/home";
$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) {
$error_message[] = "えらー";
// エラーが発生した時はロールバック
$pdo->rollBack();
}
if ($res) {
header("Location:useradmin");
exit;
} else {
$error_message[] = '解凍に失敗しました。';
}
}
if( !empty($_POST['send_ban_submit']) ) {
$userId2 = $userdata['userid']; // 削除対象のユーザーID
$folderPath = "../ueuseimages/"; // フォルダのパス
// 指定したフォルダ内でユーザーIDを含むファイルを検索
$filesToDelete = glob($folderPath . "*-$userId2.*"); // 「-ユーザーID.拡張子」というパターンを検索
// ファイルを順に削除
foreach ($filesToDelete as $file) {
if (is_file($file)) {
unlink($file); // ファイルを削除
}
}
$folderPath2 = "../ueusevideos/"; // フォルダのパス
// 指定したフォルダ内でユーザーIDを含むファイルを検索
$filesToDelete2 = glob($folderPath2 . "*-$userId2.*"); // 「-ユーザーID.拡張子」というパターンを検索
// ファイルを順に削除
foreach ($filesToDelete2 as $file2) {
if (is_file($file2)) {
unlink($file2); // ファイルを削除
}
}
$folderPath3 = "../usericons/"; // フォルダのパス
// 指定したフォルダ内でユーザーIDを含むファイルを検索
$filesToDelete3 = glob($folderPath3 . "*-$userId2.*"); // 「-ユーザーID.拡張子」というパターンを検索
// ファイルを順に削除
foreach ($filesToDelete3 as $file3) {
if (is_file($file3)) {
unlink($file3); // ファイルを削除
}
}
$folderPath4 = "../userheads/"; // フォルダのパス
// 指定したフォルダ内でユーザーIDを含むファイルを検索
$filesToDelete4 = glob($folderPath4 . "*-$userId2.*"); // 「-ユーザーID.拡張子」というパターンを検索
// ファイルを順に削除
foreach ($filesToDelete4 as $file4) {
if (is_file($file4)) {
unlink($file4); // ファイルを削除
}
}
try {
$pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS);
// 投稿削除クエリを実行
$deleteQuery = $pdo->prepare("DELETE FROM ueuse WHERE account = :userid");
$deleteQuery->bindValue(':userid', $userId2, PDO::PARAM_STR);
$res = $deleteQuery->execute();
// アカウント削除クエリを実行
$deleteQuery = $pdo->prepare("DELETE FROM account WHERE userid = :userid");
$deleteQuery->bindValue(':userid', $userId2, PDO::PARAM_STR);
$res = $deleteQuery->execute();
// 通知削除クエリを実行
$deleteQuery = $pdo->prepare("DELETE FROM notification WHERE touserid = :touserid");
$deleteQuery->bindValue(':touserid', $userId2, PDO::PARAM_STR);
$res = $deleteQuery->execute();
// フォローの更新
$updateFollowQuery = $pdo->prepare("UPDATE account SET follow = REPLACE(follow, :userid, '') WHERE follow LIKE :pattern");
$updateFollowQuery->bindValue(':userid', ",$userId2", PDO::PARAM_STR);
$updateFollowQuery->bindValue(':pattern', "%,$userId2%", PDO::PARAM_STR);
$updateFollowQuery->execute();
// フォロワーの更新
$updateFollowerQuery = $pdo->prepare("UPDATE account SET follower = REPLACE(follower, :userid, '') WHERE follower LIKE :pattern");
$updateFollowerQuery->bindValue(':userid', ",$userId2", PDO::PARAM_STR);
$updateFollowerQuery->bindValue(':pattern', "%,$userId2%", PDO::PARAM_STR);
$updateFollowerQuery->execute();
// いいねの更新
$updateFavoriteQuery = $pdo->prepare("UPDATE ueuse SET favorite = REPLACE(favorite, :favorite, '') WHERE favorite LIKE :pattern");
$updateFavoriteQuery->bindValue(':favorite', ",$userId2", PDO::PARAM_STR);
$updateFavoriteQuery->bindValue(':pattern', "%,$userId2%", PDO::PARAM_STR);
$updateFavoriteQuery->execute();
} catch (Exception $e) {
// エラーが発生した時はロールバック
$pdo->rollBack();
}
if ($res) {
header("Location:useradmin");
exit;
} else {
$error_message[] = 'アカウント削除に失敗しました。';
}
// プリペアドステートメントを削除
$stmt = null;
}
require('../logout/logout.php');
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/home.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<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="admin_settings">
<?php require('settings_left_menu.php');?>
<div class="admin_right">
<div class="admin_userinfo">
<div class="icon">
<img src="<?php echo htmlentities('../'.$userdata['iconname']); ?>">
<div class="tatext">
<h2><?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?></h2>
<p>@<?php echo htmlentities($userdata['userid'], ENT_QUOTES, 'UTF-8'); ?></p>
</div>
</div>
<div class="roleboxes">
<?php foreach ($roles as $roleId): ?>
<?php $roleData = $roleDataArray[$roleId]; ?>
<div class="rolebox" style="border: 1px solid <?php echo '#' . $roleData["rolecolor"]; ?>;">
<p style="color: <?php echo '#' . $roleData["rolecolor"]; ?>;">
<?php if (!empty($roleData["rolename"])) { echo htmlentities($roleData["rolename"], ENT_QUOTES, 'UTF-8'); } ?>
</p>
</div>
<?php endforeach; ?>
</div>
<div class="profile">
<div class="p2">プロフィール</div>
<p><?php echo nl2br(htmlspecialchars($userdata["profile"], ENT_QUOTES, 'UTF-8')); ?></p>
</div>
<hr>
<div class="about">
<div class="p2">メールアドレス</div>
<p><?php if( !empty($userdata["mailadds"]) ){ echo htmlspecialchars($userdata["mailadds"], ENT_QUOTES, 'UTF-8'); }else{echo "未設定";} ?></p>
<hr>
<div class="p2">二段階認証</div>
<p><?php if( !empty($userdata["authcode"]) ){ echo "設定済み";}else{echo "未設定";} ?></p>
<hr>
<div class="p2">管理者権限</div>
<p><?php if( !empty($userdata["admin"] === "yes") ){ echo "あり";}else{echo "なし";} ?></p>
<hr>
<div class="p2">フォロー数</div>
<p><?php if( $followCount > 0 ){ echo htmlspecialchars($followCount, ENT_QUOTES, 'UTF-8');}else{echo "なし";} ?></p>
<div class="p2">フォロワー数</div>
<p><?php if( $followerCount > 0 ){ echo htmlspecialchars($followerCount, ENT_QUOTES, 'UTF-8');}else{echo "なし";} ?></p>
<hr>
<div class="p2">投稿数</div>
<p><?php if( $upload_cnt1 > 0 ){ echo $upload_cnt1;}else{echo "なし";} ?></p>
<hr>
<div class="p2">アカウント登録日時</div>
<p><?php echo htmlspecialchars($userdata["datetime"], ENT_QUOTES, 'UTF-8'); ?></p>
<hr>
<div class="p2">アカウント操作</div>
<div class="banzone">
<?php if($roleId === "ice"){?>
<button id="water" class="waterbtn">解凍</button>
<?php }else{?>
<button id="ice" class="icebtn">凍結</button>
<?php }?>
<button id="ban" class="banbtn">BAN</button>
</div>
</div>
</div>
</div>
</div>
<div id="account_IceModal" class="modal">
<div class="modal-content">
<h1>このアカウントを凍結しますか?</h1>
<p><?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんのアカウントを凍結しますか?<br>凍結すると<?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんは以下のことができなくなります。<br>・投稿<br>・追記<br>・フォロー<br>・返信<br>・管理者権限の利用(管理者権限を持っていた場合)<br>・APIの使用(トークンがリセットされます)<br>また、以下の欄に入力した内容が個別メッセージとして通知欄に表示されます。<br><?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんは異議申し立てが可能です。</p>
<form method="post" id="deleteForm">
<textarea id="notice_msg" placeholder="<?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんへのメッセージ" name="notice_msg"></textarea>
<div class="btn_area">
<input type="submit" id="deleteButton" class="fbtn_no" name="send_ice_submit" value="凍結">
<input type="button" id="cancelButton" class="fbtn" value="キャンセル">
</div>
</form>
</div>
</div>
<div id="account_BanModal" class="modal">
<div class="modal-content">
<h1>このアカウントをBANしますか?</h1>
<p><?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんのアカウントをBANしますか?<br>BANすると<?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんのアカウントとは削除されます。<br>また、以下のデータも削除されます。<br>・アカウントに紐づいている画像や写真データ<br>・投稿<br>・フォロー情報やいいね情報<br>・APIトークン<br>・アカウントのメールアドレス<br>・その他アカウントに関連している情報<br>また、すぐに削除されるため本人に削除通知を送ることは出来ません。<br><?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんのアカウントを削除する場合は「BAN」を押してください。<br>アカウントの復旧は出来ません。</p>
<form class="btn_area" method="post" id="deleteForm">
<input type="submit" id="deleteButton2" class="fbtn_no" name="send_ban_submit" value="BAN">
<input type="button" id="cancelButton2" class="fbtn" value="キャンセル">
</form>
</div>
</div>
<div id="account_WaterModal" class="modal">
<div class="modal-content">
<h1>このアカウントを解凍しますか?</h1>
<p><?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんのアカウントを解凍しますか?<br>凍結すると<?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんは今まで通りアカウントを使用できます。</p>
<form method="post" id="deleteForm">
<div class="btn_area">
<input type="submit" id="deleteButton3" class="fbtn_no" name="send_water_submit" value="解凍">
<input type="button" id="cancelButton3" class="fbtn" value="キャンセル">
</div>
</form>
</div>
</div>
</main>
<?php require('../require/rightbox.php');?>
<?php require('../require/botbox.php');?>
</body>
<script>
$(document).ready(function() {
var modal3 = document.getElementById('account_WaterModal');
var deleteButton3 = document.getElementById('deleteButton3');
var cancelButton3 = document.getElementById('cancelButton3'); // 追加
var modalMain = $('.modal-content');
$(document).on('click', '.waterbtn', function (event) {
modal3.style.display = 'block';
modalMain.addClass("slideUp");
modalMain.removeClass("slideDown");
deleteButton3.addEventListener('click', () => {
modalMain.removeClass("slideUp");
modalMain.addClass("slideDown");
window.setTimeout(function(){
modal3.style.display = 'none';
}, 150);
});
cancelButton3.addEventListener('click', () => { // 追加
modalMain.removeClass("slideUp");
modalMain.addClass("slideDown");
window.setTimeout(function(){
modal3.style.display = 'none';
}, 150);
});
});
var modal = document.getElementById('account_IceModal');
var deleteButton = document.getElementById('deleteButton');
var cancelButton = document.getElementById('cancelButton'); // 追加
var modalMain = $('.modal-content');
$(document).on('click', '.icebtn', function (event) {
modal.style.display = 'block';
modalMain.addClass("slideUp");
modalMain.removeClass("slideDown");
deleteButton.addEventListener('click', () => {
modalMain.removeClass("slideUp");
modalMain.addClass("slideDown");
window.setTimeout(function(){
modal.style.display = 'none';
}, 150);
});
cancelButton.addEventListener('click', () => { // 追加
modalMain.removeClass("slideUp");
modalMain.addClass("slideDown");
window.setTimeout(function(){
modal.style.display = 'none';
}, 150);
});
});
var modal2 = document.getElementById('account_BanModal');
var deleteButton2 = document.getElementById('deleteButton2');
var cancelButton2 = document.getElementById('cancelButton2'); // 追加
var modalMain = $('.modal-content');
$(document).on('click', '.banbtn', function (event) {
modal2.style.display = 'block';
modalMain.addClass("slideUp");
modalMain.removeClass("slideDown");
deleteButton2.addEventListener('click', () => {
modalMain.removeClass("slideUp");
modalMain.addClass("slideDown");
window.setTimeout(function(){
modal2.style.display = 'none';
}, 150);
});
cancelButton2.addEventListener('click', () => { // 追加
modalMain.removeClass("slideUp");
modalMain.addClass("slideDown");
window.setTimeout(function(){
modal2.style.display = 'none';
}, 150);
});
});
});
</script>
</html>