News:

Wondering if this will always be free?  See why free is better.

Main Menu

Checking rather a user is logged in or not.

Started by redcau, January 12, 2006, 08:02:45 PM

Previous topic - Next topic

redcau

Hello,

I am working on intergrating my custom code site with SMF's member table.

Now, I am not too familiar with SMF's coding, so I looked into the SSI.php, and discovered a function that include the status of a visitor. Sure enough, I discovered that the login form in function ssi_login() would hide itself when a visitor is already logged in. Deciding that I have hit the jackpot, I went ahead and replaced the html for the login panel with a return true; statement. Like so:

function is_logged_in()
{
global $scripturl, $txt, $user_info;

if (!$user_info['is_guest'])
return true;

return false;
}

I then used a pair of if/else statment on a seperate file:

include ("SSI.php");

if(is_logged_in())
   echo'Hi Thar, you are logged in!';
else
   echo'Aye mang, you are not logged in!';


And sure enough, it does not work. It echo the logged in case regardless me being logged out.

Now, can some kind soul point me in the right direction? Am I approching this with a completely wrong route? Did I ommit some important code? Which function(s) are responsible for verifying rather a member is logged in or not?

Love,
Red

Aquilo

http://www.xtram.net/index.php?page=logintest

do it the easy way!

include_once ("SSI.php");
global $user_info;
if(empty($user_info['is_guest']))
   echo 'Hi Thar, you are logged in!';
else
   echo 'Aye mang, you are not logged in!';

FBI

How to implement that code with java? I need, our visitor get the first "welcome" java pop up. And chooce for login or not?

Thanks..

Advertisement: