summaryrefslogtreecommitdiff
path: root/stats.php
blob: a69849d4ef820f2975ac7d79586891883175b93f (plain)
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
<?php
try
{
	$base = new PDO('mysql:host=localhost;dbname=ordipolo;charset=utf8', 'root', 'qsdfgh');
}
catch (Exception $e)
{
	die('Erreur : ' . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="fr" >
    <head>
        <meta charset="utf-8" />
        <title>visites du site</title>
        <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
        <link rel="icon" type="image/png" href="images/favicon.png" >
        <link rel="stylesheet" href="ordipolo.css" />
        <meta name="robots" content="noindex" >
        <style>
        		th, td
        		{
        			padding: 2px;
					border-collapse: collapse;
					font-size: 85%;
        		}
                .user_agent
                {
                    min-width: 500px;
                }
        </style>
    </head>
    
    <body>
        <div id="bloc_page" >
        		<header>
        			<?php $actuelle = ""; ?>
					<?php include ("menu.php"); ?>
					
					<p><a href="index.php" >
                    <img id="logohaut" src="images/logo.png" alt="ordipolo" />
                    <img id="logotitre" src="images/ordipolo.png" alt="ordipolo" /></a></p>
            </header>
            	<!-- compteur -->
            	<table border="1" >
            		<caption>Compteur de visites</caption>
            		<tr>
						<th>Visiteurs</th>
                        <!-- <th>Bots</th> -->
					</tr>
					<tr>
						<?php
							$reponse = $base->query('SELECT visiteurs FROM compteur');
							$nombre = $reponse->fetch();
							echo ('<td>' . $nombre['visiteurs'] . '</td>');
							
							//~ $reponse = $base->query('SELECT bots FROM compteur');
							//~ $nombre = $reponse->fetch();
							//~ echo ('<td>' . $nombre['bots'] . '</td>');
						?>
					</tr>
            	</table>
            	
            	<!-- détail des enregistrements -->
				<table border="1" >
					<caption><br/>Visiteurs</caption>

					<tr>
						<th>IP</th>
						<th>Hôte</th>
						<th class="user_agent">User_agent</th>
						<th>Date</th>
						<th>Nombre de pages</th>
					</tr>
					
					<?php
						$reponse = $base->query('SELECT ip, hote, user_agent, DATE_FORMAT(date, \'%d/%m/%Y\') AS date_, nb_pages FROM visites');
						while ($donnees = $reponse->fetch())
						{
							echo ('<tr><td>' . $donnees['ip'] . '</td>');
							echo ('<td>' . $donnees['hote'] . '</td>');
							echo ('<td class="user_agent">' . $donnees['user_agent'] . '</td>');
							echo ('<td>' . $donnees['date_'] . '</td>');
							echo ('<td>' . $donnees['nb_pages'] . '</td></tr>');
						}
					?>
				</table>        
        </div>
    <body>
</html>