-
Notifications
You must be signed in to change notification settings - Fork 3
/
material_releases_order_history.php
74 lines (64 loc) · 2.18 KB
/
material_releases_order_history.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
<?php
//error_reporting(E_ERROR | E_PARSE);
session_start();
require_once('config.php');
function processdata ($data){
echo '<ul>';
if (is_array($data)){
$keys=array_keys($data);
foreach ($keys as $key){
echo '<li>'.htmlspecialchars(html_entity_decode(html_entity_decode($key))).'</li>';
processdata($data[$key]);
}
}
else {
echo '<li>'.htmlspecialchars(html_entity_decode($data)).'</li>';
}
echo '</ul>';
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="<?php echo $favicon;?>" />
<link rel="stylesheet" href="./style.css" type="text/css" media="screen" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="charset" value="utf-8" />
<title><?php echo strip_tags($title); ?></title>
<meta name="description" value="<?php echo htmlspecialchars($description); ?>" />
</head>
<body>
<h1><?php echo $title; ?> - Material releases orders history</h1>
<h2>Curious about how the label is going ? Here's our history of material release orders, from newest to oldest</h2>
<?php
if (file_exists('./d/orders')&&is_dir('./d/orders')){
$orders=array_diff(scandir('./d/orders'), array('..', '.'));
$bills=Array();
foreach ($orders as $bill){
if (strstr('./d/orders/'.$bill, '.php')){
rename ('./d/orders/'.$bill, './d/orders/'.str_replace ('.php', '.dat', $bill));
$bill=str_replace ('.php', '.dat', $bill);
}
$number=explode ('-', $bill)[0];
$date=date(DATE_RSS, explode('.',explode('-', $bill)[1])[0]);
$bills[$number]['data']=unserialize(file_get_contents('./d/orders/'.$bill));
$bills[$number]['date']=$date;
}
krsort($bills);
foreach (array_keys($bills) as $billindex)
{
echo '<h2>Order number '.htmlspecialchars($billindex).'</h2>';
echo '<h4>Processed on '.htmlspecialchars($bills[$billindex]['date']).'</h4>';
processdata($bills[$billindex]['data']);
}
if (!isset($bills)||count($bills)==0){
echo '<div>No one ordered anything up-to-date. <a href="./?listall=material">Be the first ! </a></div>';
}
}
else {
echo '<div>No one ordered anything up-to-date. <a href="./?listall=material">Be the first ! </a></div>';
}
?>
</body>
</html>