Mister Spy Say ="Hello Kids ... :D"
___ ____ _ _____
| \/ (_) | | / ___|
| . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _
| |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | |
| | | | \__ \ || __/ | /\__/ / |_) | |_| |
\_| |_/_|___/\__\___|_| \____/| .__/ \__, |
| | __/ |
|_| |___/
Bot Mister Spy V3
Mister Spy
Mister Spy
<?php
require_once('class.dbaccess.php');
require_once('class.logws.php');
require_once('class.filter.php');
require_once('class.page.php');
class LogsWS extends DBAccess implements IFilterable
{
public function ParseFilter(array $filter)
{
$sql = 'WHERE 1';
if (isset($filter['FechaDesde']) && $filter['FechaDesde'] != '')
$sql.= " AND FechaDesde >= " . DB::Date($filter['FechaDesde']);
if (isset($filter['FechaHasta']) && $filter['FechaHasta'] != '')
$sql.= " AND FechaHasta <= " . DB::Date($filter['FechaHasta']);
return $sql;
}
public function GetPagesCount(Page $oPage, $filter = false)
{
$sql = "SELECT COUNT(1) / " . DB::Number($oPage->Size) . " AS Count";
$sql.= " FROM tblLogsWS";
if ($filter)
$sql.= " " . $this->ParseFilter($filter);
if (!($oRes = $this->GetQuery($sql)) )
return false;
if ( !($oRow = $oRes->GetRow()) )
return false;
$Count = $oRow['Count'];
return ceil($Count);
}
public function GetAll(array $filter = NULL, Page $oPage = NULL)
{
$sql = "SELECT *";
$sql.= " FROM tblLogsWS";
if ($filter)
$sql.= $this->ParseFilter($filter);
$sql.= " ORDER BY Fecha";
if ($oPage != NULL)
$sql.= " " . Pageable::ParsePage($oPage);
if (!($oRes = $this->GetQuery($sql)))
return false;
$arr = array();
while ($oRow = $oRes->GetRow())
{
$oLogWS = new LogWS();
$oLogWS->ParseFromArray($oRow);
array_push($arr, $oLogWS);
$oRes->MoveNext();
}
return $arr;
}
public function GetById($IdLogWS)
{
$sql = "SELECT *";
$sql.= " FROM tblLogsWS";
$sql.= " WHERE IdLogWS = " . DB::Number($IdLogWS);
if (!($oRes = $this->GetQuery($sql)))
return false;
if (!($oRow = $oRes->GetRow()))
return false;
$oLogWS = new LogWS();
$oLogWS->ParseFromArray($oRow);
return $oLogWS;
}
public function GetCountRows(array $filter = NULL)
{
$sql = "SELECT *";
$sql.= " FROM tblLogsWS";
if ($filter)
$sql.= $this->ParseFilter($filter);
if (!($oRes = $this->GetQuery($sql)))
return false;
$CountRows = $oRes->NumRows();
return $CountRows;
}
public function Create(LogWS $oLogWS)
{
$arr = array
(
'Fecha' => DB::Date($oLogWS->Fecha),
'Operacion' => DB::String($oLogWS->Operacion),
'XmlRequest' => DB::String($oLogWS->XmlRequest),
'XmlResponse' => DB::String($oLogWS->XmlResponse),
'Comentarios' => DB::String($oLogWS->Comentarios),
'Url' => DB::String($oLogWS->Url)
);
if (!$this->Insert('tblLogsWS', $arr))
return false;
$oLogWS->IdLogWS = DBAccess::GetLastInsertId();
return $oLogWS;
}
private function GetLogEntity($operacion) {
$oLog = new LogWS();
$oLog->Fecha = date('d-m-Y H:i:s');
$oLog->Operacion = $operacion;
return $oLog;
}
public function InitLog() {
$oLog = $this->GetLogEntity('Init');
$oLog->Comentarios = 'Se inicializa el log para consulta SRA.';
$this->Create($oLog);
}
public function AuthLog($password, $key, $request = '', $response = '', $url = '') {
$oLog = $this->GetLogEntity('Auth');
$oLog->Comentarios = "Se autentica contra el WS de SRA. <br />";
$oLog->Comentarios.= "Password: $password <br />";
$oLog->Comentarios.= "Key: $key <br />";
$oLog->XmlRequest.= $request;
$oLog->XmlResponse.= $response;
$oLog->Url = $url;
$this->Create($oLog);
}
public function EncryptData($message, $key, $result) {
$oLog = $this->GetLogEntity('Encrypt');
$oLog->Comentarios = "Se encripta mensaje.<br>Mensaje: $message<br>Key: $key<br>Resultado: $result";
$this->Create($oLog);
}
public function Error($errorMsg, $request = '', $response = '', $url = '') {
$oLog = $this->GetLogEntity('Error');
$oLog->Comentarios = $errorMsg;
$oLog->XmlRequest.= $request;
$oLog->XmlResponse.= $response;
$oLog->Url = $url;
$this->Create($oLog);
}
public function GetData($message, $startDate, $endDate, $request = '', $response = '', $url = '') {
$oLog = $this->GetLogEntity('GetData');
$oLog->Comentarios = "Se obtienen los datos de SRA. <br />";
$oLog->Comentarios.= "Mensaje: $message <br />";
$oLog->Comentarios.= "Fecha Inicio: $startDate <br />";
$oLog->Comentarios.= "Fecha Fin: $endDate <br />";
$oLog->XmlRequest.= $request;
$oLog->XmlResponse.= ''; //$response;
$oLog->Url = $url;
$this->Create($oLog);
}
}
?>
Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat