-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom.php
53 lines (52 loc) · 1.66 KB
/
custom.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
<?php
include("functions.php");
include("accesscontrol.php");
header1(_("Custom Report"));
$result = sqlquery_checked("SELECT * FROM custom WHERE CustomName='".$_POST['customname']."'");
$custom = mysqli_fetch_object($result);
if ($custom->IsTable) {
?>
<link rel="stylesheet" href="style.php?table=1" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#mainTable").tablesorter({
});
});
</script>
<?php
} else {
echo "<style>\n".$custom->CSS."/n</style>\n";
}
header2($custom->IsTable);
$result = sqlquery_checked(str_replace("%PIDS%",$_POST['pids'],$custom->SQL));
$fields = mysqli_num_fields($result);
$rows = mysqli_num_rows($result);
if ($custom->IsTable) {
echo "<table id=\"mainTable\" class=\"tablesorter\">\n <thead>\n <tr>\n";
for ($i=0; $i<$fields; $i++) {
echo (" <th nowrap>".mysqli_fetch_field_direct($result,$i)->name."</th>\n");
}
echo " </tr>\n </thead>\n <tbody>\n";
while ($row_array = mysqli_fetch_row($result)) {
echo " <tr>\n";
for ($i=0; $i<$fields; $i++) {
if (substr($row_array[$i],0,2)=="<a") {
echo (" <td nowrap>".$row_array[$i]."</td>\n");
} else {
echo (" <td nowrap>".d2h($row_array[$i])."</td>\n");
}
}
echo " </tr>\n";
}
echo " </tbody>\n</table>\n";
} else { // plain output (depend on SQL and CSS to format it)
while ($row_array = mysqli_fetch_row($result)) {
for ($i=0; $i<$fields; $i++) {
echo ($row_array[$i]);
}
}
}
footer();
?>