diff --git a/addauthcode.php b/addauthcode.php index 7c78001..28dd3ac 100644 --- a/addauthcode.php +++ b/addauthcode.php @@ -11,7 +11,7 @@ function createUniqId(){ function random($length = 32) { - return substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyz'), 0, $length); + return substr(str_shuffle('1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $length); } require('db.php'); diff --git a/css/home.css b/css/home.css index 6ea4616..feefccf 100644 --- a/css/home.css +++ b/css/home.css @@ -32,6 +32,12 @@ body{ background-size: cover; } +@media screen and (max-width:1500px) { + body{ + width: 95%; + } +} + .irobutton{ cursor: pointer; border: none; @@ -354,7 +360,7 @@ body{ border: none; display: flex; width:80%; - margin: 16px; + margin: 8px; padding: 8px auto; margin-left: auto; margin-right: auto; @@ -602,6 +608,19 @@ main h1{ } +.userheader .profile .hashtags{ + margin-top: auto; + margin-bottom: auto; + margin-left: 0px; + margin-right: 0px; + font-size: 16px; + color:#FFC832; + text-decoration: none; + font-family: 'BIZ UDGothic', sans-serif; + font-weight: bold; +} + + .fzone{ margin-left: 24px; margin-right: 24px; @@ -1367,7 +1386,17 @@ main h1{ border: 0; border-top: 1px solid #999; } - +.ueuse .hashtags{ + margin-top: auto; + margin-bottom: auto; + margin-left: 0px; + margin-right: 0px; + font-size: 16px; + color:#FFC832; + text-decoration: none; + font-family: 'BIZ UDGothic', sans-serif; + font-weight: normal; +} .tokonone p{ @@ -1838,7 +1867,7 @@ label>input { left: 0; width: 100%; height: 100%; - background-color: rgba(0, 0, 0, 0.5); + background-color: rgba(0, 0, 0, 0.25); backdrop-filter: blur(5px); z-index: 9999; transition: all 250ms ease-out; @@ -1857,7 +1886,7 @@ label>input { left: 40%; right: 40%; transform: translate(-50%, -50%); - box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .15); } .modal-content textarea{ @@ -2802,6 +2831,45 @@ hr{ } } +.tlchange{ + border-radius: 10px; + margin: 12px; + background-color: #F5F5F5; + border: 1px solid #EEE; + width: auto; + text-align: center; + display: flex; +} +.tlchange .off{ + width: 45%; + line-height: 32px; + margin-left: auto; + margin-right: auto; + overflow-wrap: break-word; + margin-top: 12px; + margin-bottom: 12px; + font-size: 24px; + color:#CCC; + text-decoration: none; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: bold; +} +.tlchange .on{ + width: 45%; + line-height: 32px; + margin-left: auto; + margin-right: auto; + overflow-wrap: break-word; + margin-top: 12px; + margin-bottom: 12px; + font-size: 24px; + color:#FFC832; + text-decoration: none; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: bold; + border-bottom: 1px solid #FFC832; +} + /*------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------スマホ向け--------------------------------------------------*/ /*--------------------------------------------------ここから--------------------------------------------------*/ @@ -3033,6 +3101,10 @@ hr{ transition: all 250ms ease-out; } + .ueuse .favbox img{ + width: 24px; + height: 24px; + } .ueuse .favbox .tuduki{ @@ -3085,6 +3157,14 @@ hr{ text-decoration:none; text-align: center; } + .ueuse .favbox .tuduki svg { + margin-top: -8px; + margin-right: 4px; + width: 24px; + height: 24px; + fill: currentColor; + transition: all 250ms ease-out; + } .ueuse .favbox .delbtn{ cursor: pointer; @@ -3212,12 +3292,6 @@ hr{ transition: all 250ms ease-out; } - - .ueuse .favbox img{ - margin-left: 0px; - width: 24px; - } - .ueuse{ animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards; margin: 12px; @@ -3703,7 +3777,7 @@ hr{ bottom: 0; width: 100%; height: 100dvh; - background-color: rgba(0, 0, 0, 0.2); + background-color: rgba(0, 0, 0, 0.25); backdrop-filter: blur(4px); z-index: 9999; margin-bottom: 0px; @@ -3820,6 +3894,34 @@ hr{ } } + .tlchange{ + border-radius: 10px; + margin: 12px; + margin-bottom: 0px; + width: auto; + text-align: center; + display: flex; + } + .tlchange .off{ + width: 45%; + line-height: 24px; + margin-left: auto; + margin-right: auto; + overflow-wrap: break-word; + margin-top: 12px; + margin-bottom: 12px; + font-size: 20px; + } + .tlchange .on{ + width: 45%; + line-height: 24px; + margin-left: auto; + margin-right: auto; + overflow-wrap: break-word; + margin-top: 12px; + margin-bottom: 12px; + font-size: 20px; + } } /*------------------------------------------------------------------------------------------------------------*/ @@ -3855,11 +3957,9 @@ hr{ background-color: #FFFAE6; color: #0c0c0c; box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2); - width:75%; } .leftbutton:active{ box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); - width:65%; } main{ @@ -4316,4 +4416,17 @@ hr{ color:#0c0c0c; box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2); } + + .tlchange{ + background-color: #0c0c0c; + border: none; + } + .tlchange .off{ + color:#F5F5F5; + } + .tlchange .on{ + color:#FFC832; + border-bottom: 1px solid #FFC832; + } + } \ No newline at end of file diff --git a/home/ftl.php b/home/ftl.php new file mode 100644 index 0000000..611ad5f --- /dev/null +++ b/home/ftl.php @@ -0,0 +1,736 @@ + PDO::ERRMODE_EXCEPTION, + PDO::MYSQL_ATTR_MULTI_STATEMENTS => false + ); + $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + +} catch(PDOException $e) { + + // 接続エラーのときエラー内容を取得する + $error_message[] = $e->getMessage(); +} + +if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { + + $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid"); + $passQuery->bindValue(':userid', $_SESSION['userid']); + $passQuery->execute(); + $res = $passQuery->fetch(); + if(empty($res["userid"])){ + header("Location: ../login.php"); + exit; + }elseif($_SESSION['loginid'] === $res["loginid"]){ + // セッションに値をセット + $userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット + $username = $_SESSION['username']; // セッションに格納されている値をそのままセット + $_SESSION['admin_login'] = true; + $_SESSION['userid'] = $userid; + $_SESSION['username'] = $username; + $_SESSION['loginid'] = $res["loginid"]; + setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); + setcookie('username', $username, time() + 60 * 60 * 24 * 14); + setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); + setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + }else{ + header("Location: ../login.php"); + exit; + } + + +} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) { + + $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid"); + $passQuery->bindValue(':userid', $_COOKIE['userid']); + $passQuery->execute(); + $res = $passQuery->fetch(); + if(empty($res["userid"])){ + header("Location: ../login.php"); + exit; + }elseif($_COOKIE['loginid'] === $res["loginid"]){ + // セッションに値をセット + $userid = $_COOKIE['userid']; // クッキーから取得した値をセット + $username = $_COOKIE['username']; // クッキーから取得した値をセット + $_SESSION['admin_login'] = true; + $_SESSION['userid'] = $userid; + $_SESSION['username'] = $username; + $_SESSION['loginid'] = $res["loginid"]; + setcookie('userid', $userid, time() + 60 * 60 * 24 * 14); + setcookie('username', $username, time() + 60 * 60 * 24 * 14); + setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14); + setcookie('admin_login', true, time() + 60 * 60 * 24 * 14); + }else{ + header("Location: ../login.php"); + exit; + } + + +} else { + // ログインが許可されていない場合、ログインページにリダイレクト + header("Location: ../login.php"); + exit; +} +if(empty($userid)){ + header("Location: ../login.php"); + exit; +} +if(empty($username)){ + header("Location: ../login.php"); + exit; +} + +$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'"); +$notiQuery->bindValue(':userid', $userid); +$notiQuery->execute(); +$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC); + +$notificationcount = $notiData['notification_count']; + +//------------------------------------------- +function get_mentions_userid($postText) { + // @useridを検出する + $usernamePattern = '/@(\w+)/'; + $mentionedUsers = []; + + preg_replace_callback($usernamePattern, function($matches) use (&$mentionedUsers) { + $mention_username = $matches[1]; + + $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, + )); + + $mention_userQuery = $dbh->prepare("SELECT username, userid FROM account WHERE userid = :userid"); + $mention_userQuery->bindValue(':userid', $mention_username); + $mention_userQuery->execute(); + $mention_userData = $mention_userQuery->fetch(); + + if (!empty($mention_userData)) { + $mentionedUsers[] = $mention_username; + } + }, $postText); + + return $mentionedUsers; +} + +if( !empty($_POST['btn_submit']) ) { + + $ueuse = htmlentities($_POST['ueuse']); + + // メッセージの入力チェック + if( empty($ueuse) ) { + $error_message[] = '内容を入力してください。'; + } else { + // 文字数を確認 + if( 1024 < mb_strlen($ueuse, 'UTF-8') ) { + $error_message[] = '内容は1024文字以内で入力してください。'; + } + } + + + if (empty($_FILES['upload_images']['name'])) { + $photo1 = "none"; + } else { + // アップロードされたファイル情報 + $uploadedFile = $_FILES['upload_images']; + + // アップロードされたファイルの拡張子を取得 + $extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION); + + // 新しいファイル名を生成(uniqid + 拡張子) + $newFilename = uniqid() . '-'.$userid.'.' . $extension; + + // 保存先のパスを生成 + $uploadedPath = '../ueuseimages/' . $newFilename; + + // ファイルを移動 + $result = move_uploaded_file($uploadedFile['tmp_name'], $uploadedPath); + + if ($result) { + $photo1 = $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)エラーコード:' .$errcode.''; + } + } + + if (empty($_FILES['upload_images2']['name'])) { + $photo2 = "none"; + } else { + + if (empty($_FILES['upload_images']['name'])){ + $error_message[] = '画像1から画像を選択してください!!!'; + } + // アップロードされたファイル情報 + $uploadedFile2 = $_FILES['upload_images2']; + + if( 10000000 < $uploadedFile2["size"] ) { + $error_message[] = 'ファイルサイズが大きすぎます!'; + } + // アップロードされたファイルの拡張子を取得 + $extension2 = pathinfo($uploadedFile2['name'], PATHINFO_EXTENSION); + + // 新しいファイル名を生成(uniqid + 拡張子) + $newFilename2 = uniqid() . '-'.$userid.'.' . $extension2; + + // 保存先のパスを生成 + $uploadedPath2 = '../ueuseimages/' . $newFilename2; + + // ファイルを移動 + $result2 = move_uploaded_file($uploadedFile2['tmp_name'], $uploadedPath2); + + if ($result2) { + $photo2 = $uploadedPath2; // 保存されたファイルのパスを使用 + } else { + $errnum = $uploadedFile2['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)エラーコード:' .$errcode.''; + } + } + + if (empty($_FILES['upload_videos1']['name'])) { + $video1 = "none"; + } else { + // アップロードされたファイル情報 + $uploadedFile3 = $_FILES['upload_videos1']; + + // アップロードされたファイルの拡張子を取得 + $extension3 = strtolower(pathinfo($uploadedFile3['name'], PATHINFO_EXTENSION)); // 小文字に変換 + + // サポートされている動画フォーマットの拡張子を配列で定義 + $supportedExtensions = array("mp4", "avi", "mov", "webm"); + + if (in_array($extension3, $supportedExtensions)) { + // 正しい拡張子の場合、新しいファイル名を生成 + $newFilename3 = uniqid() . '-'.$userid.'.' . $extension3; + // 保存先のパスを生成 + $uploadedPath3 = '../ueusevideos/' . $newFilename3; + + // ファイルを移動 + $result3 = move_uploaded_file($uploadedFile3['tmp_name'], $uploadedPath3); + + if ($result3) { + $video1 = $uploadedPath3; // 保存されたファイルのパスを使用 + } else { + $errnum = $uploadedFile3['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)エラーコード:' .$errcode.''; + } + } else { + $error_message[] = '対応していないファイル形式です!'; + } + + + } + + if( empty($error_message) ) { + + // 書き込み日時を取得 + $datetime = date("Y-m-d H:i:s"); + $uniqid = createUniqId(); + $abi = "none"; + + // トランザクション開始 + $pdo->beginTransaction(); + + try { + + // SQL作成 + $stmt = $pdo->prepare("INSERT INTO ueuse (username, account, uniqid, ueuse, photo1, photo2, video1, datetime, abi) VALUES (:username, :account, :uniqid, :ueuse, :photo1, :photo2, :video1, :datetime, :abi)"); + + $stmt->bindParam(':username', $username, PDO::PARAM_STR); + $stmt->bindParam(':account', $userid, PDO::PARAM_STR); + $stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR); + $stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR); + + $stmt->bindParam(':photo1', $photo1, PDO::PARAM_STR); + $stmt->bindParam(':photo2', $photo2, PDO::PARAM_STR); + $stmt->bindParam(':video1', $video1, PDO::PARAM_STR); + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + + $stmt->bindParam(':abi', $abi, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + + $mentionedUsers = get_mentions_userid($ueuse); + + foreach ($mentionedUsers as $mentionedUser) { + + $pdo->beginTransaction(); + + try { + $touserid = $mentionedUser; + $datetime = date("Y-m-d H:i:s"); + $msg = "" . $ueuse . ""; + $title = "" . $username . "さんにメンションされました!"; + $url = "/!" . $uniqid . "~" . $userid . ""; + $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クエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + + } catch(Exception $e) { + + // エラーが発生した時はロールバック + $pdo->rollBack(); + } + + } + + } 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'); + + + +// データベースの接続を閉じる +$pdo = null; + +?> + + + + + + + + + + + +フォロータイムライン - <?php echo file_get_contents($servernamefile);?> + + + + + + + +
+
+ LTL + FTL +
+ + + + +
+
+ +

画像のEXIF情報(位置情報など)は削除されません。
情報漏洩に気をつけてくださいね…

+
+ + + + + +
+
+
+ + +
+
+ + +
+
+ + + +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/home/index.php b/home/index.php index 1ce7c0b..86583e6 100644 --- a/home/index.php +++ b/home/index.php @@ -393,7 +393,7 @@ if ("serviceWorker" in navigator) { -ホーム - <?php echo file_get_contents($servernamefile);?> +ローカルタイムライン - <?php echo file_get_contents($servernamefile);?> @@ -402,7 +402,10 @@ if ("serviceWorker" in navigator) {
- +
+ LTL + FTL +