-
Notifications
You must be signed in to change notification settings - Fork 6
/
chat_wl.php
33 lines (30 loc) · 1 KB
/
chat_wl.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* @package chat_wl.php
* @author John Doe <[email protected]>
* @since 2013-09-10
* @version 2013-09-10
*/
/*
9/10/13 New file - Ajax use for showing who is logged in to chat.
*/
@session_start();
require_once './incs/functions.inc.php';
$ret_arr = array();
$the_users = "";
$now = mysql_format_date(time() - (get_variable('delta_mins')*60)); // 1/23/10
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]user` WHERE `id` <> " . $_SESSION['user_id'] . " AND `expires` > '" . $now . "' ORDER BY `user`"; // 1/23/10
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename( __FILE__), __LINE__);
if (mysql_num_rows($result)==0) {
$the_users = "no others";
} else {
$counter = mysql_num_rows($result);
$i=1;
while ($row = stripslashes_deep(mysql_fetch_array($result))) {
$the_sep = ($i < $counter) ? ", " : "";
$the_users .= $row['user'] . $the_sep;
$i++;
}
}
$ret_arr[0] = $the_users;
print json_encode($ret_arr);