-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonth.php
More file actions
37 lines (32 loc) · 1.29 KB
/
month.php
File metadata and controls
37 lines (32 loc) · 1.29 KB
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
<?php
$CONFIGFILE = getcwd() . "/config.php";
require_once($CONFIGFILE);
$MONTH = htmlspecialchars($_GET["SelectMonth"]);
$PRINTER = htmlspecialchars($_GET["SelectPrinter"]);
if ((!empty($MONTH)) && (!empty($PRINTER)))
{
$PrintQuery = "SELECT DateTime, User, Pages, Copies, DocumentName, Client FROM data "
. "WHERE Printer=\"" . $PRINTER . "\" AND "
. "DateTime BETWEEN \"" . $MONTH . "-01 00:00:00\" AND \"" . date("Y-m-t", strtotime($MONTH)) . " 23:59:59\";";
$date = date_create_from_format('Y-m', $MONTH);
echo "Printer \"". $PRINTER . "\" at " . date_format($date, 'F Y');
$dbconnect = mysql_connect($DBHOST, $DBUSER, $DBPASS);
if ($dbconnect)
{
if (mysql_select_db($DBNAME))
{
echo "<table border=1>";
echo "<tr><td><b>Date, time</b></td><td><b>User</b></td><td><b>Pages</b></td><td><b>Copies</b></td><td><b>Document</b></td><td><b>Client</b></td></tr>";
$PrintResult = mysql_query($PrintQuery);
$PrintArray;
//echo $PrintQuery;
while ($PrintArray = mysql_fetch_array($PrintResult))
{
echo "<tr><td>" . $PrintArray[0] . "</td><td>" . $PrintArray[1] . "</td><td>" . $PrintArray[2] . "</td><td>" . $PrintArray[3] . "</td><td>" . $PrintArray[4] . "</td><td>" . $PrintArray[5] . "</td></tr>";
}
echo "</table>";
mysql_close();
}
}
}
?>