75 lines
2.1 KiB
PHP
75 lines
2.1 KiB
PHP
|
|
<?php header('Content-type: application/json');
|
||
|
|
|
||
|
|
//copyright 2013 Philip Poremba
|
||
|
|
|
||
|
|
//no one other than Philip Poremba may use this code
|
||
|
|
|
||
|
|
ini_set('session.bug_compat_warn', 0);
|
||
|
|
|
||
|
|
ini_set('session.bug_compat_42', 0);
|
||
|
|
|
||
|
|
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/include/analytics/');
|
||
|
|
|
||
|
|
include(PATHTOINCLUDES."base.php");
|
||
|
|
|
||
|
|
date_default_timezone_set('UTC');
|
||
|
|
|
||
|
|
$em="";
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
$sql="SELECT nickname, userphoto, userid, (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(ison)) as alive, blocklist, user_age, user_region, user_so, user_cs, user_hair FROM heartbeat WHERE (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(ison)) < 60 AND pagename = 'Community Page' OR pagename='community'";
|
||
|
|
|
||
|
|
$result=$database->database_query($sql) or $em=$em.$database->database_error();
|
||
|
|
|
||
|
|
$thecount=$database->database_num_rows($result);
|
||
|
|
|
||
|
|
$online="";
|
||
|
|
|
||
|
|
$ustats="";
|
||
|
|
|
||
|
|
$bclass="img_border_green";
|
||
|
|
|
||
|
|
while ($row = $database->database_fetch_assoc($result))
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
if($row["alive"] < 30){$bclass="img_border_green";}
|
||
|
|
|
||
|
|
elseif($row["alive"] <= 45){$bclass="img_border_yellow";}
|
||
|
|
|
||
|
|
elseif($row["alive"] > 45){$bclass="img_border_red";}
|
||
|
|
|
||
|
|
$blocklist = explode(",", $row["blocklist"]);
|
||
|
|
|
||
|
|
if(isset($_GET["uid"]))
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
if(!isset($_SESSION["cp_userid"]))
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
$_SESSION["cp_userid"]= $_GET["uid"];
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
$user_key = array_search($_SESSION["cp_userid"], $blocklist);
|
||
|
|
|
||
|
|
if($user_key!==true){
|
||
|
|
|
||
|
|
$online=$online.'<a href="javascript:hl_profile2(\''.$row["userphoto"].'\',\''.$row["nickname"].'\',\''.$row["user_age"].'\',\''.$row["user_region"].'\',\''.$row["user_so"].'\',\''.$row["user_cs"].'\',\''.$row["user_hair"].'\',\''.$row["userid"].'\')"><img src="'.$row["userphoto"].'" width="22" height="23" alt="'.$row["nickname"].'" class="'.$bclass.' cp_pthumb" onmouseover="hl_profile(\''.$row["userphoto"].'\',\''.$row["nickname"].'\',\''.$row["user_age"].'\',\''.$row["user_region"].'\',\''.$row["user_so"].'\',\''.$row["user_cs"].'\',\''.$row["user_hair"].'\',\''.$row["userid"].'\')" onmouseout="hl_profile_out()" /></a>';
|
||
|
|
|
||
|
|
}}
|
||
|
|
|
||
|
|
$online= utf8_encode($online);
|
||
|
|
|
||
|
|
$arr = array ('thecount'=> $thecount, 'online' => $online, 'woustats' => $ustats);
|
||
|
|
|
||
|
|
echo json_encode($arr);
|
||
|
|
|
||
|
|
exit();
|
||
|
|
|
||
|
|
?>
|