Finding out if a person is logged in an invisionfree forum?

Rinpun

Ex TH Member
Reaction score
105
Now I don't know if this is possible or not, but I might as well ask it for the hey of it. Considering I don't have a server that is my own to lend out (otherwise I'd just do this in vBulletin and I could find out what to do from its source code), Alexander hosts his Goth's High forum with invisionfree. One of the extra things, however, is a simple sidebar of my own design that Alexander is constantly sizing up. But, the last button, which he added recently, is "Log Out". However, this shows up when you are logged out as well! This is because it is simply a button on the sidebar that doesn't use any language to set any data on it. Now, what I'm wondering is, is it possible to find out if the person is logged into this forum or not? And would there be some sort of code for it? Then, of course, I'd be able to at least make the Log Out disappear when logged out, but if possible, I'd like to extend it to have some text box entries for logging in as well.

Thank you for your time :)

~Rinpun
 
Reaction score
125
Well can you edit invision with php? cause if you can i can give you some basic php codes to show all users on line, nut thats prolly not what you want.
 

DDRtists

ɹoʇɐɹǝpoɯ ɹǝdns
Reaction score
415
MeRcChRiS said:
Well can you edit invision with php? cause if you can i can give you some basic php codes to show all users on line, nut thats prolly not what you want.

Whats the codes? I wanna see them :)
 

Rinpun

Ex TH Member
Reaction score
105
Yea, the question is, what kind of cookie does it create? Like how would I access invisionfree's cookie?
 

mase

____ ___ ____ __
Reaction score
154
Thehelper does that too, if you log out then go to The Helper Home and scroll down til you see "Forum Controls" it will say:
Forum Search
Register Here
User Preferences
Member List
Forum Leaders
Archive
Log Out

I doubt TH has nething to do with it since they used vBulletiens original template.
 
P

Persen

Guest
Log in to to your invisionfree forum, and it will set a cookie. Find it and check it's name. Then just match it using $_COOKIE[].
 

mixmax2

RedArmyGangsta
Reaction score
31
Find out what cookie the invisionfree board is setting for logged in users, then on the bar do some php...

PHP:
<?php
if (isset($_COOKIE['Name_of_one_of_the_cookies_that_is_used_for_checking_login']))
   echo '<a href="logout.php">Logout</a>';
?>

Very straightforward, if the cookie is set, you display the logout button, if not, you dont.

You access invision's cookie by opening up the php file that processes the login information, it should set 2 cookies, if not more, mininum of 2 to track their username, and md5 encoded password.
 

Rinpun

Ex TH Member
Reaction score
105
It makes sense, except invisionfree's board doesn't allow you to see its php code. It only does so if you buy it, but that defeats the purpose of asking this question, because I would already know how to tweak it from there. Unfortunately, I've tried removing cookies and stuff, and I can't figure out the name of whatever it is that holds the cookie data for logging in and stuff. I know one exists though, I just wish I could find it -_-
 
Reaction score
125
DDRtists said:
Whats the codes? I wanna see them :)
Code:
<?php require("Path to SSI.php"); ?> (Put very top of page)

<?php ssi_whosOnline(); ?> (anywhere you want it to show up)
Because this is mostly for smf and i dont think you can edit files with a invisionfree board, so yeah.
 
P

Persen

Guest
You do not need to view the code. Log in to the forums, and check in your browser's cookie list.
 

Rinpun

Ex TH Member
Reaction score
105
I think I have it now. However, can I check if the cookie is set in Javascript somehow? Cause last time I tried using php on Invisionfree it didn't seem to work so well for some reason.

Edit:

Thanks for your help Persen. You steered me in the right direction and now I have it all figured out and working fine. It uses Javascript to switch the letters displayed based on the cookie's information and a function to "switch" the link it goes to based on the letters displayed.

I don't know why it took me so long to find the solution as I already know this stuff. Guess I'm just stupid like that :D
 

DDRtists

ɹoʇɐɹǝpoɯ ɹǝdns
Reaction score
415
MeRcChRiS said:
Code:
<?php require("Path to SSI.php"); ?> (Put very top of page)

<?php ssi_whosOnline(); ?> (anywhere you want it to show up)
Because this is mostly for smf and i dont think you can edit files with a invisionfree board, so yeah.

Thats for SMF, and has nothing to do with IF. Also, that does not check whos online, that echos the whos online thing at the bottom.

What your wanting to do would be( This is for SMF, btw ):

Code:
if($context['user']['is_logged'])
{

}
 

Rinpun

Ex TH Member
Reaction score
105
Alright, break it apart guys >_>

You can't read any of the invisionfree files or ANYTHING whatsoever. That is not how to solve the issue.

The thing I was able to do is first check my browser cookies (don't know why I didn't think of this part before...this was Persen's helping hand) and I found out that it's the name of the site plus "member_id" that is the used cookie...the exact same system as the Invision Power Board (as I found on google at one point). So, for Alexander's Goth's High site, I had to access the "Goths_Highmember_id" cookie. Then, I made use of a googled function that reads off parameters of the cookie (because, for some reason, javascript can access this cookie but not what is in it directly).

Code:
(Parameter finder)
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

(Finding if it's logged in or not)
function LoggedFinding() {
if (getCookie('Goths_Highmember_id') == 0)
{
document.getElementById('18').innerHTML = "Register Here";
document.getElementById('22').innerHTML = "Log In";
}
else
{
document.getElementById('18').innerHTML = "My Controls";
document.getElementById('22').innerHTML = "Log Out";
}
}

I found a parameter that was dynamic in finding out if the person is logged in or not, and then switch two buttons' inner HTML to reflect it. Then I give the buttons a dynamic action when you click on them that, based on the inner HTML inside, link you to a location. Works pretty well :)
 

Rinpun

Ex TH Member
Reaction score
105
You flamed and Mercchris flamed back. That is all.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top