File: lastlogins.php

package info (click to toggle)
gforge 4.5.14-22etch13
  • links: PTS
  • area: main
  • in suites: etch
  • size: 13,004 kB
  • ctags: 11,918
  • sloc: php: 36,047; sql: 29,050; sh: 10,538; perl: 6,496; xml: 3,810; makefile: 341; python: 263; ansic: 256
file content (64 lines) | stat: -rw-r--r-- 1,759 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
  *
  * Page to view latest logins to the site
  *
  * WARNING: this should probably be moved to /stats/ for consistency
  *
  * SourceForge: Breaking Down the Barriers to Open Source Development
  * Copyright 1999-2001 (c) VA Linux Systems
  * http://sourceforge.net
  *
  * @version   $Id: lastlogins.php 2503 2003-12-17 17:02:25Z tperdue $
  *
  */

require_once('pre.php');

session_require(array('group'=>'1','admin_flags'=>'A'));

$res_logins = db_query("SELECT us.user_id AS user_id,
	us.ip_addr AS ip_addr,
	us.time AS time,
	users.user_name AS user_name FROM user_session us,users 
	WHERE us.user_id=users.user_id AND 
	us.user_id>0 AND us.time>0 ORDER BY us.time DESC",50);

if (!$res_logins || db_numrows($res_logins) < 1) {
	exit_error('Error',$Language->getText('stats_lastlogins','no_records').db_error());
}

$HTML->header(array('title'=>$Language->getText('stats_lastlogins','last_logins')));

print '<h3>'.$Language->getText('stats_lastlogins','most_recent_open').'</h3>';

?>

<table  width="100%" cellspacing="0" cellpadding="0">
<th><?php echo $Language->getText('stats_lastlogins','date'); ?></th>
<th><?php echo $Language->getText('stats_lastlogins','username'); ?></th>
<th><?php echo $Language->getText('stats_lastlogins','source_ip'); ?></th>

<?php

$alt=true;
while ($row_logins = db_fetch_array($res_logins)) {
	$fontcolor="white";
	if ($alt == true) {
		$fontcolor="lightgrey";
	}
	$alt = !$alt;

	print '<tr>';
	print '<td bgcolor='.$fontcolor.'>'.date($sys_datefmt, $row_logins['time']).'</td>';
	print '<td bgcolor='.$fontcolor.'>'.$row_logins['user_name'].'</td>';
	print '<td bgcolor='.$fontcolor.'>'.$row_logins['ip_addr'].'</td>';
	print '</tr>';
	print '</font>';
}
?>

</table>
<?php
$HTML->footer(array());
?>