Ajax - онлайнеры - Форум вебмастеров-Моды и хаки для трекера
Страница 1 из 11
Форум вебмастеров-Моды и хаки для трекера » Моды и Хаки » Готовые моды и хаки » Ajax - онлайнеры (Ajax - онлайнеры)
Ajax - онлайнеры
Slash3977Дата: Вторник, 29.06.2010, 17:06 | Сообщение # 1
Админ!и что?
Группа: Администраторы
Сообщений: 74
Репутация: 3
Статус: Offline
block-online.php
Code
<?php   
if (!defined('BLOCK_FILE')) {   
  Header("Location: ../index.php");   
  exit;   
}   
global $CURUSER, $use_sessions, $tracker_lang, $pic_base_url;   
$a = mysql_fetch_array(sql_query("SELECT id, username FROM users WHERE status='confirmed' ORDER BY id DESC LIMIT 1"));  
if ($CURUSER)  
$latestuser = "<a href=userdetails.php?id=" . $a["id"] . " class=\"online\">" . $a["username"] . "</a>";  
else  
$latestuser = $a['username'];  
$title_who = array();   
$gues = array();   
$dt = sqlesc(time() - 100);   
if ($use_sessions)   
     $result = sql_query("SELECT s.uid, s.username, s.class, s.ip FROM sessions AS s WHERE s.time > $dt ORDER BY s.class DESC");   
else   
     $result = sql_query("SELECT u.id, u.username, u.class FROM users AS u WHERE u.last_access > ".sqlesc(get_date_time(time() - 100))." ORDER BY u.class DESC");   

while ($row = mysql_fetch_array($result)) {   
$uid = $row["uid"];      
$uname = $row["username"];      
$class = $row["class"];      
$ip = $row["ip"];   
$uname_new = $uname;   

     if (!empty($uname) AND $uname_new != $uname_old) {    
         $title_who[] = "<a href=\"userdetails.php?id=".$uid."\" class=\"online\">".get_user_class_color($class, $uname)."</a>";    
     }    
     if ($class >= UC_MODERATOR and $uname_new != $uname_old) {   
     $staff++;   
     } elseif($class < UC_MODERATOR and (!empty($uname) and $uname_new != $uname_old)) {   
     $users++;   
     }   
     if ($uid <= 0 && !in_array("$ip",$gues)) {      
     $guests++;      
     $gues[] = "$ip";     
     }   
        
     if (empty($uname)) {   
     continue;   
     } else {   
     $who_online .= $title_who;   
     }   

$uname_old = $uname;   
}   

$total = $staff + $users + $guests;       

if ($staff == "")  $staff = 0;   
if ($guests == "") $guests = 0;   
if ($users == "")  $users = 0;   
if ($total == "")  $total = 0;   

{   
$total = $total - $staff;   
}   

$content .= "<table border=\"0\" width=\"100%\">   
              <tr valign=\"middle\"> ";   
{ }   
$content .= "<table border=\"0\" width=\"100%\"><tr valign=\"middle\"><td align=\"left\" class=\"embedded\"><b>Приветствуем: </b> $latestuser<hr></td></tr></table>\n";  
$content .= "<table border=\"0\" width=\"100%\"><tr valign=\"middle\"><td align=\"left\" class=\"embedded\"><b>Кто онлайн: </b><hr></td></tr><tr><td class=\"embedded\"><div id=wol> </td></tr></table>\n";  
$content .= "<table border=\"0\" width=\"100%\"><tr valign=\"middle\"><td colspan=\"2\">\n";  
$content .= "<tr><td class=\"embedded\"><img src=\"pic/info/admin.gif\"></td><td width=\"90%\" class=\"embedded\">Админы: $staff</td></tr>\n";  
$content .= "<tr><td class=\"embedded\"><img src=\"pic/info/member.gif\"></td><td width=\"90%\" class=\"embedded\">Пользователи: $users</td></tr>\n";  
$content .= "<tr><td class=\"embedded\"><img src=\"pic/info/guest.gif\"></td><td width=\"90%\" class=\"embedded\">Гости: $guests</td></tr>\n";  
$content .= "<tr><td class=\"embedded\"><img src=\"pic/info/group.gif\"></td><td width=\"90%\" class=\"embedded\">Всего: $total</td></tr></table>\n";  
?>  
<script language="javascript" type="text/javascript" src="js/ajax.js"></script>   
<script type="text/javascript">   
<!--   
function getWOL() {   
     var ajax = new tbdev_ajax();   
     ajax.onShow = function() { };   
     var varsString = "";   
     ajax.requestFile = "wol.php";   
     ajax.method = 'GET';   
     ajax.setVar("wol", 1);   
     ajax.element = 'wol';   
     ajax.sendAJAX(varsString);   
     setTimeout("getWOL();", 150);   
     return false   
}   
getWOL();   
-->   
</script>

wol.php в корень

Code
<?  
include_once("include/bittorrent.php");  
dbconn();  
header("Content-Type: text/html; charset=Windows-1251");  
print "  <div id=\"wol\">";  
$dt = gmtime() - 30;  
$dt = sqlesc(get_date_time($dt));  
$res = mysql_query("SELECT id, username, class, donor, warned, parked FROM users WHERE last_access >= $dt ORDER BY username") or print(mysql_error());  
while ($arr = mysql_fetch_assoc($res)) {  
$a = mysql_fetch_array(sql_query("SELECT id, username FROM users WHERE status='confirmed' ORDER BY id DESC LIMIT 1"));  

if ($use_sessions)  
     $result = sql_query("SELECT s.uid, s.username, s.class FROM sessions AS s WHERE s.time > $dt ORDER BY s.class DESC");  
else  
     $result = sql_query("SELECT u.id, u.username, u.class FROM users AS u WHERE u.last_access > ".sqlesc(get_date_time(time() - 30))." ORDER BY u.class DESC");  
while (list($uid, $uname, $class) = mysql_fetch_row($result)) {  

     if (!empty($uname)) {  
         $title_who[] = "<a href=\"userdetails.php?id=".$uid."\" class=\"online\">".get_user_class_color($class, $uname)."</a>";  
     }  

     $total++;  

     if (empty($uname))  
         continue;  
     else  
     $who_online .= $title_who;  
}  
  $username = $arr['username'];  
  $id = $arr['id'];  
$title_who = array();  
  echo "<a href=userdetails.php?id=$id target='_blank'></a> <a href=userdetails.php?id=$id onclick=\"parent.document.shoutform.shout.focus();parent.document.shoutform.shout.value='$username: '+parent.document.shoutform.shout.value;return false;\" target=_blank>".get_user_class_color($arr["class"], $arr["username"])." </a>";  
}  
echo ""." ";  
print "<hr></div>";  
?>
 
Форум вебмастеров-Моды и хаки для трекера » Моды и Хаки » Готовые моды и хаки » Ajax - онлайнеры (Ajax - онлайнеры)
Страница 1 из 11
Поиск: