diff options
| author | Nathan Kinkade <nkinkade@creativecommons.org> | 2014-05-19 18:18:52 -0400 |
|---|---|---|
| committer | Nathan Kinkade <nkinkade@creativecommons.org> | 2014-05-19 18:18:52 -0400 |
| commit | fea92fb73fc066701a4e5e578edee7d737045a41 (patch) | |
| tree | 8475a74fb159756896e90a802eca32e2545ed86d /export.php | |
| parent | 03a01ac31a16cf7f44e827db15b7483b0ec330cd (diff) | |
| parent | c1ea47789989b08e919645d8b8133cfea0ad97c9 (diff) | |
Diffstat (limited to 'export.php')
| -rw-r--r-- | export.php | 24 |
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); + +?> |
