Print Thread
Users Online (LIVE)
krepsen
Hi
it is possible to get Users Online (LIVE) Number 1
Edited by skpacman on 04-01-2013 14:34
 
skpacman
THIS IS NOT RECOMMENDED FOR HIGH-TRAFFIC SITES. YOUR DISK I/O AND BANDWIDTH WILL SKYROCKET!!!!!

First, grab the attached file and upload it to /infusions/online_users_panel/

Next, add the following to a new panel, set to public, then enable:
Download source  Code
add_to_head("
<script>
function AJAX(){
try{
xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
return xmlHttp;
}
catch (e){
try{
xmlHttp=new ActiveXObject(\"Msxml2.XMLHTTP\"); // Internet Explorer
return xmlHttp;
}
catch (e){
try{
xmlHttp=new ActiveXObject(\"Microsoft.XMLHTTP\");
return xmlHttp;
}
catch (e){
alert(\"Your browser does not support AJAX.\");
return false;
}
}
}
}

// Timestamp for preventing IE caching the GET request (common function)

function fetch_unix_timestamp()
{
 return parseInt(new Date().getTime().toString().substring(0, 10))
}

function refreshdiv_onlineusers(){

var seconds = 5;
var divid = \"onlineusers\";
var url = \"/infusions/online_users_panel/online_users_panel_standalone.php\";

var xmlHttp_one = AJAX();

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+\"?t=\"+timestamp;

xmlHttp_one.onreadystatechange=function(){
if(xmlHttp_one.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_one.responseText;
setTimeout('refreshdiv_onlineusers()',seconds*1000);
}
}
xmlHttp_one.open(\"GET\",nocacheurl,true);
xmlHttp_one.send(null);
}

window.onload = function startrefresh(){
setTimeout('refreshdiv_onlineusers()',seconds*1000);
}
</script>
");
openside("Users Online (LIVE)");
echo "<script type=\"text/javascript\">refreshdiv_onlineusers();</script><div id='onlineusers'></div>";
closeside();




Last, disable your previous Online Users panel.

Done!

If you want to make the refresh rate faster or slower than every 5 seconds, edit the panel code, find:
Download source  Code
var seconds = 5;


and change the seconds to whatever you want.
skpacman attached the following file:
online_users_panel_standalone.php [8.33kB / 1031 Downloads]


There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
krepsen
Hi

thanks for this
I only see a white and nacvnet but this has no il-download, what can I use a program to download the file

what is the name possibly this program I can run this on
 
KasteR
krepsen what exactly do you mean by white page? Have you uploaded the script? Not sure I understand what problem you're having. These are PHP scripts, which run on a web server with PHP installed.
 
krepsen
Hi

I will download the file, but are told to look for this on the internet, it will not be created so that I can run this to the ftp server
 
KasteR
You would download the file as mentioned (to your hard drive), and upload to your /infusions/online_users_panel/ folder. This can be accomplished using FTP.

Afterwards you'll need to create a new panel (also as mentioned).
Does this make sense to you? Let us know.
 
krepsen
no does not work, I use win rar
 
skpacman

>krepsen wrote:


no does not work, I use win rar


It's not compressed. It's just a .php file. Upload just the .php file to /infusions/online_users_panel/

No need for winRAR

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
MarioMP24
Translated by GOOGLE


Hello how can I install the panel in the autorefresh. (this panel)
If I install it after the script is always: Access Denied
I do not want to turn off the display. What should I ?nderen that the Panel automatically reload does?

Greeting MarioMP24
 
skpacman
The auto-refresh only works on the special-coded file I made [ Download Here ]

The reason yours is saying Access Denied is there's a line of code at the beginning of the file that checks if the file was loaded from PHP-Fusion or independantly. If it was loaded independantly (outside of PHP-Fusion or directly accessed), it denies access.

You'll have to comment the line out, like this:
Download source  Code
//if (!defined("IN_FUSION")) { die("Access Denied"); }


But that still doesn't guarantee that it'll work. I coded the script that goes with this to explicitly be handled by the auto-reload code.

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
MarioMP24
have the standalone panel adapted now to do it. Great things your script.
The comment the line out did not work. THX for the help.

Greeting MarioMP24
 
3Xpl01t
Hi everyone!

please hep me!

How to make the "live"(ajax) panel this my online members panel?
the code
[php]if (!defined("IN_FUSION")) { die("Access Denied"); }

if (file_exists(INFUSIONS."online_tagok_panel/locale/".$settings['locale'].".php")) {
include INFUSIONS."online_tagok_panel/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."online_tagok_panel/locale/Hungarian.php";
}

function online_panel_time_list($otime = "0") {
global $locale;

$osec = $otime;
$iS = $osec % 60;
$minn = floor ($otime / 60);
$iM = $minn % 60;
$hourn = floor ($otime / 60 / 60);
$iH = $hourn % 24;
$daysn = floor ($otime / 60 / 60 / 24);
$iD = $daysn % 7;
$weekn = $iW = floor ($otime / 60 / 60 / 24 / 7);

if ($otime < 60){
$otimes = $locale['OUL050'];
} elseif ($otime < 360){
$otimes = $locale['OUL051'];
} elseif ($iW > 0){
$txt = ($iW == 1 ? $locale['OUL052'] : $locale['OUL053']);
$otimes = sprintf("%2d".$txt."",$iW);
} elseif ($iD > 0){
$txt = ($iD == 1 ? $locale['OUL054'] : $locale['OUL055']);
$otimes = sprintf("%2d".$txt."",$iD);
} else {
$otimes = "<span style='color:#C22D2D;'>".sprintf("%02d:%02d:%02d",$iH,$iM,$iS)."</span>";
}

return $otimes;
}
$i = 0;
$oszlop = "3";
openside("L?togat?ink");

echo "<table width='100%' cellpadding='0' cellspacing='0' align='center'><tr>";

$result = dbquery("SELECT user_id, user_name, user_status, user_avatar, user_lastvisit FROM ".DB_USERS."
WHERE user_lastvisit >'0' AND user_status='0'
ORDER BY user_lastvisit
DESC LIMIT 0,20");

while ($data = dbarray($result)) {
$ustime = $data['user_lastvisit'] == 0 ? 0 : time() - $data['user_lastvisit'];
if ($i != 0 && ($i % $oszlop == 0)) { echo "</tr>\n<tr>\n"; }
echo "<td>\n";

if ($data['user_avatar'] && file_exists(IMAGES."avatars/".$data['user_avatar']) && $data['user_status']!=6 && $data['user_status']!=5) {
echo "<center><img src='".IMAGES."avatars/".$data['user_avatar']."' alt='' width='60' height='60' style='border-radius:50%'/>&nbsp;
<br />".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."&nbsp;<br />".online_panel_time_list($ustime)."</center><br />\n";
} else {
echo "<center><img src='".IMAGES."avatars/noavatar100.png' alt='' width='60' height='60' style='border-radius:50%'/>&nbsp;
<br />".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."&nbsp;<br />".online_panel_time_list($ustime)."</center><br />\n";
}

$i++;
}
echo "</div></tr>\n</table><hr>\n";

closeside();[/php]
 
skpacman
Did you follow all of the instructions in Post 2?

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
3Xpl01t
Hi all!

I have an online users mix panel, and the panel have admin..

I add the ajax code this my panel, and It's ok, but did'nt work it, and I don't now, what is the problem please see my attached files and tell me , the problem is whith this panel... (I followed all Instructions in Post 2)

Thanks, for your answers! Cool
3Xpl01t attached the following file:
php-files.zip [98.27kB / 363 Downloads]
 
Gillette
Strange, Download the file that is attached, then create a new panel from the code posted in #2 post
then create new panel with the code/ save>> enable
then disable the default user panel
works perfectly fine on my end.
 
Jump to Forum: