-
Notifications
You must be signed in to change notification settings - Fork 0
/
statistic.php
162 lines (137 loc) · 3.4 KB
/
statistic.php
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
session_start();
$_SESSION["group"] = get_session();
$_SESSION["log"] = get_login();
if (isset($_SESSION['userName'])) {
$root = $_SESSION['userName'];
if ($_SESSION['userName'] == 'User') {
include("configCSS_adm.html");
include("header_op.php");
} else if ($_SESSION['userName'] == 'Root') {
include("configCSS_adm.html");
include("header_op.php");
} else {
include("configCSS.html");
include("header.php");
}
} else {
include("configCSS.html");
include("header.php");
}
include("config.php");
function get_session()
{
if (isset($_SESSION['userName'])) {
return $_SESSION['userName'];
} else {
return '';
}
}
function get_login() {
if(isset($_SESSION['login'])) {
return $_SESSION['login'];
} else {
return '';
}
}
?>
<html>
<head>
<title>Catalogue [Invite]</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Grossiste3D [Invite]</title>
<?php
$sqlgraph = 'SELECT CONCAT(UNIX_TIMESTAMP(rating.dateOfPub),"000") as "date", rating.rate as "rat" FROM rating' ;
$resultarray = array();
if ($result = mysqli_query($conn, $sqlgraph)) {
while ($rowa = mysqli_fetch_row($result)) {
$resultarray[] = $rowa;
}
$data = '{"user_notes":'.json_encode($resultarray, JSON_NUMERIC_CHECK).'}';
}
file_put_contents("assets/data.json", "");
$file = 'assets/data.json';
file_put_contents($file, $data, FILE_APPEND | LOCK_EX);
?>
<script>
window.onload = function() {
var dataPoints = [];
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
theme: "dark2",
zoomEnabled: true,
title: {
text: "Avis utilisateurs sur tous les produits du site"
},
axisY: {
title: "Notes utilisateurs",
titleFontSize: 24,
prefix: ""
},
data: [{
type: "scatter",
yValueFormatString: "#,##0.00",
dataPoints: dataPoints,
markerType: "circle",
markerSize: 20
}]
});
function addData(data) {
var dps = data.user_notes;
for (var i = 0; i < dps.length; i++) {
dataPoints.push({
x: new Date(dps[i][0]),
y: dps[i][1]
});
}
chart.render();
}
$.getJSON("assets/data.json", addData);
}
</script>
</head>
<body>
<h2 id=filtre>🔎 Toutes les statistiques du site 🔍</h2>
<div class="box">
<form method="post" action="stat_liste_user.php">
<div class="col">
<div class=formulaire>
<input type="submit" value="Liste utilisateur" name="userlist">
</div>
</div>
</form>
</div>
<h2 id=filtre>Nombre d'utilisateurs =
<?php
$sql = 'SELECT COUNT(*) as "nbuser" FROM utilisateur';
$result = mysqli_fetch_assoc(mysqli_query($conn, $sql));
echo $result['nbuser'];
?>
</h2>
<h2 id=filtre>Nombre d'accessoires =
<?php
$sql2 = 'SELECT COUNT(*) as "nbaccessory" FROM accessory';
$result2 = mysqli_fetch_assoc(mysqli_query($conn, $sql2));
echo $result2['nbaccessory'];
?>
</h2>
<h2 id=filtre>Nombre de machines =
<?php
$sql3 = 'SELECT COUNT(*) as "nbmachine" FROM machine';
$result3 = mysqli_fetch_assoc(mysqli_query($conn, $sql3));
echo $result3['nbmachine'];
?>
</h2>
<h2 id=filtre>Nombre de filaments =
<?php
$sql4 = 'SELECT COUNT(*) as "nbfilament" FROM filament';
$result4 = mysqli_fetch_assoc(mysqli_query($conn, $sql4));
echo $result4['nbfilament'];
?>
</h2>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://canvasjs.com/assets/script/jquery-1.11.1.min.js"></script>
<script src="https://canvasjs.com/assets/script/jquery.canvasjs.min.js"></script>
</body>
</html>