| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,23 @@ |
| 1 |
+<?php |
|
| 2 |
+if(!defined("_CHARSET")) exit( );
|
|
| 3 |
+ |
|
| 4 |
+ global $dateformat, $tpl; |
|
| 5 |
+ if(file_exists(_BASEDIR."blocks/online/{$language}.php")) include(_BASEDIR."blocks/online/{$language}.php");
|
|
| 6 |
+ else include(_BASEDIR."blocks/online/en.php"); |
|
| 7 |
+ $where = "online_uid=".(USERUID ? USERUID : "0 AND online_ip = INET_ATON('".$_SERVER['REMOTE_ADDR']."')");
|
|
| 8 |
+ $result = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_online WHERE $where");
|
|
| 9 |
+ if(dbnumrows($result) > 0) dbquery("UPDATE ".TABLEPREFIX."fanfiction_online SET online_timestamp = '".time( )."' WHERE $where");
|
|
| 10 |
+ else dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_online(online_uid, online_ip, online_timestamp) VALUES('".(USERUID ? USERUID : 0)."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), '".time( )."')");
|
|
| 11 |
+ $result = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_online WHERE online_timestamp < ".(time()-60));
|
|
| 12 |
+ $q1 = dbquery("SELECT COUNT(online_ip) FROM ".TABLEPREFIX."fanfiction_online WHERE online_uid = 0");
|
|
| 13 |
+ list($guests) = dbrow($q1); |
|
| 14 |
+ $tpl->assignGlobal("guests", empty($guests) ? 0 : $guests);
|
|
| 15 |
+ $q2 = dbquery("SELECT o.online_uid, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_online as o, "._AUTHORTABLE." WHERE o.online_uid = "._UIDFIELD." AND o.online_uid != 0");
|
|
| 16 |
+ $omlist = array( ); |
|
| 17 |
+ while($om = dbassoc($q2)) {
|
|
| 18 |
+ $omlist[] = "<a href='"._BASEDIR."viewuser.php?uid=".$om['online_uid']."'>".$om['penname']."</a>"; |
|
| 19 |
+ } |
|
| 20 |
+ $tpl->assignGlobal("onlinemembers", count($omlist) ? implode(", ", $omlist) : "");
|
|
| 21 |
+ $content = "<div id='who_online'><span class='label'>"._GUESTS.":</span> ".($guests ? $guests : 0)."<br />\n |
|
| 22 |
+ <span class='label'>"._MEMBERS.":</span> ".(count($omlist) ? implode(", ", $omlist) : "")."</div>";
|
|
| 23 |
+?> |
|
| 0 | 24 |
\ No newline at end of file |