-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpdf_viewer.php
36 lines (33 loc) · 1.15 KB
/
pdf_viewer.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
<?php
define('WP_USE_THEMES', false);
require('../../../wp-blog-header.php'); #modify to match path of that file on your server
include_once('url_path_config.php');
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
$tableName = $wpdb->prefix . 'pdffiles';
$query = 'SELECT * FROM ' . $tableName . ' WHERE file_token="' . trim($_REQUEST['pdfFile']) . '"';
$getData = $wpdb->get_results($query);
$fileName = explode("-", trim($getData[0]->filename));
$count = count($getData);
if ($count == 1) {
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PDF | <?php echo trim($fileName[0]); ?></title>
</head>
<style>
iframe {
width: 98%;
margin: 0px auto;
height: 100%;
}
</style>
<body>
<iframe src="https://docs.google.com/gview?url=<?php echo zPDFpopupViewer_UPLOADS_URL . trim($getData[0]->filename); ?>&embedded=true" frameborder="0"></iframe>
</body>
</html>
<?php } else { ?>
<div style="padding:30px; text-align:center; position: relative; top: 40%; background: #ccc; box-shadow:0px 0px 2px #333333 inset;"><strong>We did not find any file for view!</strong></div>
<?php } ?>