forked from dacduong/escpos-printer-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
printer-page.php
46 lines (46 loc) · 1.04 KB
/
printer-page.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
<html>
<head>
<title>Printer Page</title>
<style>
.container {
width: 100%;
}
.device {
border:1px solid;
width:400px;
height:600px;
float: left;
}
.device-content {
max-height:520px;
background-color: #EBEBEB;
overflow:auto;
}
</style>
</head>
<body>
<div class="container">
<?php
$files = $_GET['files'];
$file_arr = explode(',', $files);
foreach ($file_arr as $filename) {
$file = getcwd().'/tmp/'.$filename;
$content = @file_get_contents($file);
if ($content === false) {
echo "<div class='device'>File $filename: not found</div>";
continue;
}
$content = htmlspecialchars($content);
$content = nl2br($content);
echo "<div class='device'><p class='title'>$filename</p><div class='device-content'>$content</div></div>";
}
?>
</div>
<script>
var x = document.getElementsByClassName("device-content");
for (var i = 0; i < x.length; i++) {
x[i].scrollTop = x[i].scrollHeight;
}
</script>
</body>
</html>