-
Notifications
You must be signed in to change notification settings - Fork 0
/
document.php
48 lines (40 loc) · 1.42 KB
/
document.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
<html>
<head>
<meta charset="UTF-8">
<title>Search</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<style>
body{margin-top:50px;
color: #444;
}
.glyphicon { margin-right:10px; }
.panel-body { padding:0px; }
.panel-body table tr td { padding-left: 15px }
.panel-body .table {margin-bottom: 0px; }
.container{
margin-left: 80px;
}
</style>
</head>
<body>
<div class="container">
<button class="btn btn-primary" onClick="javascript:window.print()"><span class="glyphicon glyphicon-print"></span>Print</button>
<?php
//getting the id from the query string
$query_string = $_SERVER['QUERY_STRING'];
$id = $_GET['doc'];
//fetching the documents from the storage folder
$filename = "storage/".$id.".txt";
//unserialize the document and displaying it
$lines = file_get_contents($filename);
$lines = unserialize($lines);
foreach($_GET['words'] as $index => $words)
$lines[3] = str_replace($_GET['words'][$index], "<b>" .$_GET['words'][$index]. "</b>",$lines[3]);
echo "<h2>" .$lines[0] . "</h2> <h3>".$lines[1]."</h3><h4>".$lines[2]."</h4>";
echo nl2br($lines[3]);
?>
</div>
</body>
</html>