Appreciate the quick response. Here's what my code looks like now:
function qa_get_logged_in_user($qa_db_connection)
{
session_start();
if ($_COOKIE["SMFCookie10"]) {
$result=mysql_fetch_assoc(
mysql_query(
"SELECT ID_MEMBER, memberName, emailAddress, ID_GROUP FROM smf_members WHERE ID_MEMBER=".
"(SELECT ID_MEMBER FROM smf_log_online WHERE session='".mysql_real_escape_string($_COOKIE["SMFCookie10"], $qa_db_connection)."')",
$qa_db_connection
)
);
if (is_array($result))
return array(
'userid' => $result['ID_MEMBER'],
'publicusername' => $result['memberName'],
'email' => $result['emailAddress'],
'level' => $result['ID_GROUP'] ? QA_USER_LEVEL_ADMIN : QA_USER_LEVEL_BASIC
);
}
return null;
}
However, I get an error saying "Undefined index: SMFCookie10"
I am checking with the SMF community on how to read the cookie that SMF sets. See:
http://www.simplemachines.org/community/index.php?topic=371972.0
Thanks.