function Checkonline ($userid, $tempid =null)
{
$conn = connect ();
For all users
First set yourself up for online
$stmt = "UPDATE". Db_name. ". USER SET isonline= ' Y ' WHERE userid= '. $userid;
$result = Query ($stmt, $conn);
info ($stmt);
If the current user is a visitor
if ($tempid!= null)
{
$stmt = "Select Tempid from". Db_name. ". Tempuser WHERE
Tempid= ". $tempid;
$result = Query ($stmt, $conn);
info ($stmt);
If the visitor is still online
if ($row = Fetch_array ($result))
{
$stmt = "UPDATE". Db_name. ". Tempuser SET
Requesttime= ' ". GetCurrentTime ()." ' WHERE tempid= ". $tempid;
$result = Query ($stmt, $conn);
info ($stmt);
}
The visitor has been offline
Else
{
$stmt = "INSERT into". Db_name. ". Tempuser
Get online numbers, users and visitors
function Getonlinenumber ()
{
$olnum = Array ();
$conn = connect ();
$stmt = "Select COUNT (UserID) from". Db_name. ". USER WHERE isonline= ' Y ' and
Usergroupid!= 4 "; 4 user group ID for guest
info ($stmt);
$result = Query ($stmt, $conn);
$olnum [' user '] = result ($result, 0, "COUNT (UserID)");
$stmt = "Select COUNT (Tempid) from". Db_name. ". Tempuser ";
info ($stmt);
$result = Query ($stmt, $conn);
if ($row = Fetch_array ($result))
{
$olnum [' guest '] = $row [' COUNT (Tempid) '];
}
Disconnect ($conn);
return $olnum; From www.w3sky.com
}
where the Connect (), disconnect (), query (), Fetch_array () function in Dbmanager.inc.PHP
Dbmanager.inc.PHP
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.