<?php
	set_time_limit(0);
	$hoy=date("Y-m-d");
	echo $hoy;
	echo '<br>';
	set_time_limit(0);
	$ayer = date("Y-m-d",strtotime($hoy."- 1 days"));
	$finicio=$ayer.' 00:00:00';
	$ffinal=$ayer.' 23:59:59';

	echo 'inicio';
	echo '<br>';
$mysqli = new mysqli('10.118.144.75', 'internal', 'mYREbJG0E1lW_', 'gpsimple');   
	$q  = "delete ed1 from gs_user_events_data ed1
	inner join gs_user_events_data ed2
	where  ed1.event_id < ed2.event_id and ed1.imei = ed2.imei and ed1.user_id = ed2.user_id
	and ed1.dt_server = ed2.dt_server and ed1.dt_tracker = ed2.dt_tracker and ed1.name =ed2.name
	and ed1.`type` ='stopped' and ed1.dt_server BETWEEN '".$finicio."' and  now();";
	
	$r = mysqli_query($mysqli, $q);

	
	echo 'fin';
?>

