Changed userlist in divisions to be links to player profiles, if they exist

Made a change so not-found users are displayed as such

Changed the title of the user account page to reflect the account we're looking at, and whether or not it's our own
This commit is contained in:
Taylor Courage 2025-03-08 16:25:21 -05:00
parent f128ec66c2
commit 69ef9fa67c
7 changed files with 153 additions and 113 deletions

View File

@ -104,7 +104,7 @@ try { // Try opening the SQL database connection
if (isset($names[$i])) {
$name = $names[$i];
$numWins = $wins[$i];
echo "<p class=\"divisionResultsTableLeft\">$name</p>";
echo "<p class=\"divisionResultsTableLeft\"><a href=\"/user/" . $name . "\" onclick=\"redirect('this', '/user/" . $name . "')\" class=\"plainLinkBlack\">$name</a></p>";
echo "<p class=\"divisionResultsTableRight\">$numWins</p>";
$contentLatch = 1;
}

View File

@ -25,17 +25,21 @@ function verifyPageInFrame() {
}
function redirect(location, address) {
// Open a new tab/window with the selected link
// Formats the link based on inputted data
switch (location) {
case "twitch":
var link = "https://twitch.tv/" + address;
window.open(link).focus();
break;
case "discord":
var link = "https://discordapp.com/users/" + address;
window.open(link).focus();
break;
case "this":
window.top.location.href = address;
break;
default:
var link = address;
window.open(address).focus();
}
window.open(link).focus();
}

View File

@ -136,6 +136,7 @@
.divisionResultsTableLeft {
text-align: left;
width: 80%;
cursor: pointer;
}
.divisionResultsTableRight {

View File

@ -328,6 +328,15 @@ For all the things at the bottom of the page; log in/out, 'my account', etc.
color: rgb(30, 90, 255);;
}
.plainLinkBlack {
text-decoration: none;
color: rgb(0, 0, 0);
}
.plainLinkBlack:hover {
color: rgb(60, 60, 60);
}

View File

@ -92,6 +92,11 @@
text-align: right;
}
#accountDetailsTitlePanel {
text-align: center;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 1.1em;
}
.accountUpdateButton input[type="submit"] {
margin: auto;
@ -262,3 +267,7 @@
height: 0px;
font-size: 90%;
}
.noUser {
text-align: center;
}

View File

@ -65,7 +65,18 @@ try { // Try opening the SQL database connection
<title>User Account Management</title>
</head>
<body id="accountDetailsBody">
<body>
<div id="accountDetailsTitlePanel">
<?php
if (mb_strtolower($username) == mb_strtolower($_SESSION["username"])) {
echo "<h2 id=\"adminHeader\">My Account</h2>";
} else {
echo "<h2 id=\"adminHeader\">$username's Account</h2>";
}
?>
</div>
<p>&nbsp;</p>
<div id="accountDetailsBody">
<div id="accountDetailsPanel">
<h3>Info</h3>
<p class="newLine"></p>
@ -171,6 +182,6 @@ try { // Try opening the SQL database connection
");
}
?>
</div>
</body>
</html>

View File

@ -19,11 +19,13 @@ try { // Try opening the SQL database connection
$results = $sqlGetUserList->fetch();
// Check if user exists
if (mb_strtolower($_GET["username"]) == mb_strtolower($results["username"])) {
$userExists = true;
} else {
if (isset($results)) {
if (mb_strtolower($_GET["username"]) != mb_strtolower($results["username"])) {
$userExists = false;
echo "NO USER";
} else {
$userExists = true;
}
}
@ -54,21 +56,25 @@ try { // Try opening the SQL database connection
</div>
<div id="headerCentre">
<h1 id="headerText"><a href="/" class="plainLinkBlue">TrojanDestinyRL</a></h1>
<div id="youtubeImage" onclick="redirect('mainpage', 'https://www.youtube.com/@TrojanDestinyRL')"><img src="/assets/youtube.svg" alt="youtube logo"></div>
<div id="twitchImage" onclick="redirect('mainpage', 'https://www.twitch.tv/trojandestinyrl')"><img src="/assets/twitch.svg" alt="twitch logo"></div>
<div id="discordImage" onclick="redirect('mainpage', 'https://discord.com')"><img src="/assets/discord.svg" alt="discord logo"></div>
<div id="youtubeImage" onclick="redirect('this', 'https://www.youtube.com/@TrojanDestinyRL')"><img src="/assets/youtube.svg" alt="youtube logo"></div>
<div id="twitchImage" onclick="redirect('this', 'https://www.twitch.tv/trojandestinyrl')"><img src="/assets/twitch.svg" alt="twitch logo"></div>
<div id="discordImage" onclick="redirect('this', 'https://discord.gg/bzU5fVxCZJ')"><img src="/assets/discord.svg" alt="discord logo"></div>
</div>
<div id="headerRight">
<img src="/assets/trojan_image_2.png" alt="Trojan Destiny logo" id="headerImage">
</div>
</div>
<p></p>
<h2 id="adminHeader">My Account</h2>
<?php
if ($userExists) {
echo ("<iframe src=\"/user/account.php?username=" . $_GET["username"] . "\" name=\"dataFrame\" class=\"dataFrame\" id=\"dataFrame\" onload=\"resizeIframe(this);\"></iframe>");
} else {
echo "<p>USER NO EXISTS</p>";
echo "<div class=\"noUser\">";
echo "<h2>USER NOT FOUND!</h2>";
echo "<p>This person may have played some games with us, but hasn't registered an account yet.</p>";
echo "<p>Please check back later!</p>";
echo "<p></p>";
echo "</div>";
}
?>