-
Notifications
You must be signed in to change notification settings - Fork 0
/
print.php
61 lines (52 loc) · 1.67 KB
/
print.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
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Classregister - Print</title>
<meta name="robots" content="noindex, nofollow"/>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="print.css" media="print">
</head>
<body>
<p style="text-align: center;">
<button onclick="window.print();" class="btn btn-primary" id="print-btn" style="margin-top: 50px;">Print</button></p>
<div style="margin-top: 60px">
<?php
include 'database.php';
$table=$_GET['t'];
$r="select tablename from usertable where token='".$table."'";
$r2=mysqli_query($con,$r);
$r3=mysqli_fetch_array($r2);
$tablename=$r3['tablename'];
$k="select * from ".$r3['tablename'];
$k2=mysqli_query($con,$k);
$k3=mysqli_fetch_assoc($k2);
$k4=array_keys($k3);
//$tablename=openssl_decrypt($table, 'AES-128-ECB', "SECRET");
$query="select * from ".$tablename." where 1";
$result=mysqli_query($con, $query);
if (mysqli_num_rows($result)<1) echo "Table is empty";
else
{
$row=mysqli_fetch_assoc($result);
echo '<table class="table table-bordered">';
echo "<tr>";
echo "<th>".join("</th><th>",array_keys($row))."</th>";
echo "</tr>";
while ($row)
{
echo "<tr>";
echo "<td>".join("</td><td>",$row)."</td>";
echo "</tr>";
$row=mysqli_fetch_assoc($result);
}
echo "</table>";
}
?>
</div>
</body>
</html>