forked from wp-plugins/wordpress-form-manager
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetcsv.php
executable file
·44 lines (34 loc) · 935 Bytes
/
getcsv.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
<?php
function include_wp_head($src)
{
$paths = array(
".",
"..",
"../..",
"../../..",
"../../../..",
"../../../../..",
"../../../../../..",
"../../../../../../.."
);
foreach ($paths as $path) {
if(file_exists($path . '/' . $src)) {
return $path . '/' . $src;
}
}
}
$include = include_wp_head('wp-load.php');
include_once($include);
global $fmdb;
if ( isset( $_REQUEST[ 'q' ] ) ){
$key = $_REQUEST[ 'q' ];
$query = get_option( 'fm-csv-query-'.$key );
$csvData = $fmdb->getFormSubmissionDataCSV($_REQUEST['id'], $query);
$formInfo = $fmdb->getForm($_REQUEST['id']);
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=\"".$formInfo['title'].".csv\"");
header("Pragma: no-cache");
header("Expires: 0");
echo $csvData;
}
?>