Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Forums and "Who's Online?"

Asked Modified Viewed 3,814 times
S
stranded
S
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 53 threads in the forums
  • Started this discussions
asked
Member

Is there any way to add simple Who's online table on the bottom of the forums? Like in Invision Power Boards? Example: http://forums.invisionpower.com/

Things marked in red are things that I would like to have on my forums:
sumowski.com/syf/interesting.JPG


I've seen that in Advanced Forum Mod for V6, so it is possible in PHPFusion.
0 replies

13 posts

A
Arda
A
Arda 10
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 11 threads in the forums
answered
Member

add a l-ctr panel with codes like this:

if(eregi("forum",$_SERVER["REQUEST_URI"])) {
//online users panel's codes here
}


OR modify forum index, viewforum, viewthread.php
0 replies
K
kneekoo
K
  • Senior Member, joined since
  • Contributed 289 posts on the community forums.
  • Started 12 threads in the forums
  • Answered 1 question
answered
Senior Member

Wouldn't this be safer?
if(eregi("\/forum\/index.php",$_SERVER["REQUEST_URI"])) {
//online users panel's codes here
}

People searching for "forum" with our search engine would also get that statistics page and we only need to display stats on it's index.
0 replies
S
stranded
S
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 53 threads in the forums
  • Started this discussions
answered
Member

Ok I get it but it ain't working

This is the online panel code:
<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2007 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: online_users_panel.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
   
$result = dbquery("SELECT * FROM ".DB_ONLINE." WHERE online_user=".($userdata['user_level'] != 0 ? "'".$userdata['user_id']."'" : "'0' AND online_ip='".USER_IP."'"));
if (dbrows($result)) {
   $result = dbquery("UPDATE ".DB_ONLINE." SET online_lastactive='".time()."' WHERE online_user=".($userdata['user_level'] != 0 ? "'".$userdata['user_id']."'" : "'0' AND online_ip='".USER_IP."'")."");
} else {
   $result = dbquery("INSERT INTO ".DB_ONLINE." (online_user, online_ip, online_lastactive) VALUES ('".($userdata['user_level'] != 0 ? $userdata['user_id'] : "0")."', '".USER_IP."', '".time()."')");
}
$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_lastactive<".(time()-60)."");

openside($locale['global_010']);
$result = dbquery(
   "SELECT ton.*, tu.user_id,user_name FROM ".DB_ONLINE." ton
   LEFT JOIN ".DB_USERS." tu ON ton.online_user=tu.user_id"
);
$guests = 0; $members = array();
while ($data = dbarray($result)) {
   if ($data['online_user'] == "0") {
      $guests++;
   } else {
      array_push($members, array($data['user_id'], $data['user_name']));
   }
}
echo THEME_BULLET." ".$locale['global_011'].": ".$guests."<br /><br />\n";
echo THEME_BULLET." ".$locale['global_012'].": ".count($members)."<br />\n";
if (count($members)) {
   $i = 1;
   while (list($key, $member) = each($members)) {
      echo "<a href='".BASEDIR."profile.php?lookup=".$member[0]."' class='side'>".$member[1]."</a>";
      if ($i != count($members)) { echo ",\n"; } else { echo "<br />\n"; }
      $i++;
   }
}
echo "<br />\n".THEME_BULLET." ".$locale['global_014'].": ".number_format(dbcount("(user_id)", DB_USERS, "user_status<='1'"))."<br />\n";
if (iADMIN && checkrights("M") && $settings['admin_activation'] == "1") {
   echo THEME_BULLET." <a href='".ADMIN."members.php".$aidlink."&amp;status=2' class='side'>".$locale['global_015']."</a>";
   echo ": ".dbcount("(user_id)", DB_USERS, "user_status='2'")."<br />\n";
}
$data = dbarray(dbquery("SELECT user_id,user_name FROM ".DB_USERS." WHERE user_status='0' ORDER BY user_joined DESC LIMIT 0,1"));
echo THEME_BULLET." ".$locale['global_016'].": <a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' class='side'>".$data['user_name']."</a>\n";
closeside();
?>


