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

View File

@ -22,7 +22,6 @@ try { // Try opening the SQL database connection
if (isset($results)) { if (isset($results)) {
if (mb_strtolower($_GET["username"]) != mb_strtolower($results["username"])) { if (mb_strtolower($_GET["username"]) != mb_strtolower($results["username"])) {
$userExists = false; $userExists = false;
echo "NO USER";
} else { } else {
$userExists = true; $userExists = true;
} }
@ -73,7 +72,7 @@ try { // Try opening the SQL database connection
echo "<h2>USER NOT FOUND!</h2>"; 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>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>Please check back later!</p>";
echo "<p></p>"; echo "<p>&nbsp;</p>";
echo "</div>"; 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 someone is logged in, give them the opportunity to log out
if (isset($_SESSION["userID"])){ if (isset($_SESSION["userID"])){
echo "<a href=\"../logout.php?redirect=\" class=\"subNavLink\" id=\"loginButton\">LOGOUT</a>"; 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> </div>