source: trunk/admin/historique.php @ 10

Last change on this file since 10 was 10, checked in by z0rglub, 21 years ago

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1<?php
2/***************************************************************************
3 *                 historique.php is a part of PhpWebGallery               *
4 *                            -------------------                          *
5 *   last update          : Monday, July 15, 2002                          *
6 *   email                : pierrick@z0rglub.com                           *
7 *                                                                         *
8 ***************************************************************************/
9
10/***************************************************************************
11 *                                                                         *
12 *   This program is free software; you can redistribute it and/or modify  *
13 *   it under the terms of the GNU General Public License as published by  *
14 *   the Free Software Foundation;                                         *
15 *                                                                         *
16 ***************************************************************************/
17        include_once( "./include/isadmin.inc.php" );
18       
19        if ( $HTTP_GET_VARS['empty'] == 1 )
20        {
21                mysql_query( "delete from PREFIX_TABLE"."history;" );
22        }
23        define (NB_JOUR_HISTO,"7");
24        $tMois  = array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre");
25        $tJours = array("dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi");
26       
27        // on affiche les visites pour les 48 dernières heures
28        // il faut trouver le unix date de la veille à 00h00 :
29        // time (); nous donne le nombre de secondes actuelle
30        $date_ref = time() - (7*24*60*60);
31        $result = mysql_query( "select date,login,IP,categorie,page,titre,commentaire from PREFIX_TABLE"."history where date > '$date_ref' order by date desc;");
32        echo"<div style=\"text-align:center;\"><a href=\"".add_session_id_to_url( "./admin.php?page=historique&amp;empty=1" )."\">empty / vider</a></div>";
33        echo"<div style=\"color:green;text-align:center;margin:10px\">";
34        // affichage de la date du jour
35        echo $tJours[date("w")] ." "; 
36        echo date("j").(date("j") == 1 ? "er " : " "); 
37        echo $tMois[date("n")-1]." ".date("Y")." ";
38        echo " à ".date("G")."h".date("i");
39        echo"</div>";
40?>
41                <table width='100%'>
42                                <tr>
43                                        <th width='1%'>date</th>
44                                        <th>login</th>
45                                        <th>IP</th>
46                                        <th>page</th>
47                                        <th>categorie</th>
48                                        <th>image</th>
49                                </tr>
50                                <tr>
51                                                <td colspan=7 height=5><div class='style1'></div></td>
52                                </tr>
53                        <?
54                                $fin = time();
55                                $debut = mktime ( 23,59,59,date("n"),date("j")-1,date("Y") );
56                                for ( $i = 0; $i < NB_JOUR_HISTO; $i++ )
57                                {
58                                        // 1. affichage du nom du jour
59                                        echo"   <tr>
60                                                                        <td><nobr>";
61                                        echo"<img src=\"".$conf['repertoire_image']."moins.gif\">&nbsp;&nbsp;<b>";
62                                        echo $tJours[date("w",$fin)] ." "; 
63                                        echo date("j",$fin).(date("j",$fin) == 1 ? "er " : " "); 
64                                        echo $tMois[date("n",$fin)-1]." ".date("Y",$fin)."</b>";
65                                        echo"           </nobr></td>
66                                                                                <td>&nbsp;</td>
67                                                                                <td>&nbsp;</td>
68                                                                                <td>&nbsp;</td>
69                                                                                <td>&nbsp;</td>
70                                                                                <td>&nbsp;</td>
71                                                                        </tr>";
72                                        // 2. affichage de tous les évènements pour le jour donné
73                                        // entre la veille à 23h59m59s et le jour même 23h59m59s
74                                        $result = mysql_query("select date,login,IP,categorie,page,titre,commentaire from PREFIX_TABLE"."history where date > '$debut' and date < '$fin' order by date desc;");
75                                        $fin = $debut;
76                                        // on recule le début d'une journée complète
77                                        $debut = $debut - 24*60*60;
78                                        while($row=mysql_fetch_array($result))
79                                        {
80                                                $date = date("G\hi s", $row[date]);
81                                                $date = str_replace ( " ","min ", $date );
82                                                $date .= " sec";
83                                                // on réduit la taille du commentaire à ses premiers caractères
84                                                $affichage_commentaire = "";
85                                                if($row[commentaire] != '')
86                                                {
87                                                        $affichage_commentaire = substr($row[commentaire],0,10);
88                                                        $affichage_commentaire .= "...";
89                                                }
90                                                echo"   <tr>
91                                                                                <td>&nbsp;|-&nbsp;&nbsp;$date</td>
92                                                                                <td>$row[login]</td>
93                                                                                <td>$row[IP]</td>
94                                                                                <td>$row[page]</td>
95                                                                                <td>$row[categorie]</td>
96                                                                                <td>$row[titre]</td>
97                                                                        </tr>";
98                                        }
99                                }                       
100        echo"   </table>
101                        </center>";
102?>
Note: See TracBrowser for help on using the repository browser.