diff --git a/admin/addadmin.php b/admin/addadmin.php new file mode 100644 index 0000000..0d85c4d --- /dev/null +++ b/admin/addadmin.php @@ -0,0 +1,570 @@ + 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(); +} + +$aduser = "yes"; + +$options = array( + // SQL実行失敗時に例外をスルー + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + // デフォルトフェッチモードを連想配列形式に設定 + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + // バッファードクエリを使う(一度に結果セットを全て取得し、サーバー負荷を軽減) + // SELECTで得た結果に対してもrowCountメソッドを使えるようにする + PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, +); + +$dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + +$query = $dbh->prepare('SELECT * FROM account WHERE admin = :adminuser limit 1'); + +$query->execute(array(':adminuser' => $aduser)); + +$result2 = $query->fetch(); + +if($result2 > 0){ + header("Location: ../login.php"); + exit; +} + + + +if( !empty($_POST['btn_submit']) ) { + + + //$row['userid'] = "daichimarukn"; + + // 空白除去 + $username = $_POST['username']; + $userid = $_POST['userid']; + + $password = $_POST['password']; + $chkpass = $_POST['chkpass']; + $mailadds = $_POST['mailadds']; + + $profile = $_POST['profile']; + + if($onlyuser === "true"){ + $invitationcode = $_POST['invitationcode']; + } + + //cookieに保存 + setcookie("username",$username,time()+60*60*24*14); + setcookie("userid",$userid,time()+60*60*24*14); + + setcookie("password",$password,time()+60*60*24*14); + setcookie("mailadds",$mailadds,time()+60*60*24*14); + + setcookie("profile",$profile,time()+60*60*24*14); + + //----------------[icon image]------------------------------- + if (empty($_FILES['image']['name'])) { + $localFilePathhead = '../img/deficon/icon.png'; + + // 新しいファイル名を生成(uniqid + 拡張子) + $newFilename = uniqid() . '-'.$userid.'.png'; + + // 保存先のパスを生成 + $uploadedPath = 'usericons/' . $newFilename; + + // ファイルを移動 + $result = copy($localFilePathhead, '../'.$uploadedPath); + + if ($result) { + $iconName = $uploadedPath; // 保存されたファイルのパスを使用 + } else { + $errnum = $uploadedFile['error']; + if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} + if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} + if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} + if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} + if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} + if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} + if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} + $error_message[] = 'アップロード失敗!(1)エラーコード:' .$uploadedFile['error'].''; + } + + } else { + // アップロードされたファイル情報 + $uploadedFile = $_FILES['image']; + + // アップロードされたファイルの拡張子を取得 + $extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION); + + // 新しいファイル名を生成(uniqid + 拡張子) + $newFilename = uniqid() . '-'.$userid.'.' . $extension; + + // 保存先のパスを生成 + $uploadedPath = 'usericons/' . $newFilename; + + // ファイルを移動 + $result = move_uploaded_file($uploadedFile['tmp_name'], '../'.$uploadedPath); + + if ($result) { + $iconName = $uploadedPath; // 保存されたファイルのパスを使用 + } else { + $errnum = $uploadedFile['error']; + if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} + if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} + if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} + if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} + if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} + if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} + if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} + $error_message[] = 'アップロード失敗!(1)エラーコード:' .$uploadedFile['error'].''; + } + } + + //----------------[header image]------------------------------- + $localFilePathhead = '../img/defhead/head.png'; + + // 新しいファイル名を生成(uniqid + 拡張子) + $newFilename = uniqid() . '-'.$userid.'.png'; + + // 保存先のパスを生成 + $uploadedPath = 'userheads/' . $newFilename; + + // ファイルを移動 + $result = copy($localFilePathhead, '../'.$uploadedPath); + + if ($result) { + $headName = $uploadedPath; // 保存されたファイルのパスを使用 + } else { + $errnum = $uploadedFile['error']; + if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} + if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} + if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} + if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} + if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} + if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} + if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} + $error_message[] = 'アップロード失敗!(2)エラーコード:' .$uploadedFile['error'].''; + } + + + + $options = array( + // SQL実行失敗時に例外をスルー + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + // デフォルトフェッチモードを連想配列形式に設定 + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + // バッファードクエリを使う(一度に結果セットを全て取得し、サーバー負荷を軽減) + // SELECTで得た結果に対してもrowCountメソッドを使えるようにする + PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, + ); + + $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + + if($onlyuser === "true"){ + $query = $dbh->prepare('SELECT * FROM invitation WHERE code = :code limit 1'); + + $query->execute(array(':code' => $invitationcode)); + + $result = $query->fetch(); + + // 招待コードの入力チェック + if( empty($invitationcode) ) { + $error_message[] = '招待コードを入力してください。'; + } else { + if($result > 0){ + if($result["used"] === "true"){ + $error_message[] = 'この招待コード('.$invitationcode.')は既に使用されています。'; + } + }else{ + $error_message[] = 'この招待コード('.$invitationcode.')は使えません。'; + } + + } + } + + + $query = $dbh->prepare('SELECT * FROM account WHERE userid = :userid limit 1'); + + $query->execute(array(':userid' => $userid)); + + $result = $query->fetch(); + + + // ユーザーネームの入力チェック + if( empty($username) ) { + $error_message[] = '表示名を入力してください。'; + } else { + // 文字数を確認 + if( 25 < mb_strlen($username, 'UTF-8') ) { + $error_message[] = 'ユーザーネームは25文字以内で入力してください。'; + } + } + + // IDの入力チェック + if( empty($userid) ) { + $error_message[] = 'ユーザーIDを入力してください。'; + } else { + + // 文字数を確認 + if( 20 < mb_strlen($userid, 'UTF-8') ) { + $error_message[] = 'IDは20文字以内で入力してください。'; + } + + if($result > 0){ + $error_message[] = 'このID('.$userid.')は既に使用されています。他のIDを作成してください。'; //このE-mailは既に使用されています。 + } + + } + + // パスワードの入力チェック + if( empty($password) ) { + $error_message[] = 'パスワードを入力してください。'; + } else { + + $weakPasswords = array( + "password", + "123456", + "123456789", + "12345", + "12345678", + "123123", + "1234567890", + "1234567", + "1q2w3e", + "qwerty123", + "aa12345678", + "password1", + "1234", + "qwertyuiop", + "123321", + "12321", + "qwertyui", + "abcd1234", + "zaq12wsx", + "1q2w3e4r", + "qwer1234", + "sakura", + "asdf1234", + "asdfghjkl", + "asdfghjk", + "member", + "1qaz2wsx", + "doraemon", + "makoto", + "takeshi", + "machi1", + "machida", + "machida1", + "tokyo", + "arashi", + "dropbox", + "twitter", + "elonmusk", + "xcorp", + "1234qwer", + "japan", + "nippon", + "tukareta", + "tweet", + "discord", + "misskey", + "qwerty", + "123456789", + "abc123", + "password123", + "admin", + "letmein", + "iloveyou", + "111111", + "12345678910", + "user", + "root", + "system", + // 他にも弱いパスワードを追加できます + ); + + function isWeakPassword($passwords) { + global $weakPasswords; + return in_array($passwords, $weakPasswords); + } + + // テスト用のパスワード(実際にはユーザー入力などから取得することになります。 + + if (isWeakPassword($password)) { + $error_message[] = "パスワードが弱いです。セキュリティ上変更してください。"; + } else { + + } + + if ($chkpass == $password ){ + + }else{ + $error_message[] = '確認用パスワードが違います。'; + } + + if( 4 > mb_strlen($password, 'UTF-8') ) { + $error_message[] = 'パスワードは4文字以上である必要があります。'; + } + + // 文字数を確認 + if( 100 < mb_strlen($password, 'UTF-8') ) { + $error_message[] = 'パスワードは100文字以内で入力してください。'; + } + } + + if( empty($error_message) ) { + // トランザクション開始 + $pdo->beginTransaction(); + $datetime = date("Y-m-d H:i:s"); + + try { + + $role = "official"; + $admin = "yes"; + $hashpassword = password_hash($password, PASSWORD_DEFAULT); + $loginid = sha1(uniqid(mt_rand(), true)); + + // SQL作成 + $stmt = $pdo->prepare("INSERT INTO account (username, userid, password, loginid, mailadds, profile, iconname, headname, role, datetime, admin) VALUES (:username, :userid, :password, :loginid, :mailadds, :profile, :iconname, :headname, :role, :datetime, :admin )"); + + // アイコン画像 + $stmt->bindValue(':iconname', $iconName, PDO::PARAM_STR); + + // ヘッダー画像 + $stmt->bindValue(':headname', $headName, PDO::PARAM_STR); + + // 他の値をセット + $stmt->bindParam(':username', $username, PDO::PARAM_STR); + $stmt->bindParam(':userid', $userid, PDO::PARAM_STR); + $stmt->bindParam(':password', $hashpassword, PDO::PARAM_STR); + $stmt->bindParam(':loginid', $loginid, PDO::PARAM_STR); + $stmt->bindParam(':mailadds', $mailadds, PDO::PARAM_STR); + $stmt->bindParam(':profile', $profile, PDO::PARAM_STR); + $stmt->bindParam(':role', $role, PDO::PARAM_STR); + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + + $stmt->bindParam(':admin', $admin, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + + if($onlyuser === "true"){ + $pdo->beginTransaction(); + + $stmt = $pdo->prepare("UPDATE invitation SET used = :used, datetime = :datetime WHERE code = :code;"); + + $true = "true"; + $stmt->bindParam(':used', $true, PDO::PARAM_STR); + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + + $stmt->bindValue(':code', $invitationcode, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + } + + } catch (Exception $e) { + + // エラーが発生した時はロールバック + $pdo->rollBack(); + } + + if ($res) { + // リダイレクト先のURLへ転送する + $_SESSION['userid'] = $userid; + $url = 'success'; + header('Location: ' . $url, true, 303); + + // すべての出力を終了 + exit; + } else { + $error_message[] = '登録に失敗しました。'; + } + + // プリペアドステートメントを削除 + $stmt = null; + } +} + +// データベースの接続を閉じる +$pdo = null; + +?> + + + + + + + + +管理者アカウント登録 - <?php echo file_get_contents($servernamefile);?> + + + + + + + +
+ + +
+

アカウント登録

+ +

アカウント登録です。

+

必須項目には「*」があります。 + + +

+ + +
+ +
+
+ +
+ +
+ + + + +
+

ユーザーネーム *

+
プロフィールページに掲載され公開されます。
※サービス管理者が確認できます。
+ +
+
+

ユーザーID *

+
後から変更はできません。
プロフィールページに掲載され公開されます。
※サービス管理者が確認できます。
+ +
+ +
+

パスワード *

+
ログイン時に必要となります。
※サービス管理者が確認できません。
+ +
+ +
+

パスワード再確認 *

+ +
+ +
+

メールアドレス

+
設定しておくとアカウント復旧に利用できます。
※サービス管理者が確認できます。
+ +
+ +
+

プロフィール

+
プロフィールページに掲載され公開されます。
※サービス管理者が確認できます。
+ +
+ +
+

招待コード

+
招待コードがないとこのサーバーには登録できません。
+ +
+ + + + +
+ +
+ 戻る +
+
+ +
+ + + + + + + + \ No newline at end of file diff --git a/admin/back.js b/admin/back.js new file mode 100644 index 0000000..62411ca --- /dev/null +++ b/admin/back.js @@ -0,0 +1,6 @@ + +window.onload = function(){ +var ele = document.getElementsByTagName("body")[0]; +var n = Math.floor(Math.random() * 3); // 3枚の画像がある場合 +ele.style.backgroundImage = "url(../img/titleimg/"+n+".png)"; +} diff --git a/admin/index.php b/admin/index.php new file mode 100644 index 0000000..a8a9fb8 --- /dev/null +++ b/admin/index.php @@ -0,0 +1,162 @@ + 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(); +} + +$aduser = "yes"; + +$options = array( + // SQL実行失敗時に例外をスルー + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + // デフォルトフェッチモードを連想配列形式に設定 + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + // バッファードクエリを使う(一度に結果セットを全て取得し、サーバー負荷を軽減) + // SELECTで得た結果に対してもrowCountメソッドを使えるようにする + PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, +); + +$dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + +$query = $dbh->prepare('SELECT * FROM account WHERE admin = :adminuser limit 1'); + +$query->execute(array(':adminuser' => $aduser)); + +$result2 = $query->fetch(); + +if($result2 > 0){ + header("Location: ../login.php"); + exit; +} + +// データベースの接続を閉じる +$pdo = null; + +?> + + + + + + + + +uwuzuへようこそ!!! - <?php echo file_get_contents($servernamefile);?> + + + + + + + +
+ + +
+

uwuzuへようこそ!!!

+ + + + + +

おめでとうございます!!!

+

uwuzuの導入が完了しました!

+

これより管理者アカウントの登録を行います。
userロールとofficialロールの設定はお済みですか?
userロールとofficialロールがないとuwuzuは正しく動作しないので設定をしていない方は一度このページを閉じて設定してください!
また、php.iniよりGDの有効化または導入はお済みですか?GDがないとuwuzuは二段階認証が正しく動作しないため絶対に設定してください!

+ +

uwuzu
Version :

+
+ 次へ +
+
+ +
+ + + + + + + + \ No newline at end of file diff --git a/admin/success.php b/admin/success.php new file mode 100644 index 0000000..42f355e --- /dev/null +++ b/admin/success.php @@ -0,0 +1,114 @@ + 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(); +} + +$aduser = "yes"; + +$options = array( + // SQL実行失敗時に例外をスルー + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + // デフォルトフェッチモードを連想配列形式に設定 + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + // バッファードクエリを使う(一度に結果セットを全て取得し、サーバー負荷を軽減) + // SELECTで得た結果に対してもrowCountメソッドを使えるようにする + PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, +); + +$dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + +$query = $dbh->prepare('SELECT * FROM account WHERE admin = :adminuser limit 1'); + +$query->execute(array(':adminuser' => $aduser)); + +$result2 = $query->fetch(); + +if($result2 > 0){ + header("Location: ../login.php"); + exit; +} + +$servernamefile = "../server/servername.txt"; +if(!(empty($_SESSION['backupcode']))){ + $backupcode = $_SESSION['backupcode']; +}else{ + $backupcode = null; +} +?> + + + + + + + + + + +アカウント登録完了!!! - <?php echo file_get_contents($servernamefile);?> + + + + + + + +
+ + +
+

アカウント作成完了!

+


いぇ~い!

+

88888888888

+

管理者アカウントの登録が完了しました!

+

以下のログインボタンよりログインしてください!
ログイン後は画面左側メニューの「サーバー設定」よりサーバーの情報を設定することをおすすめします!
また、左側メニューの「設定」から二段階認証の設定をすることもおすすめします。

+ + +
+
+ + + + \ No newline at end of file diff --git a/css/home.css b/css/home.css index 2938029..9f0f517 100644 --- a/css/home.css +++ b/css/home.css @@ -2189,8 +2189,19 @@ label>input { line-height: 20px; } +.terms .err404{ + text-align: center; +} + +.terms .err404 img{ + height: 25dvh; + text-align: center; + margin-left: auto; + margin-right: auto; +} + .terms .err404 h1{ - margin-top: 256px; + margin-top: 64px; line-height:64px; font-family: 'BIZ UDPGothic', sans-serif; font-weight: bold; @@ -2935,6 +2946,91 @@ hr{ font-weight: normal; margin-bottom: 6px; } + +.switch_input { + position: absolute; + left: 0; + top: 0; + width: 64%; + height: 64%; + z-index: 5; + opacity: 0; + cursor: pointer; +} +.switch_label { + width: 48px; + height: 24px; + background: #ccc; + position: relative; + display: inline-block; + border-radius: 25px; + transition: 0.4s; + box-sizing: border-box; +} +.switch_label:after { + content: ""; + position: absolute; + margin-top: 2px; + margin-left: 2px; + width: 20px; + height: 20px; + border-radius: 50%; + left: 0; + top: 0; + z-index: 2; + background: #fff; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); + transition: 0.2s; +} +.switch_input:checked + .switch_label { + background-color: #FFC832; +} +.switch_input:checked + .switch_label:after { + left: 24px; +} +.switch_button { + position: relative; + width: 75px; + height: 35px; + margin-left: 0px; +} + +.server_code{ + animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards; + margin-top: 12px; + margin-bottom: 12px; + border-radius: 10px; + padding-left: 12px; + padding-right: 12px; + padding-top: 8px; + padding-bottom: 8px; + background-color: #F5F5F5; + border: 1px solid #EEE; + width: auto; +} +.server_code h1{ + margin-top: 4px; + margin-bottom: 4px; + text-align: left; + color:#252525; + font-family: 'BIZ UDGothic', sans-serif; + word-wrap: break-word; + font-size: 22px; + line-height: 22px; + font-weight: bold; +} +.server_code p{ + margin-top: 4px; + margin-bottom: 4px; + text-align: left; + color:#252525; + font-family: 'BIZ UDGothic', sans-serif; + word-wrap: break-word; + font-size: 16px; + line-height: 22px; + font-weight: bold; +} + /*------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------スマホ向け--------------------------------------------------*/ /*--------------------------------------------------ここから--------------------------------------------------*/ @@ -3052,6 +3148,9 @@ hr{ } .sendbox label{ + display: block; + flex-shrink: 0; + text-align: center; width:10%; padding: 8px auto; margin-left: 6px; @@ -4425,6 +4524,27 @@ hr{ color:#FF4444; } + + .server_code{ + animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards; + margin-top: 12px; + margin-bottom: 12px; + border-radius: 10px; + padding-left: 12px; + padding-right: 12px; + padding-top: 8px; + padding-bottom: 8px; + background-color: #0c0c0c; + border: 1px solid #EEE; + width: auto; + } + .server_code h1{ + color: #CCC; + } + .server_code p{ + color: #CCC; + } + .terms{ background-color: #0c0c0c; diff --git a/errorpage/404.php b/errorpage/404.php index 3fdaca4..2563107 100644 --- a/errorpage/404.php +++ b/errorpage/404.php @@ -1,6 +1,10 @@
+ + +

404 Not found

申し訳ございませんがお探しのページは見つかりませんでした!
ページの移動や削除が行われた可能性がございます。

diff --git a/errorpage/503.php b/errorpage/503.php index 6eb5011..a90d7e5 100644 --- a/errorpage/503.php +++ b/errorpage/503.php @@ -1,6 +1,11 @@
+ + +

503 Service Unavailable

(´。_。`;)< サーバーに過負荷がかかっているようです...
時間をおいてから再度アクセスしてください!

diff --git a/img/sysimage/menuicon/server.svg b/img/sysimage/menuicon/server.svg new file mode 100644 index 0000000..b5d34be --- /dev/null +++ b/img/sysimage/menuicon/server.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/require/leftbox.php b/require/leftbox.php index e2723d9..903061c 100644 --- a/require/leftbox.php +++ b/require/leftbox.php @@ -20,6 +20,7 @@
絵文字登録 お知らせ配信 + サーバー設定
diff --git a/server/404imagepath.txt b/server/404imagepath.txt new file mode 100644 index 0000000..e69de29 diff --git a/server/503imagepath.txt b/server/503imagepath.txt new file mode 100644 index 0000000..e69de29 diff --git a/server/admininfo.txt b/server/admininfo.txt index 62573b3..e69de29 100644 --- a/server/admininfo.txt +++ b/server/admininfo.txt @@ -1 +0,0 @@ -TEST/@test \ No newline at end of file diff --git a/server/contact.txt b/server/contact.txt index beef183..e69de29 100644 --- a/server/contact.txt +++ b/server/contact.txt @@ -1 +0,0 @@ -test@test.com \ No newline at end of file diff --git a/server/info.txt b/server/info.txt index ede6a13..e69de29 100644 --- a/server/info.txt +++ b/server/info.txt @@ -1,3 +0,0 @@ -XXXXへようこそ! -XXXXはuwuzu~~~~~~~~~ -とりあえず適当に書いてみよう! \ No newline at end of file diff --git a/server/privacypolicy.txt b/server/privacypolicy.txt index 9e1c9b5..e69de29 100644 --- a/server/privacypolicy.txt +++ b/server/privacypolicy.txt @@ -1 +0,0 @@ -ここもしっかり書こう \ No newline at end of file diff --git a/server/servername.txt b/server/servername.txt index 650af7e..e69de29 100644 --- a/server/servername.txt +++ b/server/servername.txt @@ -1 +0,0 @@ -tesutoさば \ No newline at end of file diff --git a/server/uwuzuabout.txt b/server/uwuzuabout.txt index 29a1a8b..f20ded2 100644 --- a/server/uwuzuabout.txt +++ b/server/uwuzuabout.txt @@ -28,13 +28,16 @@ uwuzuはPHPとJS、HTML(プログラミング言語じゃないか)、CSSで作 ライブラリはjQueryを導入しています! ## 5. サーバーの建て方 -※MySQLの設定結構めんどいです。 まず、Apache2とPHP 8とmysql Ver 15が導入されているサーバーを準備します! PHP 8では事前にGDを有効化しておいてください!(QRコードの生成に必要です。) 次にSQLを設定します。(InnoDB) まず、お好きな名前でDBを作成し、その中に、account,emoji,notice,role,ueuse,notificationとテーブルを作成します。 テーブルの中身は以下のとおりです。 照合順序は全て標準でutf8mb4_general_ciです。 + +## 簡単に構築できるようSQLの構造ファイルがリリースに添付されています!そちらをインポートしていただけますと大幅に簡単に導入できます! +(userロールとofficialロールの設定は別途必要です。お手数ですがそこの設定だけよろしくお願いいたします。) + ### account - sysid(INT)(AUTO_INCREMENT ) アカウントが追加されるとカウントされるシステム用ID - username(varchar(500)) ユーザーネーム保存用 @@ -104,11 +107,17 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの - used(varchar(25)) 使用済みかそうでないか - datetime(datetime) 招待コード仕様日時更新用 -すべて作成完了したらGithubよりuwuzuのファイルをDLし、解凍し、それをサーバーの動作ディレクトリに置き、Apacheのhttpd.confからその動作ディレクトリを指定し、あとはApacheとphpとMy SQLを起動するだけ! +すべて作成完了したらGithubよりuwuzuのファイルをDLし、解凍し、それをサーバーの動作ディレクトリに置き、Apacheのhttpd.confからその動作ディレクトリを指定し、動作ディレクトリ内のdb.phpにDBのログイン情報を書き込んであとはApacheとphpとMy SQLを起動するだけ! 起動したらまずDBのroleにphpmyadminから「user」ロールと「official」ロールを追加、権限は「user」と「official」でOK。ロール名はとりあえず「一般ユーザー」ロールの色はHEXコード(#を除く)で000000のように指定。(この2つのロールがないとエラーが発生します。) そしたら普通にuwuzuにアクセスして自分のアカウントを登録。 +## 管理者アカウント登録機能が追加されました。【[domain]/admin/】より設定できるのでそちらをご利用ください。 +なお、管理者アカウントを導入後に登録した場合サーバーを止めてuwuzu動作ディレクトリ内のserverフォルダ内のファイルを設定する必要はございません。 + それが終わったら一度サーバーを止め、uwuzuの動作ディレクトリ内のserverフォルダ内のファイルを各自設定 ファイルの機能は以下の通り! + +## 管理者アカウント作成後にログインし、サーバー設定より以下の項目が簡単に設定できます。 + - admininfo.txt : 管理者名(てすとまる/@sampledayo) - contact.txt : 管理者への連絡用メアド(sample@test.com) - info.txt : サーバー登録時に表示されるメッセージ(好きな内容) @@ -121,7 +130,7 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの - onlyuser.txt : 招待コード機能をオンにするかどうか、「true」でオン、「false」でオフ。招待コードはDBに直接追加。 ### これでサーバーは完成!!! -もう一度サーバーを起動してみんなに公開しよう!!! +もう一度サーバーを起動してみんなに公開しよう!!!(まだ脆弱性は残っていると思われます。公開する際は気をつけてください。私だいちまる及びPutonfpsは一切責任を負いません。) ## 6. Android、iOS、その他OS向けのアプリについて 残念ですが今現在は公式アプリ等はなく、Webブラウザからお楽しみいただけます。 @@ -143,4 +152,4 @@ daichimarukanaと一緒に開発したいよ~って人は私のHPからメー 編集者 : daichimarukana -最終更新日 : 2023/08/18 12:44 \ No newline at end of file +最終更新日 : 2023/09/05 0:36 \ No newline at end of file diff --git a/server/uwuzuinfo.txt b/server/uwuzuinfo.txt index 42e5406..bf31d42 100644 --- a/server/uwuzuinfo.txt +++ b/server/uwuzuinfo.txt @@ -1,4 +1,4 @@ uwuzu -1.2.15 -2023/09/03 +1.2.16 +2023/09/05 daichimarukana,putonfps \ No newline at end of file diff --git a/server/uwuzurelease.txt b/server/uwuzurelease.txt index 0169c47..2be59cf 100644 --- a/server/uwuzurelease.txt +++ b/server/uwuzurelease.txt @@ -1,6 +1,13 @@ ## リリースノートだぜぇぇぇぇぇぇい!!!!!!! ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...) +## Version 1.2.16 +リリース日:2023/09/05 +サーバー設定項目を追加しました。 +サーバー初期設定を楽にするため、サーバー構築後に管理者アカウント登録画面へいけるようにしました。 +(uwuzu環境構築後サーバーを起動し「[domain]/admin/」でいけます。) +PC向けUIを一部変更しました。 + ## Version 1.2.15 リリース日:2023/09/03 ログインできないという致命的なバグを修正しました。 diff --git a/settings/serveradmin.php b/settings/serveradmin.php new file mode 100644 index 0000000..0341378 --- /dev/null +++ b/settings/serveradmin.php @@ -0,0 +1,442 @@ + 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"]){ + // セッションに値をセット + $userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット + $username = $_SESSION['username']; // セッションに格納されている値をそのままセット + $_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"]){ + // セッションに値をセット + $userid = $_COOKIE['userid']; // クッキーから取得した値をセット + $username = $_COOKIE['username']; // クッキーから取得した値をセット + $_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"; + } + $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; +} + +if( !empty($_POST['code_btn_submit']) ) { + + $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; +} + +?> + + + + + + + + +サーバー設定 - <?php echo file_get_contents($servernamefile);?> + + + + + +
+ + + + + + +

サーバー設定

+
+

サーバー名

+ +
+ +
+

サーバー紹介メッセージ

+ +
+ +
+

サーバー管理者の名前

+ +
+ +
+

サーバーへのお問い合わせ用メールアドレス

+ +
+ +
+

招待制にするかどうか

+
+ + + + + + + +
+
+ +
+

利用規約

+ +
+
+

プライバシーポリシー

+ +
+ +
+

サーバー停止時表示メッセージ

+ +
+ + + +
+

招待コード発行所

+ +

下の発行ボタンで新しくコードを発行できます!
なお、コードは一回限り有効です。

+ + +
+

コード:

+

使用状況:

+

発行日時:

+
+ + + +

サーバーは招待制にされていないため招待コードは利用できません。

+ + + +
+ + + + + \ No newline at end of file