If User is Logged In/Out
Posted by jyaron
|
If User is Logged In/Out July 17, 2008 01:08AM |
Registered: 18 years ago Posts: 24 |
I'm trying very hard to figure this out, but I just can't seem to wrap my head around the code behind Phorum. I understand the basic concepts of sessions and other simple login scripts, and I've searched hard through the files of Phorum, but I can't seem to find a solution to this particular problem.
What I need is a way to say "this person is a user and is logged in, so display this code." If not it would say "this person is not identified as a user nor is he/she logged in, so display this code." This code would be placed in a .php file that is outside of the Phorum directory (where phorum would be found in /forum/ and the other files would, essentially, be in ../ ).
If anybody could give me some hints as to how I would do this it would be greatly appreciated.
[www.expressthemusic.com] - Going Live Soon.
What I need is a way to say "this person is a user and is logged in, so display this code." If not it would say "this person is not identified as a user nor is he/she logged in, so display this code." This code would be placed in a .php file that is outside of the Phorum directory (where phorum would be found in /forum/ and the other files would, essentially, be in ../ ).
If anybody could give me some hints as to how I would do this it would be greatly appreciated.
[www.expressthemusic.com] - Going Live Soon.
|
Re: If User is Logged In/Out July 17, 2008 01:12AM |
Admin Registered: 22 years ago Posts: 8,532 |
Sounds like you are looking for the quick authentication code, which you can use to determine outside Phorum if a user is logged in or not. See the quick authentication thread.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: If User is Logged In/Out July 17, 2008 01:17AM |
Registered: 18 years ago Posts: 24 |
|
Re: If User is Logged In/Out July 17, 2008 01:26AM |
Registered: 18 years ago Posts: 24 |
|
Re: If User is Logged In/Out July 17, 2008 01:29AM |
Admin Registered: 22 years ago Posts: 8,532 |
Sure, simply destroy the cookie that was set by Phorum.
That is enough to log a user out.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
That is enough to log a user out.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: If User is Logged In/Out July 17, 2008 01:32AM |
Registered: 18 years ago Posts: 24 |
|
Re: If User is Logged In/Out July 17, 2008 01:45AM |
Admin Registered: 22 years ago Posts: 8,532 |
If you take a look at the quick authentication script, then the hint for what cookie to use is at the very first line of the code:
So Phorum's login cookie is called "phorum_session_v5".
Destroy that cookie and you're logged out automatically.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
if(isset($_COOKIE["phorum_session_v5"])){
So Phorum's login cookie is called "phorum_session_v5".
Destroy that cookie and you're logged out automatically.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: If User is Logged In/Out July 17, 2008 01:47AM |
Admin Registered: 25 years ago Posts: 4,506 |
Quote
jyaron
What is the name of the cookie? (Sorry, I'm not sure if I entirely understand cookies... sessions I know alright, but cookies I haven't really touched).
Wow, just.... wow. That is like saying, I understand a car, but steering wheels, I have not used them much. Sessions are nothing more than a figment of your imagination that is held together by a file, row in a database or some memory cache and a cookie that tells the server which file, row in a database or memory location to grab when the user comes back. You have to understand cookies to understand sessions. You just can't understand one without the other.
Now, perhaps you meant to say "I have used the poor excuse for session management that is the PHP built in session code and I know how to set a value in $_SESSION and have it magically appear in another request. I don't understand how it appears, but I just know that it does and I am happy with that level of understanding."
Sorry, cookies and sessions is a rant of mine. Its not you, its me.
Brian - Personal Blog
|
Re: If User is Logged In/Out July 17, 2008 01:56AM |
Registered: 18 years ago Posts: 24 |
Quote
Brian Moon
Quote
jyaron
What is the name of the cookie? (Sorry, I'm not sure if I entirely understand cookies... sessions I know alright, but cookies I haven't really touched).
Wow, just.... wow. That is like saying, I understand a car, but steering wheels, I have not used them much. Sessions are nothing more than a figment of your imagination that is held together by a file, row in a database or some memory cache and a cookie that tells the server which file, row in a database or memory location to grab when the user comes back. You have to understand cookies to understand sessions. You just can't understand one without the other.
Now, perhaps you meant to say "I have used the poor excuse for session management that is the PHP built in session code and I know how to set a value in $_SESSION and have it magically appear in another request. I don't understand how it appears, but I just know that it does and I am happy with that level of understanding."
Sorry, cookies and sessions is a rant of mine. Its not you, its me.
Haha, that's basically exactly what I meant. I'm truly a novice when it comes to php/mysql coding, but I'm getting there. However, XHTML/CSS is where I can help others out if necessary :P Thanks for sobering my idea of understanding when it comes to sessions and cookies, hahaha... I'm still getting a kick out of your 2nd paragraph. Awesome.
|
Re: If User is Logged In/Out July 18, 2008 10:41PM |
Registered: 18 years ago Posts: 24 |
Sorry, only registered users may post in this forum.
