PHP Code:
<?php
$name = (isset($_SESSION['loggedin'])) ? $_SESSION['loggedin'] : '0';
if($name == '0') { #### $name not '0', otherwise this would be in source
echo "<a href=\"index.php?p=signInForm\">Log in</a> \n";
echo "<a href=\"index.php?p=registerForm\">Register</a>\n";
} else {
$sth = $dbh->query("SELECT id,username,avatar,admin FROM users WHERE username = '$name'");
####
#### query should be ok, otherwise next line should cause an error,
#### since $sth would be false, not an object
####
while($row=$sth->fetch()){
##
## if you got at least one row, you would get something printed.
## ergo, your request returned 0 rows
##
$userID = $row['id'];
$username = $row['username'];
$avatar = $row['avatar'];
$admin = $row['admin'];
echo "<a href=\"http://x10hosting.com/forums/images/userImages/avatars/$avatar\"><img src=\"http://x10hosting.com/forums/images/userImages/avatars/$avatar\" width='50' height='50' align='left' /></a><br />\n";
echo "Welcome $username<br />\n";
echo "<a href=\"index.php?p=viewProfile&id=$userID\">My profile page</a><br />\n";
echo "<a href=\"index.php?p=signOutFinish\">Sign Out</a>\n";
if($admin == 1) {
echo "<a href=\"index.php?p=admin/admin_checkentries\">Administration</a>";
}
}
}
?>