So I did this:
  echo "if(eregi("\/forum\/index.php",$_SERVER["REQUEST_URI"])) 
{
if (!defined("IN_FUSION")) { die("Access Denied"); }
   
$result = dbquery("SELECT * FROM ".DB_ONLINE." WHERE online_user=".($userdata['user_level'] != 0 ? "'".$userdata['user_id']."'" : "'0' AND online_ip='".USER_IP."'"));
if (dbrows($result)) {
   $result = dbquery("UPDATE ".DB_ONLINE." SET online_lastactive='".time()."' WHERE online_user=".($userdata['user_level'] != 0 ? "'".$userdata['user_id']."'" : "'0' AND online_ip='".USER_IP."'")."");
} else {
   $result = dbquery("INSERT INTO ".DB_ONLINE." (online_user, online_ip, online_lastactive) VALUES ('".($userdata['user_level'] != 0 ? $userdata['user_id'] : "0")."', '".USER_IP."', '".time()."')");
}
$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_lastactive<".(time()-60)."");


$result = dbquery(
   "SELECT ton.*, tu.user_id,user_name FROM ".DB_ONLINE." ton
   LEFT JOIN ".DB_USERS." tu ON ton.online_user=tu.user_id"
);
$guests = 0; $members = array();
while ($data = dbarray($result)) {
   if ($data['online_user'] == "0") {
      $guests++;
   } else {
      array_push($members, array($data['user_id'], $data['user_name']));
   }
}
echo THEME_BULLET." ".$locale['global_011'].": ".$guests."<br /><br />\n";
echo THEME_BULLET." ".$locale['global_012'].": ".count($members)."<br />\n";
if (count($members)) {
   $i = 1;
   while (list($key, $member) = each($members)) {
      echo "<a href='".BASEDIR."profile.php?lookup=".$member[0]."' class='side'>".$member[1]."</a>";
      if ($i != count($members)) { echo ",\n"; } else { echo "<br />\n"; }
      $i++;
   }
}
echo "<br />\n".THEME_BULLET." ".$locale['global_014'].": ".number_format(dbcount("(user_id)", DB_USERS, "user_status<='1'"))."<br />\n";
if (iADMIN && checkrights("M") && $settings['admin_activation'] == "1") {
   echo THEME_BULLET." <a href='".ADMIN."members.php".$aidlink."&amp;status=2' class='side'>".$locale['global_015']."</a>";
   echo ": ".dbcount("(user_id)", DB_USERS, "user_status='2'")."<br />\n";
}
$data = dbarray(dbquery("SELECT user_id,user_name FROM ".DB_USERS." WHERE user_status='0' ORDER BY user_joined DESC LIMIT 0,1"));
echo THEME_BULLET." ".$locale['global_016'].": <a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' class='side'>".$data['user_name']."</a>\n";
}


And it doesn't work. :P The panel is enabled (just in case anyone asks). I've removed the openside, closeside lines because I don't want this to be visible as a panel.
Edited by stranded on 25-06-2008 14:19,
0 replies
A
Arda
A
Arda 10
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 11 threads in the forums
answered
Member

Quote

kneekoo wrote:
Wouldn't this be safer?
if(eregi("\/forum\/index.php",$_SERVER["REQUEST_URI"])) {
//online users panel's codes here
}

People searching for "forum" with our search engine would also get that statistics page and we only need to display stats on it's index.


that's right, but at core, there's no file which has "forum" word inside except forum, and the code i gave is for whole forum, not only for index, i thought less name checking would be a very little bit faster :) , but your mod guarantees the user's inside forum/index.php yes :)
0 replies
S
stranded
S
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 53 threads in the forums
  • Started this discussions
answered
Member

Ok it does work now, but it doesn't really look like it's verticallly placed, that's what I wanted.

edit:
It's like this:
sumowski.com/syf/fnsgsdui1.JPG

And I would like it to be like this:
sumowski.com/syf/fnsgsdui2.JPG
Edited by stranded on 25-06-2008 15:53,
0 replies
A
Arda
A
Arda 10
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 11 threads in the forums
answered
Member

the remanis is just html edit , can you give a sample URL ?
0 replies
S
stranded
S
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 53 threads in the forums
  • Started this discussions
answered
Member

URL to what ? :D

if you mean my forums it's here: http://www.alienantfans.com/php/websi.../index.php
0 replies
A
Arda
A
Arda 10
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 11 threads in the forums
answered
Member

at your wish, it'll kill the design, consider that there're 25 online users, that sure won't look good,

