Professional Documents
Culture Documents
Connected Users (v8)
Connected Users (v8)
com
Skip to content
FAQ
Register
Login
This tip allows getting the list of users currently connected to a PHPMaker application.
You must be using the User Profile option and field in the database.
Just declare a view, over the User Table, using a Where clause such as:
You can replace the SELECT * by SELECT <some columns> if you don't need all table columns.
this query/view will extract all users that are currently connected (active sessions).
Regards...JLP
ExonDepot
Top
escalante
Top
i am trying to set this issue but facing this problem. When a user is logged in the profile column filled with :
a:1:{s:15:"LoginRetryCount";i:0;}
but not with the code you mentioned. I am using Version 8.0.3.
Regards
shahparz
Top
ddominguez
Top
We make it MEMORY table because there will be a lot of insert/deletes in this table and depending of how many users will be connected, you dont
want to put overhead on your HDD.
2. We need a page that will be loaded with every time together with any page on your site, like header or footer. Lets say header.php, so modify your
header.php and put this code somewhere:
<?php
// Display no of users online to Administrator //
$timeoutseconds = 600; // = 10 minutes (this is the timeout set in config file | after this period my app will automatically logout user, you can put
here any period)
$timestamp = time();
$timeout = $timestamp-$timeoutseconds;
$resultSel->close();
?>
It shows you how many users are conected on your site within a timespan of $timeout (in our case 10 minutes is sufficient).
I've also made a new page to show me their usernames.
So make a new page called home.php
I made this page available only to Administrator too. Code for this page can be:
<?php
if (session_id() == "") session_start(); // Initialize Session data
include_once "ewcfg8.php";
include_once "ewmysql8.php";
include_once "phpfn8.php";
include_once "usersinfo.php";
include_once "userfn8.php";
?>
<html>
<body>
<h2>USERS ONLINE</h2>
<p>
See users currently online (timespan - 300s = 5 min).
</p>
<span style="font-size:small;">
<?php
$select = "SELECT uo.username, uo.file FROM users_online uo GROUP BY uo.username ";
$result = $conn->execute($select);
echo "Currently online users: <br>";
while(!$result->EOF) {
echo " | ".$result->fields[0] . " (".$result->fields[1].") <br>";
$result->MoveNext();
} //end while
?>
</span>
<hr />
</body>
</html>
adim
Top
hello
include_once "ewcfg8.php";
include_once "ewmysql8.php";
include_once "phpfn8.php";
include_once "usersinfo.php";
include_once "userfn8.php";
Change to:
include_once "ewcfg15.php";
include_once "ewmysql15.php";
include_once "phpfn15.php";
include_once "usersinfo.php";
include_once "userfn15.php";
Warning: include_once(ewmysql15.php): failed to open stream: No such file or directory in C:\xampp\htdocs\alamana\home.php on line 5
Warning: include_once(): Failed opening 'ewmysql15.php' for inclusion (include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\alamana\home.php on line 5
Fatal error: Uncaught Error: Class 'HTMLPurifier_Config' not found in C:\xampp\htdocs\alamana\phpfn15.php:10622 Stack trace: #0
C:\xampp\htdocs\alamana\home.php(6): include_once() #1 {main} thrown in C:\xampp\htdocs\alamana\phpfn15.php on line 10622
saleh
Posts: 313
Joined: Mon Dec 09, 2013 11:21 pm
Top
Display posts from previous: All posts Sort by Post time Ascending Go
Post a reply
6 posts • Page 1 of 1
Board index
Delete all board cookies • All times are UTC + 8 hours