diff options
Diffstat (limited to 'stats.php')
-rw-r--r-- | stats.php | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/stats.php b/stats.php new file mode 100644 index 0000000..a69849d --- /dev/null +++ b/stats.php | |||
@@ -0,0 +1,90 @@ | |||
1 | <?php | ||
2 | try | ||
3 | { | ||
4 | $base = new PDO('mysql:host=localhost;dbname=ordipolo;charset=utf8', 'root', 'qsdfgh'); | ||
5 | } | ||
6 | catch (Exception $e) | ||
7 | { | ||
8 | die('Erreur : ' . $e->getMessage()); | ||
9 | } | ||
10 | ?> | ||
11 | <!DOCTYPE html> | ||
12 | <html lang="fr" > | ||
13 | <head> | ||
14 | <meta charset="utf-8" /> | ||
15 | <title>visites du site</title> | ||
16 | <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" /> | ||
17 | <link rel="icon" type="image/png" href="images/favicon.png" > | ||
18 | <link rel="stylesheet" href="ordipolo.css" /> | ||
19 | <meta name="robots" content="noindex" > | ||
20 | <style> | ||
21 | th, td | ||
22 | { | ||
23 | padding: 2px; | ||
24 | border-collapse: collapse; | ||
25 | font-size: 85%; | ||
26 | } | ||
27 | .user_agent | ||
28 | { | ||
29 | min-width: 500px; | ||
30 | } | ||
31 | </style> | ||
32 | </head> | ||
33 | |||
34 | <body> | ||
35 | <div id="bloc_page" > | ||
36 | <header> | ||
37 | <?php $actuelle = ""; ?> | ||
38 | <?php include ("menu.php"); ?> | ||
39 | |||
40 | <p><a href="index.php" > | ||
41 | <img id="logohaut" src="images/logo.png" alt="ordipolo" /> | ||
42 | <img id="logotitre" src="images/ordipolo.png" alt="ordipolo" /></a></p> | ||
43 | </header> | ||
44 | <!-- compteur --> | ||
45 | <table border="1" > | ||
46 | <caption>Compteur de visites</caption> | ||
47 | <tr> | ||
48 | <th>Visiteurs</th> | ||
49 | <!-- <th>Bots</th> --> | ||
50 | </tr> | ||
51 | <tr> | ||
52 | <?php | ||
53 | $reponse = $base->query('SELECT visiteurs FROM compteur'); | ||
54 | $nombre = $reponse->fetch(); | ||
55 | echo ('<td>' . $nombre['visiteurs'] . '</td>'); | ||
56 | |||
57 | //~ $reponse = $base->query('SELECT bots FROM compteur'); | ||
58 | //~ $nombre = $reponse->fetch(); | ||
59 | //~ echo ('<td>' . $nombre['bots'] . '</td>'); | ||
60 | ?> | ||
61 | </tr> | ||
62 | </table> | ||
63 | |||
64 | <!-- détail des enregistrements --> | ||
65 | <table border="1" > | ||
66 | <caption><br/>Visiteurs</caption> | ||
67 | |||
68 | <tr> | ||
69 | <th>IP</th> | ||
70 | <th>Hôte</th> | ||
71 | <th class="user_agent">User_agent</th> | ||
72 | <th>Date</th> | ||
73 | <th>Nombre de pages</th> | ||
74 | </tr> | ||
75 | |||
76 | <?php | ||
77 | $reponse = $base->query('SELECT ip, hote, user_agent, DATE_FORMAT(date, \'%d/%m/%Y\') AS date_, nb_pages FROM visites'); | ||
78 | while ($donnees = $reponse->fetch()) | ||
79 | { | ||
80 | echo ('<tr><td>' . $donnees['ip'] . '</td>'); | ||
81 | echo ('<td>' . $donnees['hote'] . '</td>'); | ||
82 | echo ('<td class="user_agent">' . $donnees['user_agent'] . '</td>'); | ||
83 | echo ('<td>' . $donnees['date_'] . '</td>'); | ||
84 | echo ('<td>' . $donnees['nb_pages'] . '</td></tr>'); | ||
85 | } | ||
86 | ?> | ||
87 | </table> | ||
88 | </div> | ||
89 | <body> | ||
90 | </html> | ||