FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » variable logged in flag
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
icon5.gif  variable logged in flag [message #14490] Sat, 15 November 2003 22:10 Go to next message
bobmurphy is currently offline  bobmurphy   Ireland
Messages: 166
Registered: November 2003
Location: ireland
Karma: 0
Senior Member
i want to add a line of text to the bottom of my page only if the user is not logged in. --- is there a variable which i can exploit that tells the forum if there is someone logged in or not

something along the lines of


if ($loggedin == TRUE)
someone is logged in;
else
no one is logged in, so display the text;


i was going to add this to the header or footer
Re: variable logged in flag [message #14491 is a reply to message #14490] Sun, 16 November 2003 00:36 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
_uid constant

FUDforum Core Developer
icon8.gif  Re: variable logged in flag [message #14515 is a reply to message #14491] Mon, 17 November 2003 00:45 Go to previous messageGo to next message
bobmurphy is currently offline  bobmurphy   Ireland
Messages: 166
Registered: November 2003
Location: ireland
Karma: 0
Senior Member
Quote:

_uid constant


sorry but my php skills are obviously not what i thought they were; could you explain this a little better please as i dont understand a) what the "_" at the start is about, b)do i have to put a $ at the start or not c) why there is a space in the middle of the variable, or is contstant a type of variable or is constant the value which means there is someone logged in

if i was to use the variable in a simple if statement i was trying unsuccessfully (among other things)

if($_uid constant == TRUE)

but i get a parse error and i'm pretty sure im doing something stupid

could you suggest a solution
Re: variable logged in flag [message #14516 is a reply to message #14515] Mon, 17 November 2003 05:00 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
_uid contains the numeric id of the user, if _uid == 0 then the user you are dealing with is anonymous (non logged in user).

FUDforum Core Developer
Re: variable logged in flag [message #15399 is a reply to message #14490] Mon, 15 December 2003 01:59 Go to previous messageGo to next message
firepages is currently offline  firepages   Australia
Messages: 24
Registered: July 2003
Karma: 0
Junior Member
Hi, same topic but what about on a non-forum page ?

e.g. I have a seperate login entry point on several pages which I only want to display if the user is not already logged in.

I see I can match the fud_session_innit cookie to db.evq_sess but that does not (that I can see) tell me if they are logged in or not.

is there a quick and dirty way to get this info? e.g. I don't really want to import all the FUD globals & routines into other pages just for this snippet of data.

...or should I just shut-up & add my own session vars to the login/out routines ?
Re: variable logged in flag [message #15400 is a reply to message #15399] Mon, 15 December 2003 03:08 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You determine if a user is logged in by reading the cookie set by the forum and then checking if session id stored in the cookie matches the data in the session table. For reference consult cookies.inc.t & users.inc.t

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to create a second Forum with one installation?
Next Topic: IP filter in version 2.3.8
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 11 22:01:21 GMT 2024

Total time taken to generate the page: 0.02604 seconds