Limpieza e intento de modernizar informe de ventas

This commit is contained in:
2021-01-19 17:17:29 -03:00
parent baf32be9cb
commit 8ac20ad4b5
154 changed files with 9660 additions and 0 deletions

4
public/api/.htaccess Normal file
View File

@ -0,0 +1,4 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

34
public/api/index.php Normal file
View File

@ -0,0 +1,34 @@
<?php
include_once realpath(dirname(__DIR__, 2) . '/bootstrap/autoload.php');
$get = $_GET;
$post = $_POST;
function get_keys() {
$filename = realpath('./keys');
$keys = [];
if ($filename !== false) {
$keys = json_decode(trim(file_get_contents($filename)));
}
return $keys;
}
function validate_key($keys, $key) {
if (array_search($key, $keys) !== false) {
return true;
}
return false;
}
$keys = get_keys();
$key = $get['API_KEY'];
if (!validate_key($keys, $key)) {
throw new Exception('Error en la identificacion.');
}
$p = $get['page'] ?? $get['p'];
$a = $get['action'] ?? $get['a'];
if ($p == 'precios' and $a == 'importar') {
$data = json_decode($post['data']);
echo json_encode($data);
}

1
public/api/keys Normal file
View File

@ -0,0 +1 @@
[1]