File: user_inactive.php

package info (click to toggle)
owl-dms 0.90-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 17,292 kB
  • ctags: 10,919
  • sloc: php: 48,457; sql: 3,603; sh: 363; perl: 204; makefile: 73
file content (110 lines) | stat: -rw-r--r-- 3,248 bytes parent folder | download
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
 * user_inactive.php
 * 
 * Copyright (c) 1999-2005 The Owl Project Team
 * Licensed under the GNU GPL. For full terms see the file COPYING.
 *
 * Author: Steve Bourgeois <owl@bozzit.com>
 * Project Founder: Chris Vincent <cvincent@project802.net>
 * 
 * $Id: user_inactive.php,v 1.1.1.1 2005/11/06 15:40:59 b0zz Exp $
 */


$CountLines = 0;
$sql = new Owl_DB;
if (empty($since))
{
   $since = $sql->now();
}
else
{
  $since = date("Y-m-d H:i:s", strtotime($since));
  $since = "'" . $since . "'";
}

$sql->query("SELECT * from $default->owl_users_table WHERE lastlogin < $since ORDER BY name");

if (empty($export))
{
   print("<tr>\n");
   print("<td class=\"form1\">$owl_lang->report_filter_since</td>\n");
   print("<td colspan=\"3\" class=\"form1\" width=\"100%\">");
   print("<input type=\"text\" name=\"since\" value=\"" . ereg_replace("'", "",$since) ."\"></input>");
   fPrintSubmitButton($owl_lang->btn_submit, "Submit");
   fPrintSubmitButton($owl_lang->btn_export , "Export", "submit", "export");
   print("</td>");
   print("</tr>\n");
   
   print("<tr>\n");
   print("<td align=\"left\" colspan=\"3\">&nbsp;</td>\n");
   print("<td align=\"left\">&nbsp;</td>\n");
   print("</tr>\n");
   print("<tr>\n");
   
   // 
   // User File Stats BEGIN
   // 
   
   print("<td class=\"admin2\" align=\"left\" colspan=\"4\">$owl_lang->report_users_inactive_title</td>\n");
   print("<td align=\"left\">&nbsp;</td>\n");
   print("</tr>\n");
   print("<tr>\n");
   print("<td align=\"left\" colspan=\"3\">&nbsp;</td>\n");
   print("<td align=\"left\">&nbsp;</td>\n");
   print("</tr>\n");
   print("<tr>\n");
   print("<td align=\"left\" class=\"title1\">$owl_lang->name</td>\n");
   print("<td align=\"left\" class=\"title1\">$owl_lang->username</td>\n");
   print("<td align=\"left\" colspan=\"2\" width=\"100%\" class=\"title1\">$owl_lang->last_logged</td>\n");
   print("</tr>\n");
}
else
{
   header( 'Pragma: ' );
   header( 'Cache-Control: ' );
   header( 'Content-Type: application/vnd-ms.excel' );
   $aDate = getdate();
   $sExportFilename = 'User_Inactive_' . $aDate[ 'month' ] . '_' . $aDate[ 'mday' ] . '_' . $aDate[ 'year' ] . '.xls';
   header( 'Content-Disposition: attachment; filename="' . $sExportFilename . '"' );
   print($owl_lang->name . "\t");
   print($owl_lang->username . "\t");
   print($owl_lang->last_logged . "\t\n");
}
   
   while ($sql->next_record())
   {
      $CountLines++;
      $PrintLines = $CountLines % 2;
      if ($PrintLines == 0)
      {
         $sTrClass = "file1";
         $sLfList = "lfile1";
   }
   else
   {  
      $sTrClass = "file2";
      $sLfList = "lfile1";
   }
      
   if (empty($export))
   {
      print("\t\t\t\t<tr>\n");
      print("<td class=\"$sTrClass\">" . $sql->f("name") . "</td>\n");
      print("<td class=\"$sTrClass\">" . $sql->f("username") . "</td>\n");
      print("<td class=\"$sTrClass\" colspan=\"2\">" .  date($owl_lang->localized_date_format, strtotime($sql->f("lastlogin"))) . "</td>\n");
      print("</tr>\n");
   }
   else
   {
      print($sql->f("name") . "\t");
      print($sql->f("username") . "\t");
      print(date($owl_lang->localized_date_format, strtotime($sql->f("lastlogin"))) . "\t\n");
   }

} 

// 
// User File Stats END
?>