Commit inicial
This commit is contained in:
42
reporte/read_logfile.php
Normal file
42
reporte/read_logfile.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/* AJAX
|
||||
* Selecciona los datos del log de accesos
|
||||
* Recibe:
|
||||
*
|
||||
* Return:
|
||||
* arreglo de resultados
|
||||
*/
|
||||
require_once("../include/nocache.php");
|
||||
require_once("../include/util.php");
|
||||
require_once("../include/LogAsistencias.php");
|
||||
|
||||
|
||||
// $clave = trim(filter_input(INPUT_POST, "cve", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
|
||||
// $clave = intval($clave);
|
||||
|
||||
|
||||
$logObj = new LogAsistencias();
|
||||
$lines = $logObj->getLog();
|
||||
$lines = array_reverse($lines);
|
||||
if(count($lines) <= 0){
|
||||
$return["error"] = "No hay registros";
|
||||
$return["result"] = false;
|
||||
}else{
|
||||
$result = array();
|
||||
foreach ($lines as $line){
|
||||
$line_text = explode("||", $line);
|
||||
$fecha_hora = explode(" ", $line_text[0]);
|
||||
$result[] = array(
|
||||
"fecha" => fechaSlash($fecha_hora[0])." ".$fecha_hora[1],
|
||||
"clave" => $line_text[1],
|
||||
"status" => $line_text[2],
|
||||
"prof" => (count($line_text) == 4) ? $line_text[3] : ""
|
||||
);
|
||||
}
|
||||
$return["log"] = $result;
|
||||
$return["result"] = true;
|
||||
}
|
||||
|
||||
$return["json"] = json_encode($return);
|
||||
echo json_encode($return);
|
||||
?>
|
||||
Reference in New Issue
Block a user