Hey!
I have a full user authentication system set up and it's working great, but on my index.php I want to show "Hello! Please login or create an account" below the header if someone isn't logged in, and "Hello ['MM_Username']! Log out - Change account settings" (with links to the respecting).
I'm trying to use "show if recordset is/is not empty", but for some reason even after logging out, on the homepage it still says "Hello (myusername)..."
This is my code in the header:
<?php if ($totalRows_getuserName > 0) { // Show if recordset not empty ?>
Hello, <?php echo $row_getuserName['userName']; ?>! Change account settings, or <a href="logout.php">log out?</a>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_getuserName == 0) { // Show if recordset empty ?>
Hello! Please <a href="login.php">log in</a> or <a href="register.php">register</a> to get started!
<?php } // Show if recordset empty ?>
And this is the definition for the username (I'm using the simple recordset tool)
mysql_select_db($database_UserDatabase, $UserDatabase);
$query_getuserName = "SELECT userName FROM users";
$getuserName = mysql_query($query_getuserName, $UserDatabase) or die(mysql_error());
$row_getuserName = mysql_fetch_assoc($getuserName);
$totalRows_getuserName = mysql_num_rows($getuserName);