try this, it'll be something like this, but didn't tried myself though
<?php
if(strpos(dirname($_SERVER['REQUEST_URI']), "forum") !== false) {
opentable($locale['global_010']);
$result = dbquery("SELECT * FROM ".DB_ONLINE." WHERE online_user=".($userdata['user_level'] != 0 ? "'".$userdata['user_id']."'" : "'0' AND online_ip='".USER_IP."'"));
if (dbrows($result)) {
$result = dbquery("UPDATE ".DB_ONLINE." SET online_lastactive='".time()."' WHERE online_user=".($userdata['user_level'] != 0 ? "'".$userdata['user_id']."'" : "'0' AND online_ip='".USER_IP."'")."");
} else {
$result = dbquery("INSERT INTO ".DB_ONLINE." (online_user, online_ip, online_lastactive) VALUES ('".($userdata['user_level'] != 0 ? $userdata['user_id'] : "0")."', '".USER_IP."', '".time()."')");
}
$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_lastactive<".(time()-60)."");

$result = dbquery(
"SELECT ton.*, tu.user_id,user_name FROM ".DB_ONLINE." ton
LEFT JOIN ".DB_USERS." tu ON ton.online_user=tu.user_id"
);
$guests = 0; $members = array();
while ($data = dbarray($result)) {
if ($data['online_user'] == "0") {
$guests++;
} else {
array_push($members, array($data['user_id'], $data['user_name']));
}
}
$width =(iADMIN && checkrights("M") && $settings['admin_activation'] == "1")?"20%":"25%"; //if member's an admin, and has rights to adminitrate members, he'll see unactivated members, so there'll be 5 cells not 4,.
//if the php can't handle width with the line given above (lol i'm not sure), try this instead of the line above
/*
if (iADMIN && checkrights("M") && $settings['admin_activation'] == "1") { $width ='20%'; } else { $width='25%'; }
*/
echo "<table cellpadding='0' cellspacing='0'><tr>";
echo "<td width='$width'>";
echo THEME_BULLET." ".$locale['global_011'].":<br /> ".$guests."\n";
echo "</td><td width='$width'>";
echo THEME_BULLET." ".$locale['global_012'].": ".count($members)."<br />\n";
if (count($members)) {
$i = 1;
while (list($key, $member) = each($members)) {
echo "<a href='".BASEDIR."profile.php?lookup=".$member[0]."' class='side'>".$member[1]."</a>";
if ($i != count($members)) { echo ",\n"; } else { echo "<br />\n"; }
$i++;
}
}
echo "</td><td width='$width'>";
echo "\n".THEME_BULLET." ".$locale['global_014'].": ".number_format(dbcount("(user_id)", DB_USERS, "user_status<='1'"))."\n";
if (iADMIN && checkrights("M") && $settings['admin_activation'] == "1") {
echo "</td><td width='$width'>";
echo THEME_BULLET." <a href='".ADMIN."members.php".$aidlink."&amp;status=2' class='side'>".$locale['global_015']."</a>";
echo ": ".dbcount("(user_id)", DB_USERS, "user_status='2'")."\n";
}
echo "</td><td width='$width'>";
$data = dbarray(dbquery("SELECT user_id,user_name FROM ".DB_USERS." WHERE user_status='0' ORDER BY user_joined DESC LIMIT 0,1"));
echo THEME_BULLET." ".$locale['global_016'].": <a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' class='side'>".$data['user_name']."</a>\n";
echo "</td></tr></table>";
closetable();
}

?>
Edited by Arda on 25-06-2008 16:15,
0 replies
S
stranded
S
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 53 threads in the forums
  • Started this discussions
answered
Member

ok thanks, it's all ok now, but it seems like my forums got messed up, look at the categories:
sumowski.com/syf/onecatergory.JPG

after I disable the panel it doesn't fix itself lol, help?

also I nice border would be nice around the whole "who's online" panel on the bottom, border like:

<table width='200' border='1' bordercolor='#BDC5CB' bgcolor='#E8EEF1'>
<tr>
<td>&nbsp;</td>
</tr>
</table>
0 replies
S
stranded
S
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 53 threads in the forums
  • Started this discussions
answered
Member

Quote

SoulSmasher wrote:
at your wish, it'll kill the design, consider that there're 25 online users, that sure won't look good,

try this, it'll be something like this, but didn't tried myself though


this would indeed mess up the site with more the 20 something users, I left it as it was before
Edited by stranded on 25-06-2008 16:24,
0 replies
A
Arda
A
Arda 10
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 11 threads in the forums
answered
Member

you didn't add <?php and ?> , did you ?
and how was the original one ? if you disabled it (i mean deleted the code) that shoudln't be because of the codes, what are your very latest modifications ?
0 replies
S
stranded
S
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 53 threads in the forums
  • Started this discussions
answered
Member

there was no modifications, the only thing I did was this panel AND I've moved ONE forum above the other (both in same category).

and yes I did not add the <?php and ?> because it didn't work with it.

edit:
just tried again now, with the <?php and ?> and it just doesn't work, it won't display at all

edit2:

when you move around categories and forums with arrow down or arrow up it messes up the whole forum index, I've clicked randomly on forums and cats and it fixed somehow, very wierd, I guess it's a bug?
Edited by stranded on 25-06-2008 16:35,
0 replies
G
googlebot
G
Visit the new home of the merge between Hacking Vs. Security and Security Override!
My copyright removal has been switched over from HvS to SecurityOverride.
  • Senior Member, joined since
  • Contributed 638 posts on the community forums.
  • Started 28 threads in the forums
answered
Senior Member

I don't mean to hijack this thread, but my question is very similar to this one, and OP's question has been answered, so..

How would you go about the same thing, except a viewing the topic instead of on the whole forum such as:

guests viewing this topic: 6
members viewing this topic: member1, member2, member3, member4

Thanks!
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 13 posts
  • Votes 0 votes
  • Topic users 4 members

4 participants

K
K
  • Senior Member, joined since
  • Contributed 289 posts on the community forums.
  • Started 12 threads in the forums
  • Answered 1 question
A
A
Arda 10
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 11 threads in the forums
S
S
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 53 threads in the forums
  • Started this discussions
G
G
Visit the new home of the merge between Hacking Vs. Security and Security Override!
My copyright removal has been switched over from HvS to SecurityOverride.
  • Senior Member, joined since
  • Contributed 638 posts on the community forums.
  • Started 28 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet