summaryrefslogtreecommitdiff
path: root/export.php
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@creativecommons.org>2014-05-19 18:18:52 -0400
committerNathan Kinkade <nkinkade@creativecommons.org>2014-05-19 18:18:52 -0400
commitfea92fb73fc066701a4e5e578edee7d737045a41 (patch)
tree8475a74fb159756896e90a802eca32e2545ed86d /export.php
parent03a01ac31a16cf7f44e827db15b7483b0ec330cd (diff)
parentc1ea47789989b08e919645d8b8133cfea0ad97c9 (diff)
Manually deleted file to fix merge conflict.HEADmaster
Diffstat (limited to 'export.php')
-rw-r--r--export.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/export.php b/export.php
new file mode 100644
index 0000000..b9cdfac
--- /dev/null
+++ b/export.php
@@ -0,0 +1,24 @@
+<?php
+
+$dbh = new PDO('mysql:host=localhost;dbname=mdcc', 'mdcc', 'Mdcc.');
+
+$filename = '/var/www/dighelaw.com/www/mdcc/csv_exports/mdcc_export.csv';
+
+header('Content-Type: text/csv');
+header("Content-Disposition: attachment; filename={$filename}");
+header('Pragma: no-cache');
+
+$sql = $_REQUEST['sql'];
+$sql .= " INTO OUTFILE '{$filename}'";
+
+$st = $dbh->prepare($sql);
+if ( $st->execute() ) {
+ readfile($filename);
+} else {
+ $errors = $st->errorInfo();
+ print_r($errors);
+}
+
+unlink($filename);
+
+?>