0,
'path' => '/',
'domain' => '',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax'
]);
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,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
$passQuery->bindValue(':userid', safetext($_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 = safetext($res['userid']); // セッションに格納されている値をそのままセット
$username = safetext($res['username']); // セッションに格納されている値をそのままセット
$loginid = safetext($res["loginid"]);
$role = safetext($res["role"]);
$sacinfo = safetext($res["sacinfo"]);
$myblocklist = safetext($res["blocklist"]);
$myfollowlist = safetext($res["follow"]);
$_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',
'secure' => true,
'httponly' => true,
]);
setcookie('username', $username, [
'expires' => time() + 60 * 60 * 24 * 14,
'path' => '/',
'samesite' => 'lax',
'secure' => true,
'httponly' => true,
]);
setcookie('loginid', $res["loginid"], [
'expires' => time() + 60 * 60 * 24 * 14,
'path' => '/',
'samesite' => 'lax',
'secure' => true,
'httponly' => true,
]);
setcookie('admin_login', true, [
'expires' => time() + 60 * 60 * 24 * 14,
'path' => '/',
'samesite' => 'lax',
'secure' => true,
'httponly' => true,
]);
} else {
header("Location: ../login.php");
exit;
}
} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) {
$passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
$passQuery->bindValue(':userid', safetext($_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 = safetext($res['userid']); // クッキーから取得した値をセット
$username = safetext($res['username']); // クッキーから取得した値をセット
$loginid = safetext($res["loginid"]);
$role = safetext($res["role"]);
$sacinfo = safetext($res["sacinfo"]);
$myblocklist = safetext($res["blocklist"]);
$myfollowlist = safetext($res["follow"]);
$_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',
'secure' => true,
'httponly' => true,
]);
setcookie('username', $username, [
'expires' => time() + 60 * 60 * 24 * 14,
'path' => '/',
'samesite' => 'lax',
'secure' => true,
'httponly' => true,
]);
setcookie('loginid', $res["loginid"], [
'expires' => time() + 60 * 60 * 24 * 14,
'path' => '/',
'samesite' => 'lax',
'secure' => true,
'httponly' => true,
]);
setcookie('admin_login', true, [
'expires' => time() + 60 * 60 * 24 * 14,
'path' => '/',
'samesite' => 'lax',
'secure' => true,
'httponly' => true,
]);
} 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 customStripTags($html, $allowedTags)
{
$allowedTagsString = '<' . implode('><', $allowedTags) . '>';
return strip_tags($html, $allowedTagsString);
}
$allowedTags = array('h1', 'h2', 'h3', 'center', 'font');
if (!empty($pdo)) {
$uwuzuid2 = safetext(str_replace('@', '', $_GET['uwuzuid']));
$uwuzuid = safetext(str_replace('@' . $domain, '', $uwuzuid2));
$userQuery = $pdo->prepare("SELECT username, userid, profile, role, follower, blocklist FROM account WHERE userid = :userid");
$userQuery->bindValue(':userid', $uwuzuid);
$userQuery->execute();
$userData = $userQuery->fetch();
if (!empty($userData["userid"])) {
$roles = explode(',', $userData["role"]); // カンマで区切られたロールを配列に分割
$rerole = $pdo->prepare("SELECT follow, follower,blocklist, username, userid, password, mailadds, profile, iconname, headname, role, datetime, other_settings FROM account WHERE userid = :userid");
$rerole->bindValue(':userid', $uwuzuid);
// SQL実行
$rerole->execute();
$userdata = $rerole->fetch(); // ここでデータベースから取得した値を $role に代入する
$roleDataArray = array();
foreach ($roles as $roleId) {
$rerole = $pdo->prepare("SELECT rolename, roleauth, rolecolor, roleeffect FROM role WHERE roleidname = :role");
$rerole->bindValue(':role', $roleId);
$rerole->execute();
$roleDataArray[$roleId] = $rerole->fetch();
}
$isAIBlock = val_OtherSettings("isAIBlock", $userdata["other_settings"]);
//-------フォロー数---------
$follow = $userdata['follow']; // コンマで区切られたユーザーIDを含む変数
// コンマで区切って配列に分割し、要素数を数える
$followIds = explode(',', $follow);
$followCount = count($followIds) - 1;
$follow_on_me = array_search($userid, $followIds);
if ($follow_on_me !== false) {
$follow_yes = "フォローされています"; // worldを含む:6
} else {
$follow_yes = ""; // worldを含む:6
}
//-------フォロワー数---------
$follower = $userdata['follower']; // コンマで区切られたユーザーIDを含む変数
// コンマで区切って配列に分割し、要素数を数える
$followerIds = explode(',', $follower);
$followerCount = count($followerIds) - 1;
$profileText = safetext($userData['profile']);
$allueuse = $pdo->prepare("SELECT account FROM ueuse WHERE account = :userid");
$allueuse->bindValue(':userid', $uwuzuid);
$allueuse->execute();
$ueuse_cnt = $allueuse->rowCount();
//-------フォロワー取得---------
// フォロワーのユーザーIDを $follower_userids 配列に追加
foreach ($followerIds as $follower_userid) {
$follower_userids[] = $follower_userid;
}
// フォロワーのユーザー情報を取得
$follower_userdata = array();
foreach ($follower_userids as $follower_userid) {
$follower_userQuery = $pdo->prepare("SELECT username, userid, iconname, headname, sacinfo FROM account WHERE userid = :userid");
$follower_userQuery->bindValue(':userid', $follower_userid);
$follower_userQuery->execute();
$follower_userinfo = $follower_userQuery->fetch();
if ($follower_userinfo) {
// フォロワーのユーザー情報を $follower_userdata 配列に追加
$follower_userdata[] = $follower_userinfo;
}
}
//-------フォロー取得---------
foreach ($followIds as $follow_userid) {
$follow_userids[] = $follow_userid;
}
$follow_userdata = array();
foreach ($follow_userids as $follow_userid) {
$follow_userQuery = $pdo->prepare("SELECT username, userid, iconname, headname, sacinfo FROM account WHERE userid = :userid");
$follow_userQuery->bindValue(':userid', $follow_userid);
$follow_userQuery->execute();
$follow_userinfo = $follow_userQuery->fetch();
if ($follow_userinfo) {
// フォロワーのユーザー情報を $follower_userdata 配列に追加
$follow_userdata[] = $follow_userinfo;
}
}
} else {
$userData["userid"] = "none";
$userData['username'] = "でふぉると";
$ueuse_cnt = "zero";
$followCount = "zero";
$followerCount = "zero";
}
}
if (!empty($_POST['follow'])) {
// トランザクションを開始
$pdo->beginTransaction();
try {
// フォローボタンが押された場合の処理
$followerList = explode(',', $userdata['follower']);
if (!(in_array($userid, $followerList))) {
// 自分が相手をフォローしていない場合、相手のfollowerカラムと自分のfollowカラムを更新
$followerList[] = $userid;
$newFollowerList = implode(',', $followerList);
// UPDATE文を実行してフォロー情報を更新
$updateQuery = $pdo->prepare("UPDATE account SET follower = :follower WHERE userid = :userid");
$updateQuery->bindValue(':follower', $newFollowerList, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userData['userid'], PDO::PARAM_STR);
$res = $updateQuery->execute();
// 自分のfollowカラムを更新
$myflwlist = explode(',', $myfollowlist);
$myflwlist[] = $userData['userid'];
$newFollowList = implode(',', array_unique($myflwlist));
$updateQuery = $pdo->prepare("UPDATE account SET follow = :follow WHERE userid = :userid");
$updateQuery->bindValue(':follow', $newFollowList, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
$res_follow = $updateQuery->execute();
send_notification($userData["userid"], $userid, "🎉" . $userid . "さんにフォローされました!🎉", "" . $userid . "さんにフォローされました。", "/@" . $userid . "", "follow");
if ($res && $res_follow) {
$pdo->commit();
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location:" . $url);
exit;
} else {
$pdo->rollBack();
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
}
}
} catch (Exception $e) {
// ロールバック
$pdo->rollBack();
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
}
} elseif (!empty($_POST['unfollow'])) {
// トランザクションを開始
$pdo->beginTransaction();
try {
// フォロー解除ボタンが押された場合の処理
$followerList = explode(',', $userdata['follower']);
if (in_array($userid, $followerList)) {
// 自分が相手をフォローしている場合、相手のfollowerカラムと自分のfollowカラムを更新
$followerList = array_diff($followerList, array($userid));
$newFollowerList = implode(',', $followerList);
// UPDATE文を実行してフォロー情報を更新
$updateQuery = $pdo->prepare("UPDATE account SET follower = :follower WHERE userid = :userid");
$updateQuery->bindValue(':follower', $newFollowerList, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userData['userid'], PDO::PARAM_STR);
$res = $updateQuery->execute();
$myflwlist = explode(',', $myfollowlist);
$delfollowList = array_diff($myflwlist, array($userData['userid']));
$deluserid = implode(',', $delfollowList);
// 自分のfollowカラムから相手のユーザーIDを削除
$updateQuery = $pdo->prepare("UPDATE account SET follow = :follow WHERE userid = :userid");
$updateQuery->bindValue(':follow', $deluserid, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
$res_follow = $updateQuery->execute();
if ($res && $res_follow) {
// コミット
$pdo->commit();
// リダイレクト
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location:" . $url);
exit;
} else {
// ロールバック
$pdo->rollBack();
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
}
$stmt = null;
}
} catch (Exception $e) {
// ロールバック
$pdo->rollBack();
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
}
}
if (!empty($_POST['send_block_submit'])) {
$pdo->beginTransaction();
try {
$updateQuery = $pdo->prepare("UPDATE account SET blocklist = CONCAT_WS(',', blocklist, :blocklist) WHERE userid = :userid");
$updateQuery->bindValue(':blocklist', $userData["userid"], PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
$res_block = $updateQuery->execute();
// フォロー解除ボタンが押された場合の処理
$followerList = explode(',', $userdata['follower']);
if (in_array($userid, $followerList)) {
// 自分が相手をフォローしている場合、相手のfollowerカラムと自分のfollowカラムを更新
$followerList = array_diff($followerList, array($userid));
$newFollowerList = implode(',', $followerList);
// UPDATE文を実行してフォロー情報を更新
$updateQuery = $pdo->prepare("UPDATE account SET follower = :follower WHERE userid = :userid");
$updateQuery->bindValue(':follower', $newFollowerList, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userData['userid'], PDO::PARAM_STR);
$res = $updateQuery->execute();
$myflwlist = explode(',', $myfollowlist);
$delfollowList = array_diff($myflwlist, array($userData['userid']));
$deluserid = implode(',', $delfollowList);
// 自分のfollowカラムから相手のユーザーIDを削除
$updateQuery = $pdo->prepare("UPDATE account SET follow = :follow WHERE userid = :userid");
$updateQuery->bindValue(':follow', $deluserid, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
$res_follow = $updateQuery->execute();
if ($res && $res_follow) {
$pdo->commit();
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location:" . $url);
exit;
} else {
$pdo->rollBack();
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
}
$stmt = null;
}
if ($res_block) {
$pdo->commit();
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location:" . $url);
exit;
} else {
$pdo->rollBack();
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
}
} catch (Exception $e) {
// ロールバック
$pdo->rollBack();
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
}
} elseif (!empty($_POST['send_un_block_submit'])) {
$pdo->beginTransaction();
try {
$myblklist = explode(',', $myblocklist);
$delblkList = array_diff($myblklist, array($userData['userid']));
$deluserid = implode(',', $delblkList);
// 自分のfollowカラムから相手のユーザーIDを削除
$updateQuery = $pdo->prepare("UPDATE account SET blocklist = :blocklist WHERE userid = :userid");
$updateQuery->bindValue(':blocklist', $deluserid, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
$res_block = $updateQuery->execute();
if ($res_block) {
$pdo->commit();
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location:" . $url);
exit;
} else {
$pdo->rollBack();
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
}
} catch (Exception $e) {
// ロールバック
$pdo->rollBack();
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
}
}
require('../logout/logout.php');
// データベースの接続を閉じる
$pdo = null;
?>
さんのプロフィール -
🦖💨 インターネットへの接続が切断されました...
紀元前3000年からuwuzuを利用していません!!!
@
ブロックしているためプロフィールは表示されません。
🤔
さんをブロックしているため投稿の閲覧は出来ません。
エラー
サーバーの応答がなかったか不完全だったようです。
ネットワークの接続が正常かを確認の上再読み込みしてください。
(NETWORK_HUKANZEN_STOP)
さんをフォローしているユーザー
";
echo "
 . )
";
echo "
";
echo "
";
echo "
";
echo "
";
echo "
";
}
}
} else {
echo "
" . replaceProfileEmojiImages(safetext($userData["username"])) . "さんは誰にもフォローされていません。
";
}
?>
さんがフォローしているユーザー
";
echo "
 . )
";
echo "
";
echo "
";
echo "
";
echo "
";
echo "
";
}
}
} else {
echo "
" . replaceProfileEmojiImages(safetext($userData["username"])) . "さんは誰もフォローしていません。
";
}
?>