[TYPO3] BE condition

Marc Ehret marc.ehret at gmx.net
Wed Jul 4 00:42:25 CEST 2007


Tyler Kraft wrote:

> can anyone tell me how I can set a condition to check if one particular 
> BE user is logged in?
> 
> I use  [globalVar = TSFE:beUserLogin=1] to see if any BE user is logged 
> in, but how can I check if one particular BE user is logged in?

Hi Tyler,

just a copy from a site I made years ago:

[userFunc = user_check(999)]

put this function in localconf.php:

function user_check($uid)	{
    if ($GLOBALS["HTTP_COOKIE_VARS"]["be_typo_user"]) {
       $query="SELECT * FROM be_sessions WHERE ses_id='".$GLOBALS["HTTP_COOKIE_VARS"]["be_typo_user"]."'";
       $result=mysql(TYPO3_db,$query);
       if (mysql_num_rows($result)) {
       	$be_user=mysql_fetch_object($result);
       	$be_user_id = $be_user->ses_userid;
       	if ($be_user_id == $uid) {
             return true;
          } else {
             return false;
          }
       }
    }
}

--
Marc


More information about the TYPO3-english mailing list