Fixed error when trying to view an account when not signed into one yourself

Added login/create account buttons if you're viewing an account and want to make your own
This commit is contained in:
Taylor Courage 2025-03-08 17:15:42 -05:00
parent 89d49325cb
commit 6df3b6cfa7
2 changed files with 40 additions and 34 deletions

View File

@ -69,11 +69,13 @@ try { // Try opening the SQL database connection
<body>
<div id="accountDetailsTitlePanel">
<?php
if (isset($_SESSION["userID"])) {
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>
@ -103,6 +105,7 @@ try { // Try opening the SQL database connection
</div>
</div>
<?php
if (isset($_SESSION["userID"])) {
if (mb_strtolower($username) == mb_strtolower($_SESSION["username"])) {
echo ("
<div id=\"accountSocialsPanel\">
@ -133,6 +136,7 @@ try { // Try opening the SQL database connection
</div>
</div>
");
}
} else {
echo ("
<div id=\"accountSocialsPanel\">

View File

@ -22,7 +22,6 @@ try { // Try opening the SQL database connection
if (isset($results)) {
if (mb_strtolower($_GET["username"]) != mb_strtolower($results["username"])) {
$userExists = false;
echo "NO USER";
} else {
$userExists = true;
}
@ -73,7 +72,7 @@ try { // Try opening the SQL database connection
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 "<p>&nbsp;</p>";
echo "</div>";
}
?>
@ -98,6 +97,9 @@ try { // Try opening the SQL database connection
// If someone is logged in, give them the opportunity to log out
if (isset($_SESSION["userID"])){
echo "<a href=\"../logout.php?redirect=\" class=\"subNavLink\" id=\"loginButton\">LOGOUT</a>";
} else {
echo "<a href=\"/login_page.php \" target=\"dataFrame\" class=\"subNavLink\">SIGN IN</a>";
echo "<a href=\"/create_account.php \" target=\"dataFrame\" class=\"subNavLink\">CREATE AN ACCOUNT</a>";
}
?>
</div>