This commit is contained in:
Administrador de Red 2018-10-18 14:37:28 -03:00
commit 17c1a8d821

View File

@ -7,6 +7,7 @@ use Slim\Http\Response;
$app->add(new Tuupola\Middleware\HttpBasicAuthentication([
"path" => ["/inscriptos", "inscriptoscsv"], /* or ["/admin", "/api"] */
"realm" => "Protected",
"secure" => true,
"users" => [
"admin" => "puntofijo"
]
@ -77,8 +78,9 @@ $app->get('/inscriptos', function(Request $request, Response $response, array $a
$app->get('/inscriptoscsv', function(Request $request, Response $response, array $args){
$this->logger->info("GDDWorkshop '/practicalinfo' route");
$dbfile = $this->settings['db']['path'];
exec('sqlite3 -header -csv '.$dbfile.' "select * from registro" > "inscriptos.csv"');
$file = 'inscriptos.csv';
$file = 'inscriptos-surface2018.csv';
exec('sqlite3 -header -csv '.$dbfile.' "select * from registro" > "'.$file.'"');
$fh = fopen($file,"rb");
$stream = new \Slim\Http\Stream($fh);
return $response->withHeader('Content-Type', 'application/force-download')