| Codice: |
<?php
/****************************//*********************************************/
/*Staff Online Block *//*This program is free software. You can */
/*Author: Alex Hession *//*redistribute it and/or modify it under the */
/*Email: Alex@gnaunited.com *//*terms of the GNU General Public Licesnse as*/
/*root/blocks/ *//*published by the Free Software Foundation; */
/*block-Staff Online.php *//*either version 2 of the License. */
/****************************//*********************************************/
if (eregi("block-Staff_Online.php", $PHP_SELF)) { die("You can't access this file directly...");}
global $prefix, $db, $admin, $user_prefix;
function adminonlinea($admin)
{
global $admin, $prefix, $db;
if(!is_array($admin))
{
$admin = base64_decode($admin);
$admin = explode(":", $admin);
$uname = "$admin[0]";
$pwd = "$admin[1]";
}
else
{
$uname = "$admin[0]";
$pwd = "$admin[1]";
}
$past = time()-1800;
$sql = "DELETE FROM ".$prefix."_adminsession WHERE time < $past";
$db->sql_query($sql);
$sql = "SELECT * FROM ".$prefix."_adminsession WHERE uname='$uname'";
$result = $db->sql_query($sql);
if(is_admin($admin))
{
$ctime = time();
if ($row = $db->sql_fetchrow($result))
{
$sql = "UPDATE ".$prefix."_adminsession SET uname='$uname', time='$ctime' WHERE uname='$uname'";
$db->sql_query($sql);
}
else
{
$sql = "INSERT INTO ".$prefix."_adminsession (uname, time) VALUES ('$uname', '$ctime')";
$db->sql_query($sql);
}
}
}
adminonlinea($admin);
$sql = "SELECT uname FROM ".$prefix."_adminsession";
$result = $db->sql_query($sql);
if($db->sql_numrows($result) == "0")
{
$content .= "<br><i>No staff members are online!</i>\n";
}
else
{
while($row = $db->sql_fetchrow($result))
{
$content .= "<br><big><strong>·;</strong></big>\n ";
if(is_active("Private_Messages") AND $db->sql_numrows($db->sql_query("SELECT * FROM ".$user_prefix."_users where username = '$row[uname]'")) == "1")
{
$sql = "SELECT user_id from ".$user_prefix."_users where username= '$row[uname]'";
$result = $db->sql_query($sql);
list($id) = $db->sql_fetchrow($result);
$content .= "<a href=\"messages-post-.html$id\">\n<img src=\"images/pm.gif\" border=0 alt=\"Instant Message Site Admin $row[uname]\"></a>";
}
if(is_active("Forums"))$content .= " <a href=\"fsearch-author-.html$row[uname]\">\n<img src=\"images/po.gif\" border=0 alt=\"Find all forum posts by $row[uname]\"></a>\n";
if(is_active("Your_Account")) $content .= " <a href=\"modules.php?name=Your_Account&op=userinfo&username=$row[uname]\" alt=\"View The Userinfo For $row[uname]\">$row[uname]</a>\n";
else $content .= "$row[uname]\n";
}
}
?> |