Hi Merlin,
You seem to have asked a lot of questions which seem like you haven't really researched how you can do this. If you looked around, for example, the PHP Manual you'd be able to find this out easily, or even if you just download PHPBB and looked through the coding it would open up your understanding a little better, nothing better than learning from other people work.
But, i will help you on this one. For a start, don't use Usernames in cookies; it's a security issue. If someone managed to get hold of that cookie, they would have a username, and then they could simply try hacking that account using numerous passwords they've compiled, etc, etc. Use user id's instead, that way, it is a little more secure, plus if you change they're username, it don't matter at all! Because it simply refers to the ID, not the name.
Anyway, on to the technical stuff.
I use to functions to check users, one to see if they exist, and one to see what userlevel they have:
PHP Code:
function check_userexist ($userid)
{
OpenDataBase("server", "user", "pass", "database");
$query = "SELECT UserID FROM users";
$result = mysql_query($query)
or die("Query failed: " . mysql_error());
while ( $row = mysql_fetch_array($result) ) {
if ($row['UserID'] == $userid) {
return 'TRUE';
exit;
}
}
return 'FALSE';
}
function check_userlevel ($userid)
{
OpenDataBase("host", "user", "pass", "database");
$query = "SELECT UserID, UserLevel
FROM users WHERE UserID = '$userid'";
$result = mysql_query($query)
or die("Query failed: " . mysql_error());
while ( $row = mysql_fetch_array($result) ) {
if ($row['UserID'] == $userid) {
return $row['UserLevel'];
exit;
}
}
return '0';
}
So now i suppose you want that explained!

I should say now that you'll see a function called OpenDataBase(), you won't have that function because it's one written by myself so you need to open the database yourself.
Basically, check_userexist will simply return true or false if it can find the user ID, check_userlevel will return what user level a user has by their user ID.
You should know how to grab cookies, since you know how to post them. Please remember this is an old bit of code, so there may be a better way to do it, but hopefully this makes things a bit clearer. You will need to change the code in terms of your database design.