・
@
;">
0 ){ echo htmlspecialchars($followCount, ENT_QUOTES, 'UTF-8');}else{echo "なし";} ?>
0 ){ echo htmlspecialchars($followerCount, ENT_QUOTES, 'UTF-8');}else{echo "なし";} ?>
0 ){ echo $upload_cnt1;}else{echo "なし";} ?>
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,role,sacinfo FROM account WHERE userid = :userid"); $passQuery->bindValue(':userid', htmlentities($_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 = htmlentities($_SESSION['userid']); // セッションに格納されている値をそのままセット $username = htmlentities($_SESSION['username']); // セッションに格納されている値をそのままセット $loginid = htmlentities($res["loginid"]); $role = htmlentities($res["role"]); $sacinfo = htmlentities($res["sacinfo"]); $_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,role,sacinfo FROM account WHERE userid = :userid"); $passQuery->bindValue(':userid', htmlentities($_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 = htmlentities($_COOKIE['userid']); // クッキーから取得した値をセット $username = htmlentities($_COOKIE['username']); // クッキーから取得した値をセット $loginid = htmlentities($res["loginid"]); $role = htmlentities($res["role"]); $sacinfo = htmlentities($res["sacinfo"]); $_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 = "none"; // トランザクション開始 $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'); ?>
・
@
;">
0 ){ echo htmlspecialchars($followCount, ENT_QUOTES, 'UTF-8');}else{echo "なし";} ?>
0 ){ echo htmlspecialchars($followerCount, ENT_QUOTES, 'UTF-8');}else{echo "なし";} ?>
0 ){ echo $upload_cnt1;}else{echo "なし";} ?>