<?php
//exit;
date_default_timezone_set ( "America/Lima" ); 

define('SF_ROOT_DIR', "/home/akicredito/public_html/akistah");
//define('SF_ROOT_DIR', "C://wamp/www/credisur");
define('SF_APP',      'sys');
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR."lib".DIRECTORY_SEPARATOR."functions".DIRECTORY_SEPARATOR."HelperHelper.php");
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config_core_compile.php');
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'config_autoload.php');


$con= Conexion::getConexion();
$a_param = Conexion::getParamDbByAlias($apps);

$dia = date('N');

//if($dia == 7) exit;


if (!mysql_select_db($a_param['db'], $con)) {
    echo 'Could not select database';
    exit;
}


	//Debe ser un 
	//Esta tarea no debe ejecutarse el domingo
	
if($_GET["metodo"]) $where .= " and metodo = '".$_GET["metodo"]."'";
if($_GET["usuario"]) $where .= " and usuario = '".$_GET["usuario"]."'";

$sql = "SELECT 	*
		FROM 	`cr_wslog` 
		WHERE 	1=1 $where
		order by idlog desc
		limit 0,150
		";

$resultS = mysql_query($sql,$con);
if(mysql_num_rows($resultS) > 0 ){
	?>
	<table width="100%" border="1">
	<tr>
		<td>idlog</td>
		<td>fecharegistro</td>
		<td>cadena</td>
		<td>metodo</td>
		<td>usuario</td>
	</tr>
	<?php
	while($rowS = mysql_fetch_array($resultS)){
		?>
		<tr>
			<td><?=$rowS['idlog']?></td>
			<td><?=$rowS['fecharegistro']?></td>
			<td><?=$rowS['cadena']?></td>
			<td><?=$rowS['metodo']?></td>
			<td><?=$rowS['usuario']?></td>
		</tr>
		<?
	}
	?>
	</table>
	<?php
}
?>