Changeset 731

Show
Ignore:
Timestamp:
09/10/05 13:28:30 (8 years ago)
Author:
fproulx
Message:

2005-09-10 Francois Proulx <francois.proulx@…>

  • Automatically redirect user to login form when trying to access admin
  • Added various isset, empty tests, vars init in stats (to avoid php warning)
Location:
trunk/wifidog-auth
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/ChangeLog

    r726 r731  
     12005-09-10 Francois Proulx <francois.proulx@gmail.com> 
     2        * Automatically redirect user to login form when trying to access admin 
     3        * Added various isset, empty tests, vars init in stats (to avoid php warning) 
     4 
    152005-09-08 Philippe April  <philippe@ilesansfil.org> 
    26        * New stats system with graphs 
  • trunk/wifidog-auth/wifidog/admin/graph_common.inc.php

    r726 r731  
    3535$date_constraint = "AND timestamp_in >= '{$_REQUEST['date_from']}' AND timestamp_in <= '{$_REQUEST['date_to']}'"; 
    3636 
    37 $node_id = $db->EscapeString($_REQUEST["node_id"]); 
    38 $user_id = $db->EscapeString($_REQUEST["user_id"]); 
    39 $network_id = $db->EscapeString($_REQUEST["network_id"]); 
     37$node_id = isset($_REQUEST["node_id"]) ? $db->EscapeString($_REQUEST["node_id"]) : null; 
     38$user_id = isset($_REQUEST["user_id"]) ? $db->EscapeString($_REQUEST["user_id"]) : null; 
     39$network_id = isset($_REQUEST["network_id"]) ? $db->EscapeString($_REQUEST["network_id"]) : null; 
     40 
    4041?> 
  • trunk/wifidog-auth/wifidog/admin/index.php

    r566 r731  
    3434if(!$current_user) 
    3535{ 
    36     $html = '<p class="errormsg">'._('You must be logged in to access the administration panel.')."</p>\n"; 
     36        // Redirect to login form automatically 
     37        header("Location: ../login/"); 
     38        exit; 
    3739} 
    3840else 
  • trunk/wifidog-auth/wifidog/admin/stats.php

    r726 r731  
    9393    } 
    9494 
    95     if (!$_REQUEST["date_from"]) 
     95    if (!isset($_REQUEST["date_from"])) 
    9696        $_REQUEST["date_from"] = strftime("%Y-%m-%d 00:00"); 
    97     if (!$_REQUEST["date_to"]) 
     97    if (!isset($_REQUEST["date_to"])) 
    9898        $_REQUEST["date_to"] = strftime("%Y-%m-%d 11:59"); 
    9999 
     
    208208 
    209209            $html .= "<input type=\"radio\" name=\"group_connections\" value=\"\""; 
    210             $html .= $_REQUEST['group_connections'] == "" ? 'CHECKED' : ''; 
     210            $html .= empty($_REQUEST['group_connections']) ? 'CHECKED' : ''; 
    211211            $html .= ">No<br>"; 
    212212 
    213213            $html .= "<input type=\"radio\" name=\"group_connections\" value=\"group_connections_by_mac\""; 
    214             $html .= $_REQUEST['group_connections'] == "group_connections_by_mac" ? 'CHECKED' : ''; 
     214            $html .= isset($_REQUEST['group_connections']) && $_REQUEST['group_connections'] == "group_connections_by_mac" ? 'CHECKED' : ''; 
    215215            $html .= ">By unique MACs<br>"; 
    216216 
    217217            $html .= "<input type=\"radio\" name=\"group_connections\" value=\"group_connections_by_user\""; 
    218             $html .= $_REQUEST['group_connections'] == "group_connections_by_user" ? 'CHECKED' : ''; 
     218            $html .= isset($_REQUEST['group_connections']) && $_REQUEST['group_connections'] == "group_connections_by_user" ? 'CHECKED' : ''; 
    219219            $html .= ">By unique usernames<br>"; 
    220220        } 
  • trunk/wifidog-auth/wifidog/admin/stats_user_id.inc.php

    r726 r731  
    11<?php 
    2   /********************************************************************\ 
    3    * This program is free software; you can redistribute it and/or    * 
    4    * modify it under the terms of the GNU General Public License as   * 
    5    * published by the Free Software Foundation; either version 2 of   * 
    6    * the License, or (at your option) any later version.              * 
    7    *                                                                  * 
    8    * This program is distributed in the hope that it will be useful,  * 
    9    * but WITHOUT ANY WARRANTY; without even the implied warranty of   * 
    10    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    * 
    11    * GNU General Public License for more details.                     * 
    12    *                                                                  * 
    13    * You should have received a copy of the GNU General Public License* 
    14    * along with this program; if not, contact:                        * 
    15    *                                                                  * 
    16    * Free Software Foundation           Voice:  +1-617-542-5942       * 
    17    * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       * 
    18    * Boston, MA  02111-1307,  USA       gnu@gnu.org                   * 
    19    *                                                                  * 
    20    \********************************************************************/ 
    21   /**@file stats_user_id.inc.php 
    22    * @author Copyright (C) 2005 Philippe April 
    23    */ 
     2 
     3/********************************************************************\ 
     4 * This program is free software; you can redistribute it and/or    * 
     5 * modify it under the terms of the GNU General Public License as   * 
     6 * published by the Free Software Foundation; either version 2 of   * 
     7 * the License, or (at your option) any later version.              * 
     8 *                                                                  * 
     9 * This program is distributed in the hope that it will be useful,  * 
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of   * 
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    * 
     12 * GNU General Public License for more details.                     * 
     13 *                                                                  * 
     14 * You should have received a copy of the GNU General Public License* 
     15 * along with this program; if not, contact:                        * 
     16 *                                                                  * 
     17 * Free Software Foundation           Voice:  +1-617-542-5942       * 
     18 * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       * 
     19 * Boston, MA  02111-1307,  USA       gnu@gnu.org                   * 
     20 *                                                                  * 
     21 \********************************************************************/ 
     22/**@file stats_user_id.inc.php 
     23 * @author Copyright (C) 2005 Philippe April 
     24 */ 
    2425 
    2526$userinfo = $userObject->getInfoArray(); 
     
    2728 
    2829$html .= "<fieldset class='pretty_fieldset'>\n"; 
    29 $html .= "<legend>" . _("Profile") . "</legend>\n"; 
     30$html .= "<legend>"._("Profile")."</legend>\n"; 
    3031 
    3132$html .= "<table>\n"; 
    3233 
    3334$html .= "<tr class='odd'>\n"; 
    34 $html .= "  <th>" . _("Username") . ":</th>\n"; 
    35 $html .= "  <td>" . $userinfo['username'] . "</td>\n"; 
     35$html .= "  <th>"._("Username").":</th>\n"; 
     36$html .= "  <td>".$userinfo['username']."</td>\n"; 
    3637$html .= "</tr>\n"; 
    3738 
    3839$html .= "<tr>\n"; 
    39 $html .= "  <th>" . _("Real Name") . ":</th>\n"; 
    40 $html .= "  <td>" . $userinfo['real_name'] . "</td>\n"; 
     40$html .= "  <th>"._("Real Name").":</th>\n"; 
     41$html .= "  <td>".$userinfo['real_name']."</td>\n"; 
    4142$html .= "</tr>\n"; 
    4243 
    4344$html .= "<tr class='odd'>\n"; 
    44 $html .= "  <th>" . _("Email") . ":</th>\n"; 
    45 $html .= "  <td>" . $userinfo['email'] . "</td>\n"; 
     45$html .= "  <th>"._("Email").":</th>\n"; 
     46$html .= "  <td>".$userinfo['email']."</td>\n"; 
    4647$html .= "</tr>\n"; 
    4748 
    4849$html .= "<tr>\n"; 
    49 $html .= "  <th>" . _("Network") . ":</th>\n"; 
     50$html .= "  <th>"._("Network").":</th>\n"; 
    5051$html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&network_id={$userinfo['account_origin']}'>{$userinfo['account_origin']}</a></td>\n"; 
    5152$html .= "</tr>\n"; 
    5253 
    5354$html .= "<tr class='odd'>\n"; 
    54 $html .= "  <th>" . _("Unique ID") . ":</th>\n"; 
    55 $html .= "  <td>" . $userinfo['user_id'] . "</td>\n"; 
     55$html .= "  <th>"._("Unique ID").":</th>\n"; 
     56$html .= "  <td>".$userinfo['user_id']."</td>\n"; 
    5657$html .= "</tr>\n"; 
    5758 
    5859$html .= "<tr>\n"; 
    59 $html .= "  <th>" . _("Member since") . ":</th>\n"; 
    60 $html .= "  <td>" . utf8_encode(strftime("%c", strtotime($userinfo['reg_date']))) . "</td>\n"; 
     60$html .= "  <th>"._("Member since").":</th>\n"; 
     61$html .= "  <td>".utf8_encode(strftime("%c", strtotime($userinfo['reg_date'])))."</td>\n"; 
    6162$html .= "</tr>\n"; 
    6263 
    6364$html .= "<tr class='odd'>\n"; 
    64 $html .= "  <th>" . _("Account Status") . ":</th>\n"; 
    65 $html .= "  <td>" . $userinfo['account_status_description'] . "</td>\n"; 
     65$html .= "  <th>"._("Account Status").":</th>\n"; 
     66$html .= "  <td>".$userinfo['account_status_description']."</td>\n"; 
    6667$html .= "</tr>\n"; 
    6768 
    6869$html .= "<tr>\n"; 
    69 $html .= "  <th>" . _("Website") . ":</th>\n"; 
    70 $html .= "  <td>" . $userinfo['website'] . "</td>\n"; 
     70$html .= "  <th>"._("Website").":</th>\n"; 
     71$html .= "  <td>".$userinfo['website']."</td>\n"; 
    7172$html .= "</tr>\n"; 
    7273 
    7374$html .= "<tr class='odd'>\n"; 
    74 $html .= "  <th>" . _("Prefered Locale") . ":</th>\n"; 
    75 $html .= "  <td>" . $userinfo['prefered_locale'] . "</td>\n"; 
     75$html .= "  <th>"._("Prefered Locale").":</th>\n"; 
     76$html .= "  <td>".$userinfo['prefered_locale']."</td>\n"; 
    7677$html .= "</tr>\n"; 
    7778 
     
    8182 
    8283$html .= "<tr>\n"; 
    83 $html .= "  <th>" . _("MAC addresses") . ":</th>\n"; 
    84 $html .= "  <td>" . $amount_of_mac_addresses . "</td>\n"; 
     84$html .= "  <th>"._("MAC addresses").":</th>\n"; 
     85$html .= "  <td>".$amount_of_mac_addresses."</td>\n"; 
    8586$html .= "</tr>\n"; 
    8687 
     
    8990 
    9091$html .= "<fieldset class='pretty_fieldset'>\n"; 
    91 $html .= "<legend>" . _("Connections") . "</legend>\n"; 
     92$html .= "<legend>"._("Connections")."</legend>\n"; 
    9293$html .= "<table class='smaller'>\n"; 
    9394$html .= "<thead>\n"; 
    9495$html .= "<tr>\n"; 
    95 $html .= "  <th>" . _("Logged in") . "</th>\n"; 
    96 $html .= "  <th>" . _("Time spent") . "</th>\n"; 
    97 $html .= "  <th>" . _("Token status") . "</th>\n"; 
    98 $html .= "  <th>" . _("Node") . "</th>\n"; 
    99 $html .= "  <th>" . _("IP") . "</th>\n"; 
    100 $html .= "  <th>" . _("D") . "</th>\n"; 
    101 $html .= "  <th>" . _("U") . "</th>\n"; 
     96$html .= "  <th>"._("Logged in")."</th>\n"; 
     97$html .= "  <th>"._("Time spent")."</th>\n"; 
     98$html .= "  <th>"._("Token status")."</th>\n"; 
     99$html .= "  <th>"._("Node")."</th>\n"; 
     100$html .= "  <th>"._("IP")."</th>\n"; 
     101$html .= "  <th>"._("D")."</th>\n"; 
     102$html .= "  <th>"._("U")."</th>\n"; 
    102103$html .= "</tr>\n"; 
    103104$html .= "</thead>\n"; 
     
    109110if ($connections) 
    110111{ 
    111     $even = 0; 
    112     foreach ($connections as $connection) 
    113     { 
    114         $timestamp_in = strtotime($connection['timestamp_in']); 
    115         $timestamp_out = strtotime($connection['timestamp_out']); 
     112        // Variables init 
     113        $even = 0; 
     114        $total = array (); 
     115        $total['incoming'] = 0; 
     116        $total['outgoing'] = 0; 
     117        foreach ($connections as $connection) 
     118        { 
     119                $timestamp_in = strtotime($connection['timestamp_in']); 
     120                $timestamp_out = strtotime($connection['timestamp_out']); 
    116121 
    117         $nodeObject = Node::getObject($connection['node_id']); 
    118         $total['incoming'] += $connection['incoming']; 
    119         $total['outgoing'] += $connection['outgoing']; 
    120         $connection['token_status_description'] = $token_to_text[$connection['token_status']]; 
    121         $html .= $even ? "<tr>\n" : "<tr class='odd'>\n"; 
    122         if ($even == 0) 
    123             $even = 1; 
    124         else 
    125             $even = 0; 
    126         $html .= "  <td>" . utf8_encode(strftime("%c", $timestamp_in)) . "</td>\n"; 
    127         if ($timestamp_in != -1 && $timestamp_out != -1) { 
    128             $html .= "<td>" . seconds_in_words($timestamp_out - $timestamp_in) . "</td>\n"; 
    129         } else { 
    130             $html .= "<td></td>\n"; 
    131         } 
    132         $html .= "  <td>" . $connection['token_status'] . "</td>\n"; 
    133         $html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&node_id={$nodeObject->getId()}'>{$nodeObject->getName()}</a></td>\n"; 
    134         $html .= "  <td>" . $connection['user_ip'] . "</td>\n"; 
    135         $html .= "  <td>" . bytes_in_words($connection['incoming']) . "</td>\n"; 
    136         $html .= "  <td>" . bytes_in_words($connection['outgoing']) . "</td>\n"; 
    137         $html .= "</tr>\n"; 
    138     } 
     122                $nodeObject = Node :: getObject($connection['node_id']); 
     123                $total['incoming'] += $connection['incoming']; 
     124                $total['outgoing'] += $connection['outgoing']; 
     125                         
     126                $connection['token_status_description'] = $token_to_text[$connection['token_status']]; 
     127                $html .= $even ? "<tr>\n" : "<tr class='odd'>\n"; 
     128                if ($even == 0) 
     129                        $even = 1; 
     130                else 
     131                        $even = 0; 
     132                $html .= "  <td>".utf8_encode(strftime("%c", $timestamp_in))."</td>\n"; 
     133                if ($timestamp_in != -1 && $timestamp_out != -1) 
     134                { 
     135                        $html .= "<td>".seconds_in_words($timestamp_out - $timestamp_in)."</td>\n"; 
     136                } 
     137                else 
     138                { 
     139                        $html .= "<td></td>\n"; 
     140                } 
     141                $html .= "  <td>".$connection['token_status']."</td>\n"; 
     142                $html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&node_id={$nodeObject->getId()}'>{$nodeObject->getName()}</a></td>\n"; 
     143                $html .= "  <td>".$connection['user_ip']."</td>\n"; 
     144                $html .= "  <td>".bytes_in_words($connection['incoming'])."</td>\n"; 
     145                $html .= "  <td>".bytes_in_words($connection['outgoing'])."</td>\n"; 
     146                $html .= "</tr>\n"; 
     147        } 
    139148} 
    140149 
     
    144153$html .= "  <td></td>\n"; 
    145154$html .= "  <td></td>\n"; 
    146 $html .= "  <th>" . _("Total") . ":</th>\n"; 
    147 $html .= "  <th>" . bytes_in_words($total['incoming']) . "</th>\n"; 
    148 $html .= "  <th>" . bytes_in_words($total['outgoing']) . "</th>\n"; 
     155$html .= "  <th>"._("Total").":</th>\n"; 
     156$html .= "  <th>".bytes_in_words($total['incoming'])."</th>\n"; 
     157$html .= "  <th>".bytes_in_words($total['outgoing'])."</th>\n"; 
    149158$html .= "</tr>\n"; 
    150159$html .= "</table>\n"; 
     
    155164 
    156165$html .= "<fieldset class='pretty_fieldset'>\n"; 
    157 $html .= "<legend>" . _("MAC addresses") . "</legend>\n"; 
     166$html .= "<legend>"._("MAC addresses")."</legend>\n"; 
    158167$html .= "<table>\n"; 
    159168$html .= "<thead>\n"; 
    160169$html .= "<tr>\n"; 
    161 $html .= "  <th>" . _("MAC") . "</th>\n"; 
    162 $html .= "  <th>" . _("Count") . "</th>\n"; 
     170$html .= "  <th>"._("MAC")."</th>\n"; 
     171$html .= "  <th>"._("Count")."</th>\n"; 
    163172$html .= "</tr>\n"; 
    164173$html .= "</thead>\n"; 
    165174 
    166175$even = 0; 
    167 foreach ($rows as $row) { 
    168     if ($row['user_mac']) { 
    169         $html .= $even ? "<tr>\n" : "<tr class='odd'>\n"; 
    170         if ($even == 0) 
    171             $even = 1; 
    172         else 
    173             $even = 0; 
    174         $html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&user_mac={$row['user_mac']}'>{$row['user_mac']}</a></td>\n"; 
    175         $html .= "  <td>" . $row['nb'] . "</td>\n"; 
    176         $html .= "</tr>\n"; 
    177     } 
     176foreach ($rows as $row) 
     177{ 
     178        if ($row['user_mac']) 
     179        { 
     180                $html .= $even ? "<tr>\n" : "<tr class='odd'>\n"; 
     181                if ($even == 0) 
     182                        $even = 1; 
     183                else 
     184                        $even = 0; 
     185                $html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&user_mac={$row['user_mac']}'>{$row['user_mac']}</a></td>\n"; 
     186                $html .= "  <td>".$row['nb']."</td>\n"; 
     187                $html .= "</tr>\n"; 
     188        } 
    178189} 
    179190 
  • trunk/wifidog-auth/wifidog/admin/stats_user_mac.inc.php

    r726 r731  
    11<?php 
    2   /********************************************************************\ 
    3    * This program is free software; you can redistribute it and/or    * 
    4    * modify it under the terms of the GNU General Public License as   * 
    5    * published by the Free Software Foundation; either version 2 of   * 
    6    * the License, or (at your option) any later version.              * 
    7    *                                                                  * 
    8    * This program is distributed in the hope that it will be useful,  * 
    9    * but WITHOUT ANY WARRANTY; without even the implied warranty of   * 
    10    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    * 
    11    * GNU General Public License for more details.                     * 
    12    *                                                                  * 
    13    * You should have received a copy of the GNU General Public License* 
    14    * along with this program; if not, contact:                        * 
    15    *                                                                  * 
    16    * Free Software Foundation           Voice:  +1-617-542-5942       * 
    17    * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       * 
    18    * Boston, MA  02111-1307,  USA       gnu@gnu.org                   * 
    19    *                                                                  * 
    20    \********************************************************************/ 
    21   /**@file stats_user_mac.inc.php 
    22    * @author Copyright (C) 2005 Philippe April 
    23    */ 
     2 
     3/********************************************************************\ 
     4 * This program is free software; you can redistribute it and/or    * 
     5 * modify it under the terms of the GNU General Public License as   * 
     6 * published by the Free Software Foundation; either version 2 of   * 
     7 * the License, or (at your option) any later version.              * 
     8 *                                                                  * 
     9 * This program is distributed in the hope that it will be useful,  * 
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of   * 
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    * 
     12 * GNU General Public License for more details.                     * 
     13 *                                                                  * 
     14 * You should have received a copy of the GNU General Public License* 
     15 * along with this program; if not, contact:                        * 
     16 *                                                                  * 
     17 * Free Software Foundation           Voice:  +1-617-542-5942       * 
     18 * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       * 
     19 * Boston, MA  02111-1307,  USA       gnu@gnu.org                   * 
     20 *                                                                  * 
     21 \********************************************************************/ 
     22/**@file stats_user_mac.inc.php 
     23 * @author Copyright (C) 2005 Philippe April 
     24 */ 
    2425 
    2526$sql = "select *,nodes.name,users.username from connections,nodes where nodes.node_id=connections.node_id and users.user_id=connections.user_id and user_mac = '{$_REQUEST['user_mac']}' {$date_constraint} order by timestamp_in desc"; 
     
    2728 
    2829$html .= "<fieldset class='pretty_fieldset'>\n"; 
    29 $html .= "<legend>" . _("Connections") . "</legend>\n"; 
     30$html .= "<legend>"._("Connections")."</legend>\n"; 
    3031$html .= "<table>\n"; 
    3132$html .= "<thead>\n"; 
    3233$html .= "<tr>\n"; 
    33 $html .= "  <th>" . _("Username") . "</th>\n"; 
    34 $html .= "  <th>" . _("Date") . "</th>\n"; 
    35 $html .= "  <th>" . _("Node") . "</th>\n"; 
    36 $html .= "  <th>" . _("Time spent") . "</th>\n"; 
    37 $html .= "  <th>" . _("D") . "</th>\n"; 
    38 $html .= "  <th>" . _("U") . "</th>\n"; 
     34$html .= "  <th>"._("Username")."</th>\n"; 
     35$html .= "  <th>"._("Date")."</th>\n"; 
     36$html .= "  <th>"._("Node")."</th>\n"; 
     37$html .= "  <th>"._("Time spent")."</th>\n"; 
     38$html .= "  <th>"._("D")."</th>\n"; 
     39$html .= "  <th>"._("U")."</th>\n"; 
    3940$html .= "</tr>\n"; 
    4041$html .= "</thead>\n"; 
    4142 
     43// Vars init 
    4244$even = 0; 
    43 foreach ($rows as $row) { 
    44     $timestamp_in = strtotime($row['timestamp_in']); 
    45     $timestamp_out = strtotime($row['timestamp_out']); 
     45$total = array (); 
     46$total['incoming'] = 0; 
     47$total['outgoing'] = 0; 
     48$total['time_spent'] = 0; 
     49foreach ($rows as $row) 
     50{ 
     51        $timestamp_in = strtotime($row['timestamp_in']); 
     52        $timestamp_out = strtotime($row['timestamp_out']); 
    4653 
    47     $total['incoming'] += $row['incoming']; 
    48     $total['outgoing'] += $row['outgoing']; 
     54        $total['incoming'] += $row['incoming']; 
     55        $total['outgoing'] += $row['outgoing']; 
    4956 
    50     $html .= $even ? "<tr>\n" : "<tr class='odd'>\n"; 
    51     if ($even == 0) 
    52         $even = 1; 
    53     else 
    54         $even = 0; 
    55     $html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&user_id={$row['user_id']}'>{$row['username']}</a></td>\n"; 
    56     $html .= "  <td>" . utf8_encode(strftime("%c", strtotime($row['timestamp_in']))) . "</td>"; 
    57     $html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&node_id={$row['node_id']}'>{$row['name']}</a></td>"; 
    58     if ($timestamp_in != -1 && $timestamp_out != -1) { 
    59         $total['time_spent'] += ($timestamp_out - $timestamp_in); 
    60         $html .= "  <td>" . seconds_in_words($timestamp_out - $timestamp_in) . "</td>"; 
    61     } else { 
    62         $html .= "  <td></td>"; 
    63     } 
    64     if ($row['incoming']) 
    65         $html .= "<td>" . bytes_in_words($row['incoming']) . "</td>\n"; 
    66     else 
    67         $html .= "<td></td>\n"; 
     57        $html .= $even ? "<tr>\n" : "<tr class='odd'>\n"; 
     58        if ($even == 0) 
     59                $even = 1; 
     60        else 
     61                $even = 0; 
     62        $html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&user_id={$row['user_id']}'>{$row['username']}</a></td>\n"; 
     63        $html .= "  <td>".utf8_encode(strftime("%c", strtotime($row['timestamp_in'])))."</td>"; 
     64        $html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&node_id={$row['node_id']}'>{$row['name']}</a></td>"; 
     65        if ($timestamp_in != -1 && $timestamp_out != -1) 
     66        { 
     67                $total['time_spent'] += ($timestamp_out - $timestamp_in); 
     68                $html .= "  <td>".seconds_in_words($timestamp_out - $timestamp_in)."</td>"; 
     69        } 
     70        else 
     71        { 
     72                $html .= "  <td></td>"; 
     73        } 
     74        if ($row['incoming']) 
     75                $html .= "<td>".bytes_in_words($row['incoming'])."</td>\n"; 
     76        else 
     77                $html .= "<td></td>\n"; 
    6878 
    69     if ($row['outgoing']) 
    70         $html .= "<td>" . bytes_in_words($row['outgoing']) . "</td>\n"; 
    71     else 
    72         $html .= "<td></td>\n"; 
     79        if ($row['outgoing']) 
     80                $html .= "<td>".bytes_in_words($row['outgoing'])."</td>\n"; 
     81        else 
     82                $html .= "<td></td>\n"; 
    7383 
    74     $html .= "</tr>"; 
     84        $html .= "</tr>"; 
    7585} 
    7686 
     
    7888$html .= "  <td></td>\n"; 
    7989$html .= "  <td></td>\n"; 
    80 $html .= "  <th>" . _("Total") . ":</th>\n"; 
    81 $html .= "  <th>" . seconds_in_words($total['time_spent']) . "</th>\n"; 
    82 $html .= "  <th>" . bytes_in_words($total['incoming']) . "</th>\n"; 
    83 $html .= "  <th>" . bytes_in_words($total['outgoing']) . "</th>\n"; 
     90$html .= "  <th>"._("Total").":</th>\n"; 
     91$html .= "  <th>".seconds_in_words($total['time_spent'])."</th>\n"; 
     92$html .= "  <th>".bytes_in_words($total['incoming'])."</th>\n"; 
     93$html .= "  <th>".bytes_in_words($total['outgoing'])."</th>\n"; 
    8494$html .= "</tr>\n"; 
    8595